From 9b46055f142649d8bad251b030884c76d66b32ab Mon Sep 17 00:00:00 2001 From: Trygve Laugstøl Date: Thu, 7 Jun 2018 08:02:01 +0200 Subject: wip --- ota-test/misc/Makefile.header | 44 +++++++++++++++++++++++++++++++++++++++++++ ota-test/misc/header.c | 9 +++++++++ ota-test/misc/header.ld | 12 ++++++++++++ ota-test/misc/main-Kconfig | 20 ++++++++++++++++++++ 4 files changed, 85 insertions(+) create mode 100644 ota-test/misc/Makefile.header create mode 100644 ota-test/misc/header.c create mode 100644 ota-test/misc/header.ld create mode 100644 ota-test/misc/main-Kconfig (limited to 'ota-test/misc') diff --git a/ota-test/misc/Makefile.header b/ota-test/misc/Makefile.header new file mode 100644 index 0000000..5b62dc0 --- /dev/null +++ b/ota-test/misc/Makefile.header @@ -0,0 +1,44 @@ +IDF_PATH ?=../thirdparty/ESP8266_RTOS_SDK + +all: build/header.bin + +build/header.elf: header.c header.ld + xtensa-lx106-elf-gcc -ffreestanding -nostdlib -I ../thirdparty/rboot -Theader.ld -o $@ $< + +build/header.bin: build/header.elf + xtensa-lx106-elf-objcopy --output-target=binary $< $@ + hd $@ + +BAUD=115200 +BAUD=512000 +FLASH_ESPTOOL=python $(IDF_PATH)/components/esptool_py/esptool/esptool.py \ + --chip esp8266 \ + --port /dev/ttyUSB0 \ + --baud $(BAUD) \ + --before default_reset \ + --after hard_reset \ + write_flash \ + -z \ + --flash_mode qio \ + --flash_freq 40m \ + --flash_size 4MB + +flash-boot: + $(FLASH_ESPTOOL) \ + 0x0 build/rboot.bin + 0x3FC000 $(IDF_PATH)/components/esp8266/firmware/esp_init_data_default.bin + +flash-1: build/header.bin +# $(FLASH_ESPTOOL) 0x2000 build/header.bin +# $(FLASH_ESPTOOL) 0x2010 build/ota_test.bin + +flash-2: build/header.bin +# $(FLASH_ESPTOOL) 0x82000 build/header.bin +# $(FLASH_ESPTOOL) 0x82010 build/ota_test.bin + +flash-all: + $(FLASH_ESPTOOL) \ + 0x0 build/rboot.bin \ + 0x2000 build/ota_test.bin \ + 0x82000 build/ota_test.bin \ + 0x3FC000 $(IDF_PATH)/components/esp8266/firmware/esp_init_data_default.bin diff --git a/ota-test/misc/header.c b/ota-test/misc/header.c new file mode 100644 index 0000000..27e685d --- /dev/null +++ b/ota-test/misc/header.c @@ -0,0 +1,9 @@ +#include + +rom_header header = { + .magic = ROM_MAGIC_NEW1, + .count = 2, + .flags1 = 0xaa, + .flags2 = 0x55, + .entry = (void *)0xdeadbeef +}; diff --git a/ota-test/misc/header.ld b/ota-test/misc/header.ld new file mode 100644 index 0000000..33579b6 --- /dev/null +++ b/ota-test/misc/header.ld @@ -0,0 +1,12 @@ +MEMORY +{ + RAM : org = 0x0, len = 0x10 +} + +SECTIONS +{ + .header : + { + *(.data) + } > RAM +} diff --git a/ota-test/misc/main-Kconfig b/ota-test/misc/main-Kconfig new file mode 100644 index 0000000..1d5f736 --- /dev/null +++ b/ota-test/misc/main-Kconfig @@ -0,0 +1,20 @@ +menu "Main: OTA Test" + +choice MAIN_APP + prompt "Select which app to build" + default MAIN_APP1_C + help + Select which bootloader to use + +config MAIN_APP1_C + bool "App 1" +config MAIN_APP2_C + bool "App 2" +endchoice + +config MAIN_APP + int + default 1 if MAIN_APP1_CHOICE + default 2 if MAIN_APP2_CHOICE + +endmenu -- cgit v1.2.3