Merge pull request #2967 from uzi18/dallas

ESP32: add subtarget for genuine units firmware-factory.bin
This commit is contained in:
TD-er
2020-04-06 14:09:00 +02:00
committed by GitHub
2 changed files with 28 additions and 2 deletions
+5 -2
View File
@@ -15,6 +15,7 @@ board_build.f_flash = 80000000L
board_build.flash_mode = dout
board_upload.maximum_size = 1900544
board_build.partitions = esp32_partition_app1810k_spiffs316k.csv
extra_scripts = post:post_esp32.py
build_unflags = -Wall
build_flags = ${mqtt_flags.build_flags}
-D BUILD_GIT='"${sysenv.TRAVIS_TAG}"'
@@ -30,14 +31,15 @@ extends = esp32_common
platform = ${esp32_common.platform}
build_flags = ${esp32_common.build_flags} -DPLUGIN_BUILD_CUSTOM
board = esp32dev
extra_scripts = pre:pre_custom_esp32.py
extra_scripts = ${esp32_common.extra_scripts}
pre:pre_custom_esp32.py
[env:test_ESP32_4M316k]
extends = esp32_common
platform = ${esp32_common.platform}
build_flags = ${esp32_common.build_flags} -DPLUGIN_SET_TEST_ESP32
board = esp32dev
extra_scripts = ${esp32_common.extra_scripts}
[env:test_ESP32-wrover-kit_4M316k]
@@ -48,5 +50,6 @@ board = esp-wrover-kit
upload_protocol = ftdi
debug_tool = ftdi
debug_extra_cmds = break Misc.ino:3011
extra_scripts = ${esp32_common.extra_scripts}
Executable
+23
View File
@@ -0,0 +1,23 @@
Import("env")
def after_build(source, target, env):
print("Generating factory bin for genuine esp units")
#offset = 0x1000
offset = 0x0
new_file_name = env.subst("$BUILD_DIR/${PROGNAME}-factory.bin")
sections = env.subst(env.get('FLASH_EXTRA_IMAGES'))
new_file = open(new_file_name,"wb")
for section in sections:
sect_adr,sect_file = section.split(" ")
source = open(sect_file,"rb")
new_file.seek(int(sect_adr,0)-offset)
new_file.write(source.read());
source.close()
firmware = open(env.subst("$BUILD_DIR/${PROGNAME}.bin"),"rb")
new_file.seek(0x10000-offset)
new_file.write(firmware.read())
new_file.close()
firmware.close()
env.AddPostAction("$BUILD_DIR/${PROGNAME}.bin", after_build)