Skip to content

Commit 33c9ee4

Browse files
authored
refactor enabling needed toolchains
1 parent c4e444e commit 33c9ee4

File tree

1 file changed

+17
-13
lines changed

1 file changed

+17
-13
lines changed

platform.py

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -139,23 +139,27 @@ def configure_default_packages(self, variables, targets):
139139
else:
140140
del self.packages["tool-dfuutil"]
141141

142-
# Enable needed toolchains
143-
for available_mcu in ("esp32", "esp32s2", "esp32s3"):
144-
if available_mcu == mcu and tl_flag:
145-
tc_path = "file://" + join(IDF_TOOLS_PATH_DEFAULT, "tools", "tc-xt-esp32")
146-
self.packages["xtensa-esp-elf"]["optional"] = False
147-
self.packages["xtensa-esp-elf"]["version"] = tc_path
148-
if available_mcu == "esp32":
149-
del self.packages["riscv32-esp-elf"]
150-
# Enable riscv and ULP toolchains
151-
if mcu in ("esp32s2", "esp32s3", "esp32c2", "esp32c3", "esp32c6", "esp32h2"):
152-
if mcu in ("esp32c2", "esp32c3", "esp32c6", "esp32h2"):
153-
del self.packages["esp32ulp-elf"]
154-
# RISC-V based toolchain for ESP32C3, ESP32C6 ESP32S2, ESP32S3 ULP
142+
# Enable needed toolchain for MCU
143+
if tl_flag and mcu in ("esp32", "esp32s2", "esp32s3"):
144+
tc_path = "file://" + join(IDF_TOOLS_PATH_DEFAULT, "tools", "tc-xt-esp32")
145+
self.packages["xtensa-esp-elf"]["optional"] = False
146+
self.packages["xtensa-esp-elf"]["version"] = tc_path
147+
else:
155148
if tl_flag:
156149
tc_path = "file://" + join(IDF_TOOLS_PATH_DEFAULT, "tools", "tc-rv32")
157150
self.packages["riscv32-esp-elf"]["optional"] = False
158151
self.packages["riscv32-esp-elf"]["version"] = tc_path
152+
153+
# Enable FSM ULP toolchain for ESP32, ESP32S2, ESP32S3 when IDF is selected
154+
if tl_flag and "espidf" in frameworks and mcu in ("esp32", "esp32s2", "esp32s3"):
155+
tc_path = "file://" + join(IDF_TOOLS_PATH_DEFAULT, "tools", "tc-ulp")
156+
self.packages["esp32ulp-elf"]["optional"] = False
157+
self.packages["esp32ulp-elf"]["version"] = tc_path
158+
# Enable RISC-V ULP toolchain for ESP32C6, ESP32S2, ESP32S3 when IDF is selected
159+
if tl_flag and "espidf" in frameworks and mcu in ("esp32s2", "esp32s3", "esp32c6"):
160+
tc_path = "file://" + join(IDF_TOOLS_PATH_DEFAULT, "tools", "tc-rv32")
161+
self.packages["riscv32-esp-elf"]["optional"] = False
162+
self.packages["riscv32-esp-elf"]["version"] = tc_path
159163

160164
return super().configure_default_packages(variables, targets)
161165

0 commit comments

Comments
 (0)