Skip to content

Commit

Permalink
Implement board_img_freq
Browse files Browse the repository at this point in the history
needed since the build recipe in Arduino has changed.
https://github.com/espressif/arduino-esp32/blob/master/platform.txt#L159
  • Loading branch information
Jason2866 authored Feb 13, 2024
1 parent ecb0953 commit 9779079
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions builder/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,15 @@ def _get_board_memory_type(env):
)


def _get_board_img_freq(env):
board_config = env.BoardConfig()
img_freq = board_config.get("build.img_freq", "")
if img_freq =="":
img_freq = board_config.get("build.f_flash", "")
img_freq = str(img_freq).replace("L", "")
return str(int(int(img_freq) / 1000000)) + "m"


def _get_board_f_flash(env):
frequency = env.subst("$BOARD_F_FLASH")
frequency = str(frequency).replace("L", "")
Expand Down Expand Up @@ -225,6 +234,7 @@ def __fetch_fs_size(target, source, env):
env.Replace(
__get_board_boot_mode=_get_board_boot_mode,
__get_board_f_flash=_get_board_f_flash,
__get_board_img_freq=_get_board_img_freq,
__get_board_flash_mode=_get_board_flash_mode,
__get_board_memory_type=_get_board_memory_type,

Expand Down Expand Up @@ -296,7 +306,7 @@ def __fetch_fs_size(target, source, env):
'"$PYTHONEXE" "$OBJCOPY"',
"--chip", mcu, "elf2image",
"--flash_mode", "${__get_board_flash_mode(__env__)}",
"--flash_freq", "${__get_board_f_flash(__env__)}",
"--flash_freq", "${__get_board_img_freq(__env__)}",
"--flash_size", board.get("upload.flash_size", "4MB"),
"-o", "$TARGET", "$SOURCES"
]), "Building $TARGET"),
Expand Down Expand Up @@ -432,7 +442,7 @@ def __fetch_fs_size(target, source, env):
"--after", board.get("upload.after_reset", "hard_reset"),
"write_flash", "-z",
"--flash_mode", "${__get_board_flash_mode(__env__)}",
"--flash_freq", "${__get_board_f_flash(__env__)}",
"--flash_freq", "${__get_board_img_freq(__env__)}",
"--flash_size", board.get("upload.flash_size", "detect")
],
UPLOADCMD='"$PYTHONEXE" "$UPLOADER" $UPLOADERFLAGS $ESP32_APP_OFFSET $SOURCE'
Expand All @@ -450,7 +460,7 @@ def __fetch_fs_size(target, source, env):
"--after", board.get("upload.after_reset", "hard_reset"),
"write_flash", "-z",
"--flash_mode", "${__get_board_flash_mode(__env__)}",
"--flash_freq", "${__get_board_f_flash(__env__)}",
"--flash_freq", "${__get_board_img_freq(__env__)}",
"--flash_size", board.get("upload.flash_size", "detect"),
"$FS_START"
],
Expand Down

0 comments on commit 9779079

Please sign in to comment.