add crypto stuff to ESP as well

This commit is contained in:
George Hotz 2017-04-27 22:06:31 -07:00
parent dbeb250b4e
commit 234a514b46
13 changed files with 26 additions and 9 deletions

View File

@ -1,4 +1,4 @@
CFLAGS += -I inc -nostdlib
CFLAGS += -I inc -I ../ -nostdlib
CFLAGS += -Tstm32_flash.ld
CC = arm-none-eabi-gcc
@ -37,8 +37,8 @@ obj/gitversion.h:
echo "const uint8_t gitversion[] = \"RELEASE\";" > $@
endif
obj/cert.h: tools/getcertheader.py
./tools/getcertheader.py $(CERT).pub > $@
obj/cert.h: ../crypto/getcertheader.py
../crypto/getcertheader.py $(CERT).pub > $@
obj/bootstub.$(PROJ_NAME).o: bootstub.c early.h obj/cert.h
$(CC) $(CFLAGS) -o $@ -c $<
@ -47,10 +47,10 @@ obj/main.$(PROJ_NAME).o: main.c *.h obj/gitversion.h
$(CC) $(CFLAGS) -o $@ -c $<
# TODO(geohot): learn to use Makefiles
obj/sha.o: crypto/sha.c
obj/sha.o: ../crypto/sha.c
$(CC) $(CFLAGS) -o $@ -c $<
obj/rsa.o: crypto/rsa.c
obj/rsa.o: ../crypto/rsa.c
$(CC) $(CFLAGS) -o $@ -c $<
obj/$(STARTUP_FILE).o: $(STARTUP_FILE).s
@ -61,7 +61,7 @@ obj/$(PROJ_NAME).bin: obj/$(STARTUP_FILE).o obj/main.$(PROJ_NAME).o
# hack
$(CC) -Wl,--section-start,.isr_vector=0x8004000 $(CFLAGS) -o obj/$(PROJ_NAME).elf $^
$(OBJCOPY) -v -O binary obj/$(PROJ_NAME).elf obj/code.bin
./tools/sign.py obj/code.bin $@ $(CERT)
../crypto/sign.py obj/code.bin $@ $(CERT)
obj/bootstub.$(PROJ_NAME).bin: obj/$(STARTUP_FILE).o obj/bootstub.$(PROJ_NAME).o obj/sha.o obj/rsa.o
$(CC) $(CFLAGS) -o obj/bootstub.$(PROJ_NAME).elf $^

View File

@ -1,6 +1,6 @@
PATH := esp-open-sdk/xtensa-lx106-elf/bin:$(PATH)
CC = xtensa-lx106-elf-gcc
CFLAGS = -Iinclude/ -I. -mlongcalls -Iesp-open-sdk/ESP8266_NONOS_SDK_V1.5.4_16_05_20/driver_lib/include -std=c99 -DICACHE_FLASH
CFLAGS = -Iinclude/ -I. -I../ -mlongcalls -Iesp-open-sdk/ESP8266_NONOS_SDK_V1.5.4_16_05_20/driver_lib/include -std=c99 -DICACHE_FLASH
LDLIBS = -nostdlib -Wl,--start-group -lmain -lnet80211 -lwpa -llwip -lpp -lphy -Wl,--end-group -lgcc -ldriver -Wl,--gc-sections
LDFLAGS = -Teagle.app.v6.ld
OBJCP = xtensa-lx106-elf-objcopy
@ -22,7 +22,7 @@ tcp_ota.o: tcp_ota.c
oldflash: proxy-0x00000.bin
./tools/esptool.py write_flash 0 proxy-0x00000.bin 0x40000 proxy-0x40000.bin
user1.bin: proxy.o tcp_ota.o st_ota.o elm327.o webserver.o
user1.bin: proxy.o tcp_ota.o st_ota.o elm327.o webserver.o ../crypto/sha.c ../crypto/rsa.c
$(CC) $(CFLAGS) $^ -o a.out -L$(SDK_BASE)/ld -T$(SDK_BASE)/ld/eagle.app.v6.new.1024.app1.ld $(LDLIBS)
$(OBJCP) --only-section .text -O binary a.out eagle.app.v6.text.bin
$(OBJCP) --only-section .data -O binary a.out eagle.app.v6.data.bin
@ -32,7 +32,7 @@ user1.bin: proxy.o tcp_ota.o st_ota.o elm327.o webserver.o
rm -f eagle.app.v6.*.bin
mv eagle.app.flash.bin $@
user2.bin: proxy.o tcp_ota.o st_ota.o elm327.o webserver.o
user2.bin: proxy.o tcp_ota.o st_ota.o elm327.o webserver.o ../crypto/sha.c ../crypto/rsa.c
$(CC) $(CFLAGS) $^ -o a.out -L$(SDK_BASE)/ld -T$(SDK_BASE)/ld/eagle.app.v6.new.1024.app2.ld $(LDLIBS)
$(OBJCP) --only-section .text -O binary a.out eagle.app.v6.text.bin
$(OBJCP) --only-section .data -O binary a.out eagle.app.v6.data.bin

15
certs/debugesp Normal file
View File

@ -0,0 +1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QrW38myqimvj+0p+YH+CNGCBRlTUQGCO8uLCspMZneRSLPW9Q== batman@y840

1
certs/releaseesp.pub Normal file
View File

@ -0,0 +1 @@
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAAAgQDN4pVyGuJJSde1l3Fjay8qPxog09DsAJZtYPk+armoYO1L6YKReUTcMNyHQYZZMZFmhCdgjCgTIF2QYWMoP4KSe8l6JF04YPP51dIgefc6UXjtlSI8Pyutr0v9xXjSfsVm3RAJxDSHgzs9AoMsluKCL+LhAR1nd7cuHXITJ80O4w== batman@y840