Skip to content

Commit f923797

Browse files
committed
Move modified ElfToBin builder to ESP-IDF build script
1 parent d3bbd63 commit f923797

File tree

2 files changed

+10
-14
lines changed

2 files changed

+10
-14
lines changed

builder/frameworks/espidf.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
https://github.com/espressif/esp-idf
2121
"""
2222

23+
import copy
2324
import json
2425
import subprocess
2526
import sys
@@ -718,7 +719,6 @@ def get_project_elf(target_configs):
718719
),
719720
)
720721

721-
722722
env.Depends("$BUILD_DIR/$PROGNAME$PROGSUFFIX", partition_table)
723723

724724
#
@@ -882,6 +882,15 @@ def get_project_elf(target_configs):
882882
],
883883
)
884884

885+
#
886+
# To embed firmware checksum a special argument for esptool.py is required
887+
#
888+
889+
action = copy.deepcopy(env["BUILDERS"]["ElfToBin"].action)
890+
action.cmd_list = env["BUILDERS"]["ElfToBin"].action.cmd_list.replace(
891+
"-o", "--elf-sha256-offset 0xb0 -o")
892+
env["BUILDERS"]["ElfToBin"].action = action
893+
885894
#
886895
# Compile ULP sources in 'ulp' folder
887896
#

builder/main.py

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
import copy
1615
import re
1716
import sys
1817
from os.path import isfile, join
@@ -128,17 +127,6 @@ def __fetch_spiffs_size(target, source, env):
128127
return (target, source)
129128

130129

131-
def append_elf_hash(target, source, env):
132-
if "__BOOTLOADER_BUILD" not in env["CPPDEFINES"]:
133-
if "--elf-sha256-offset" not in env["BUILDERS"]["ElfToBin"].action.cmd_list:
134-
action = copy.deepcopy(env["BUILDERS"]["ElfToBin"].action)
135-
action.cmd_list = env["BUILDERS"]["ElfToBin"].action.cmd_list.replace(
136-
"-o", "--elf-sha256-offset 0xb0 -o")
137-
env["BUILDERS"]["ElfToBin"].action = action
138-
139-
return (target, source)
140-
141-
142130
env = DefaultEnvironment()
143131
platform = env.PioPlatform()
144132
board = env.BoardConfig()
@@ -194,7 +182,6 @@ def append_elf_hash(target, source, env):
194182
"--flash_size", board.get("upload.flash_size", "detect"),
195183
"-o", "$TARGET", "$SOURCES"
196184
]), "Building $TARGET"),
197-
emitter=append_elf_hash,
198185
suffix=".bin"
199186
),
200187
DataToBin=Builder(

0 commit comments

Comments
 (0)