From a907113ba2c67d2dc3785b1ef93e5ab298d82412 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Sat, 25 Nov 2017 02:49:24 +0200 Subject: [PATCH] Use real flash mode and frequency for bootloader (#873) * Use real flash mode and frequency for bootloader * Use real flash mode and frequency for bootloader --- tools/platformio-build.py | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/tools/platformio-build.py b/tools/platformio-build.py index 09e345c0..9e197e33 100644 --- a/tools/platformio-build.py +++ b/tools/platformio-build.py @@ -103,7 +103,19 @@ env.Prepend( ] ) + +def _get_board_flash_mode(env): + mode = env.subst("$BOARD_FLASH_MODE") + if mode == "qio": + return "dio" + elif mode == "qout": + return "dout" + return mode + + env.Append( + __get_board_flash_mode=_get_board_flash_mode, + LIBSOURCE_DIRS=[ join(FRAMEWORK_DIR, "libraries") ], @@ -118,13 +130,16 @@ env.Append( ], UPLOADERFLAGS=[ - "0x1000", '"%s"' % join(FRAMEWORK_DIR, "tools", "sdk", "bin", "bootloader_dio_40m.bin"), + "0x1000", '"%s"' % join(FRAMEWORK_DIR, "tools", "sdk", "bin", "bootloader_${BOARD_FLASH_MODE}_${__get_board_f_flash(__env__)}.bin"), "0x8000", '"%s"' % join("$BUILD_DIR", "partitions.bin"), "0xe000", '"%s"' % join(FRAMEWORK_DIR, "tools", "partitions", "boot_app0.bin"), "0x10000" ] ) +if "$BOARD_FLASH_MODE" in env['UPLOADERFLAGS']: + env['UPLOADERFLAGS'][env['UPLOADERFLAGS'].index("$BOARD_FLASH_MODE")] = "${__get_board_flash_mode(__env__)}" + env.Replace( UPLOADER=join(FRAMEWORK_DIR, "tools", "esptool.py") )