mirror of https://github.com/arendst/Tasmota.git
Merge pull request #14239 from Jason2866/onefile_flash
prep one file firmware for esp32
This commit is contained in:
commit
8bbf91c43b
|
@ -0,0 +1,30 @@
|
|||
# From: https://github.com/letscontrolit/ESPEasy/blob/mega/tools/pio/post_esp32.py
|
||||
# Thanks TD-er :)
|
||||
|
||||
Import("env")
|
||||
|
||||
def esp32_create_factory_bin(source, target, env):
|
||||
#print("Generating one file initial flash firmware for esp32 units")
|
||||
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")
|
||||
print(" {} | {}".format("Offset", "File"))
|
||||
for section in sections:
|
||||
sect_adr,sect_file = section.split(" ",1)
|
||||
print(" - {} | {}".format(sect_adr,sect_file))
|
||||
source = open(sect_file,"rb")
|
||||
new_file.seek(int(sect_adr,0)-offset)
|
||||
new_file.write(source.read());
|
||||
source.close()
|
||||
|
||||
firmware_name = env.subst("$BUILD_DIR/${PROGNAME}.bin")
|
||||
firmware_start = 0x10000-offset
|
||||
firmware = open(firmware_name,"rb")
|
||||
print(" - {} | {}".format(hex(firmware_start),firmware_name))
|
||||
new_file.seek(firmware_start)
|
||||
new_file.write(firmware.read())
|
||||
new_file.close()
|
||||
firmware.close()
|
||||
|
||||
env.AddPostAction("$BUILD_DIR/${PROGNAME}.bin", esp32_create_factory_bin)
|
|
@ -31,6 +31,7 @@ build_flags = ${esp_defaults.build_flags}
|
|||
; wrappers for the crash-recorder
|
||||
-Wl,--wrap=panicHandler -Wl,--wrap=xt_unhandled_exception
|
||||
extra_scripts = pre:pio-tools/add_c_flags.py
|
||||
post:pio-tools/post_esp32.py
|
||||
${esp_defaults.extra_scripts}
|
||||
|
||||
[core32]
|
||||
|
|
Loading…
Reference in New Issue