Skip to content

Commit

Permalink
Add optional MMU page size flag to elf2bin if it's configurable
Browse files Browse the repository at this point in the history
  • Loading branch information
Jason2866 authored Dec 8, 2023
1 parent a21547e commit 73fcf3a
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion builder/frameworks/espidf.py
Original file line number Diff line number Diff line change
Expand Up @@ -1594,9 +1594,24 @@ def _skip_prj_source_files(node):
# To embed firmware checksum a special argument for esptool.py is required
#

extra_elf2bin_flags = "--elf-sha256-offset 0xb0"
# https://github.com/espressif/esp-idf/blob/master/components/esptool_py/project_include.cmake#L58
# For chips that support configurable MMU page size feature
# If page size is configured to values other than the default "64KB" in menuconfig,
mmu_page_size = "64KB"
if sdk_config.get("SOC_MMU_PAGE_SIZE_CONFIGURABLE", False):
if board_flash_size == "2MB":
mmu_page_size = "32KB"
elif board_flash_size == "1MB":
mmu_page_size = "16KB"

if mmu_page_size != "64KB":
extra_elf2bin_flags += " --flash-mmu-page-size %s" % mmu_page_size

action = copy.deepcopy(env["BUILDERS"]["ElfToBin"].action)

action.cmd_list = env["BUILDERS"]["ElfToBin"].action.cmd_list.replace(
"-o", "--elf-sha256-offset 0xb0 -o"
"-o", extra_elf2bin_flags + " -o"
)
env["BUILDERS"]["ElfToBin"].action = action

Expand Down

0 comments on commit 73fcf3a

Please sign in to comment.