Skip to content

Commit a907113

Browse files
ivankravetsme-no-dev
authored andcommitted
Use real flash mode and frequency for bootloader (espressif#873)
* Use real flash mode and frequency for bootloader * Use real flash mode and frequency for bootloader
1 parent 3300a34 commit a907113

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

tools/platformio-build.py

+16-1
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,19 @@
103103
]
104104
)
105105

106+
107+
def _get_board_flash_mode(env):
108+
mode = env.subst("$BOARD_FLASH_MODE")
109+
if mode == "qio":
110+
return "dio"
111+
elif mode == "qout":
112+
return "dout"
113+
return mode
114+
115+
106116
env.Append(
117+
__get_board_flash_mode=_get_board_flash_mode,
118+
107119
LIBSOURCE_DIRS=[
108120
join(FRAMEWORK_DIR, "libraries")
109121
],
@@ -118,13 +130,16 @@
118130
],
119131

120132
UPLOADERFLAGS=[
121-
"0x1000", '"%s"' % join(FRAMEWORK_DIR, "tools", "sdk", "bin", "bootloader_dio_40m.bin"),
133+
"0x1000", '"%s"' % join(FRAMEWORK_DIR, "tools", "sdk", "bin", "bootloader_${BOARD_FLASH_MODE}_${__get_board_f_flash(__env__)}.bin"),
122134
"0x8000", '"%s"' % join("$BUILD_DIR", "partitions.bin"),
123135
"0xe000", '"%s"' % join(FRAMEWORK_DIR, "tools", "partitions", "boot_app0.bin"),
124136
"0x10000"
125137
]
126138
)
127139

140+
if "$BOARD_FLASH_MODE" in env['UPLOADERFLAGS']:
141+
env['UPLOADERFLAGS'][env['UPLOADERFLAGS'].index("$BOARD_FLASH_MODE")] = "${__get_board_flash_mode(__env__)}"
142+
128143
env.Replace(
129144
UPLOADER=join(FRAMEWORK_DIR, "tools", "esptool.py")
130145
)

0 commit comments

Comments
 (0)