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
This commit is contained in:
Ivan Kravets 2017-11-25 02:49:24 +02:00 committed by Me No Dev
parent 3300a346e8
commit a907113ba2

View File

@ -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( env.Append(
__get_board_flash_mode=_get_board_flash_mode,
LIBSOURCE_DIRS=[ LIBSOURCE_DIRS=[
join(FRAMEWORK_DIR, "libraries") join(FRAMEWORK_DIR, "libraries")
], ],
@ -118,13 +130,16 @@ env.Append(
], ],
UPLOADERFLAGS=[ 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"), "0x8000", '"%s"' % join("$BUILD_DIR", "partitions.bin"),
"0xe000", '"%s"' % join(FRAMEWORK_DIR, "tools", "partitions", "boot_app0.bin"), "0xe000", '"%s"' % join(FRAMEWORK_DIR, "tools", "partitions", "boot_app0.bin"),
"0x10000" "0x10000"
] ]
) )
if "$BOARD_FLASH_MODE" in env['UPLOADERFLAGS']:
env['UPLOADERFLAGS'][env['UPLOADERFLAGS'].index("$BOARD_FLASH_MODE")] = "${__get_board_flash_mode(__env__)}"
env.Replace( env.Replace(
UPLOADER=join(FRAMEWORK_DIR, "tools", "esptool.py") UPLOADER=join(FRAMEWORK_DIR, "tools", "esptool.py")
) )