diff --git a/builder/frameworks/espidf.py b/builder/frameworks/espidf.py index ae9e74d..7a2ebb0 100644 --- a/builder/frameworks/espidf.py +++ b/builder/frameworks/espidf.py @@ -20,6 +20,7 @@ Espressif IoT Development Framework for ESP32 MCU https://github.com/espressif/esp-idf """ +import copy import json import subprocess import sys @@ -718,7 +719,6 @@ partition_table = env.Command( ), ) - env.Depends("$BUILD_DIR/$PROGNAME$PROGSUFFIX", partition_table) # @@ -882,6 +882,15 @@ env.Prepend( ], ) +# +# To embed firmware checksum a special argument for esptool.py is required +# + +action = copy.deepcopy(env["BUILDERS"]["ElfToBin"].action) +action.cmd_list = env["BUILDERS"]["ElfToBin"].action.cmd_list.replace( + "-o", "--elf-sha256-offset 0xb0 -o") +env["BUILDERS"]["ElfToBin"].action = action + # # Compile ULP sources in 'ulp' folder # diff --git a/builder/main.py b/builder/main.py index 506aec7..c7b0514 100644 --- a/builder/main.py +++ b/builder/main.py @@ -12,7 +12,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -import copy import re import sys from os.path import isfile, join @@ -128,17 +127,6 @@ def __fetch_spiffs_size(target, source, env): return (target, source) -def append_elf_hash(target, source, env): - if "__BOOTLOADER_BUILD" not in env["CPPDEFINES"]: - if "--elf-sha256-offset" not in env["BUILDERS"]["ElfToBin"].action.cmd_list: - action = copy.deepcopy(env["BUILDERS"]["ElfToBin"].action) - action.cmd_list = env["BUILDERS"]["ElfToBin"].action.cmd_list.replace( - "-o", "--elf-sha256-offset 0xb0 -o") - env["BUILDERS"]["ElfToBin"].action = action - - return (target, source) - - env = DefaultEnvironment() platform = env.PioPlatform() board = env.BoardConfig() @@ -194,7 +182,6 @@ env.Append( "--flash_size", board.get("upload.flash_size", "detect"), "-o", "$TARGET", "$SOURCES" ]), "Building $TARGET"), - emitter=append_elf_hash, suffix=".bin" ), DataToBin=Builder(