@@ -414,19 +414,20 @@ def switch_off_ldf():
414414# Initialize board configuration and MCU settings
415415board = env .BoardConfig ()
416416mcu = board .get ("build.mcu" , "esp32" )
417+ is_xtensa = mcu in ("esp32" ,"esp32s2" ,"esp32s3" )
417418toolchain_arch = "xtensa-%s" % mcu
418419filesystem = board .get ("build.filesystem" , "littlefs" )
419420
420421# Set toolchain architecture for RISC-V based ESP32 variants
421- if mcu not in ( "esp32" , "esp32s2" , "esp32s3" ) :
422+ if not is_xtensa :
422423 toolchain_arch = "riscv32-esp"
423424
424425# Initialize integration extra data if not present
425426if "INTEGRATION_EXTRA_DATA" not in env :
426427 env ["INTEGRATION_EXTRA_DATA" ] = {}
427428
428429# Take care of possible whitespaces in path
429- objcopy_value = (
430+ uploader_path = (
430431 f'"{ esptool_binary_path } "'
431432 if ' ' in esptool_binary_path
432433 else esptool_binary_path
@@ -446,18 +447,14 @@ def switch_off_ldf():
446447 GDB = join (
447448 platform .get_package_dir (
448449 "tool-riscv32-esp-elf-gdb"
449- if mcu not in (
450- "esp32" ,
451- "esp32s2" ,
452- "esp32s3" ,
453- )
450+ if not is_xtensa
454451 else "tool-xtensa-esp-elf-gdb"
455452 )
456453 or "" ,
457454 "bin" ,
458455 "%s-elf-gdb" % toolchain_arch ,
459456 ),
460- OBJCOPY = objcopy_value ,
457+ OBJCOPY = uploader_path ,
461458 RANLIB = "%s-elf-gcc-ranlib" % toolchain_arch ,
462459 SIZETOOL = "%s-elf-size" % toolchain_arch ,
463460 ARFLAGS = ["rc" ],
@@ -467,7 +464,7 @@ def switch_off_ldf():
467464 SIZECHECKCMD = "$SIZETOOL -A -d $SOURCES" ,
468465 SIZEPRINTCMD = "$SIZETOOL -B -d $SOURCES" ,
469466 ERASEFLAGS = ["--chip" , mcu , "--port" , '"$UPLOAD_PORT"' ],
470- ERASECMD = '" $OBJCOPY" $ERASEFLAGS erase-flash' ,
467+ ERASECMD = '$OBJCOPY $ERASEFLAGS erase-flash' ,
471468 # mkspiffs package contains two different binaries for IDF and Arduino
472469 MKFSTOOL = "mk%s" % filesystem
473470 + (
@@ -719,7 +716,7 @@ def firmware_metrics(target, source, env):
719716# Configure upload protocol: esptool
720717elif upload_protocol == "esptool" :
721718 env .Replace (
722- UPLOADER = objcopy_value ,
719+ UPLOADER = uploader_path ,
723720 UPLOADERFLAGS = [
724721 "--chip" ,
725722 mcu ,
@@ -794,7 +791,7 @@ def firmware_metrics(target, source, env):
794791 "-Q" ,
795792 "-D" ,
796793 ],
797- UPLOADCMD = '" $UPLOADER" $UPLOADERFLAGS "$SOURCE"' ,
794+ UPLOADCMD = '$UPLOADER $UPLOADERFLAGS "$SOURCE"' ,
798795 )
799796
800797# Configure upload protocol: Debug tools (OpenOCD)
0 commit comments