Skip to content

Commit 2f2a8d4

Browse files
authored
Better handling of bootloader configuration (platformio#880)
1 parent 4f51150 commit 2f2a8d4

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

builder/main.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ def __fetch_fs_size(target, source, env):
242242
"--chip", mcu, "elf2image",
243243
"--flash_mode", "$BOARD_FLASH_MODE",
244244
"--flash_freq", "${__get_board_f_flash(__env__)}",
245-
"--flash_size", board.get("upload.flash_size", "detect"),
245+
"--flash_size", board.get("upload.flash_size", "4MB"),
246246
"-o", "$TARGET", "$SOURCES"
247247
]), "Building $TARGET"),
248248
suffix=".bin"
@@ -391,11 +391,12 @@ def __fetch_fs_size(target, source, env):
391391
"--chip", mcu,
392392
"--port", '"$UPLOAD_PORT"',
393393
"--baud", "$UPLOAD_SPEED",
394-
"--before", "default_reset",
395-
"--after", "hard_reset",
394+
"--before", board.get("upload.before_reset", "default_reset"),
395+
"--after", board.get("upload.after_reset", "hard_reset"),
396396
"write_flash", "-z",
397-
"--flash_mode", "$BOARD_FLASH_MODE",
398-
"--flash_size", "detect",
397+
"--flash_mode", "${__get_board_flash_mode(__env__)}",
398+
"--flash_freq", "${__get_board_f_flash(__env__)}",
399+
"--flash_size", board.get("upload.flash_size", "detect"),
399400
"$FS_START"
400401
],
401402
UPLOADCMD='"$PYTHONEXE" "$UPLOADER" $UPLOADERFLAGS $SOURCE',

0 commit comments

Comments
 (0)