Skip to content

Commit 08ef197

Browse files
committed
Install from espressif/tools folder
1 parent 3e4ba3a commit 08ef197

File tree

3 files changed

+69
-54
lines changed

3 files changed

+69
-54
lines changed

builder/main.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,16 +39,11 @@
3939
IDF_TOOLS_FLAG = ["install"]
4040
IDF_TOOLS_CMD = [env["PYTHONEXE"], IDF_TOOLS] + IDF_TOOLS_FLAG
4141

42-
# IDF Install is needed only one times
42+
# IDF Install is needed only one time
4343
if not os.path.exists(join(IDF_TOOLS_PATH_DEFAULT, "tools")):
4444
rc = subprocess.call(IDF_TOOLS_CMD)
4545
if rc != 0:
4646
sys.stderr.write("Error: Couldn't execute 'idf_tools.py install' \n")
47-
else:
48-
print("source dir:", join(IDF_TOOLS_PATH_DEFAULT, "tools"))
49-
print("target dir:", "".join(env.subst("$PROJECT_PACKAGES_DIR")))
50-
rc = shutil.copytree(join(IDF_TOOLS_PATH_DEFAULT, "tools"), "".join(env.subst("$PROJECT_PACKAGES_DIR")), symlinks=True, ignore=None, ignore_dangling_symlinks=True, dirs_exist_ok=True)
51-
print("result copytree:", rc)
5247

5348

5449
def BeforeUpload(target, source, env):

platform.json

Lines changed: 42 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -49,49 +49,49 @@
4949
},
5050
"tc-xt-esp32": {
5151
"type": "toolchain",
52-
"optional": false,
53-
"owner": "espressif",
54-
"version": "https://github.com/pioarduino/registry/releases/download/0.0.1/toolchain-xtensa-esp32.zip"
52+
"optional": true,
53+
"owner": "",
54+
"version": ""
5555
},
5656
"tc-xt-esp32s2": {
5757
"type": "toolchain",
58-
"optional": false,
59-
"owner": "espressif",
60-
"version": "https://github.com/pioarduino/registry/releases/download/0.0.1/toolchain-xtensa-esp32s2.zip"
58+
"optional": true,
59+
"owner": "",
60+
"version": ""
6161
},
6262
"tc-xt-esp32s3": {
6363
"type": "toolchain",
64-
"optional": false,
65-
"owner": "espressif",
66-
"version": "https://github.com/pioarduino/registry/releases/download/0.0.1/toolchain-xtensa-esp32s3.zip"
64+
"optional": true,
65+
"owner": "",
66+
"version": ""
6767
},
6868
"tc-rv32": {
6969
"type": "toolchain",
70-
"optional": false,
71-
"owner": "espressif",
72-
"version": "https://github.com/pioarduino/registry/releases/download/0.0.1/toolchain-riscv32-esp.zip"
70+
"optional": true,
71+
"owner": "",
72+
"version": ""
7373
},
7474
"tc-ulp": {
7575
"type": "toolchain",
76-
"optional": false,
77-
"owner": "espressif",
78-
"version": "https://github.com/pioarduino/registry/releases/download/0.0.1/toolchain-esp32ulp.zip"
76+
"optional": true,
77+
"owner": "",
78+
"version": ""
7979
},
8080
"tl-xt-gdb": {
8181
"type": "debugger",
82-
"optional": false,
83-
"owner": "espressif",
84-
"version": "https://github.com/pioarduino/registry/releases/download/0.0.1/xtensa-esp-elf-gdb.zip"
82+
"optional": true,
83+
"owner": "",
84+
"version": ""
8585
},
8686
"tl-rv-gdb": {
8787
"type": "debugger",
88-
"optional": false,
89-
"owner": "espressif",
90-
"version": "https://github.com/pioarduino/registry/releases/download/0.0.1/riscv32-esp-elf-gdb.zip"
88+
"optional": true,
89+
"owner": "",
90+
"version": ""
9191
},
9292
"tl-esptool": {
9393
"type": "uploader",
94-
"optional": false,
94+
"optional": true,
9595
"owner": "pioarduino",
9696
"version": "https://github.com/pioarduino/esptool/releases/download/v4.7.5/esptool.zip"
9797
},
@@ -102,54 +102,49 @@
102102
},
103103
"tl-dfuutil": {
104104
"type": "uploader",
105-
"optional": false,
106-
"owner": "pioarduino",
107-
"version": "https://github.com/pioarduino/registry/releases/download/0.0.1/tool-dfuutil-arduino.zip"
105+
"optional": true,
106+
"owner": "",
107+
"version": ""
108108
},
109109
"tl-openocd": {
110110
"type": "debugger",
111-
"optional": false,
112-
"owner": "espressif",
113-
"version": "https://github.com/pioarduino/registry/releases/download/0.0.1/tool-openocd-esp32.zip"
111+
"optional": true,
112+
"owner": "",
113+
"version": ""
114114
},
115115
"tl-littlefs320": {
116116
"type": "uploader",
117-
"optional": false,
117+
"optional": true,
118118
"owner": "pioarduino",
119-
"version": "https://github.com/pioarduino/registry/releases/download/0.0.1/tool-mklittlefs_320.zip"
119+
"version": ""
120120
},
121121
"tl-littlefs400": {
122122
"type": "uploader",
123-
"optional": false,
123+
"optional": true,
124124
"owner": "pioarduino",
125-
"version": "https://github.com/pioarduino/registry/releases/download/0.0.1/tool-mklittlefs_400.zip"
125+
"version": ""
126126
},
127127
"tl-fatfs": {
128128
"type": "uploader",
129-
"optional": false,
129+
"optional": true,
130130
"owner": "pioarduino",
131-
"version": "https://github.com/pioarduino/registry/releases/download/0.0.1/tool-mkfatfs.zip"
131+
"version": ""
132132
},
133133
"tl-spiffs": {
134134
"type": "uploader",
135-
"optional": false,
136-
"owner": "pioarduino",
137-
"version": "https://github.com/pioarduino/registry/releases/download/0.0.1/tool-mkspiffs.zip"
138-
},
139-
"tool-scons": {
140-
"optional": false,
135+
"optional": true,
141136
"owner": "pioarduino",
142-
"version": "https://github.com/pioarduino/scons/releases/download/4.7.0/scons-local-4.7.0.tar.gz"
137+
"version": ""
143138
},
144139
"tl-cmake": {
145-
"optional": false,
146-
"owner": "espressif",
147-
"version": "https://github.com/pioarduino/registry/releases/download/0.0.1/tool-cmake.zip"
140+
"optional": true,
141+
"owner": "",
142+
"version": ""
148143
},
149144
"tl-ninja": {
150-
"optional": false,
151-
"owner": "espressif",
152-
"version": "https://github.com/pioarduino/registry/releases/download/0.0.1/tool-ninja.zip"
145+
"optional": true,
146+
"owner": "",
147+
"version": ""
153148
}
154149
}
155150
}

platform.py

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,13 @@
1818
import json
1919
import re
2020
import requests
21+
from os.path import isfile, isdir, join
2122

2223
from platformio.public import PlatformBase, to_unix_path
2324

2425

2526
IS_WINDOWS = sys.platform.startswith("win")
27+
IDF_TOOLS_PATH_DEFAULT = os.path.join(os.path.expanduser("~"), ".espressif")
2628

2729

2830
class Espressif32Platform(PlatformBase):
@@ -34,7 +36,6 @@ def configure_default_packages(self, variables, targets):
3436
mcu = variables.get("board_build.mcu", board_config.get("build.mcu", "esp32"))
3537
frameworks = variables.get("pioframework", [])
3638

37-
self.packages["tool-scons"]["optional"] = False
3839

3940
if "arduino" in frameworks:
4041
self.packages["framework-arduinoespressif32"]["optional"] = False
@@ -44,25 +45,39 @@ def configure_default_packages(self, variables, targets):
4445
filesystem = variables.get("board_build.filesystem", "littlefs")
4546
if filesystem == "littlefs":
4647
self.packages["tl-littlefs320"]["optional"] = False
48+
tl_path = "file://" + join(IDF_TOOLS_PATH_DEFAULT, "tools", "tl-littlefs320")
49+
self.packages["tl-littlefs320"]["version"] = tl_path
4750
elif filesystem == "fatfs":
4851
self.packages["tl-fatfs"]["optional"] = False
52+
tl_path = "file://" + join(IDF_TOOLS_PATH_DEFAULT, "tools", "tl-fatfs")
53+
self.packages["tl-fatfs"]["version"] = tl_path
4954
else:
5055
self.packages["tl-spiffs"]["optional"] = False
56+
tl_path = "file://" + join(IDF_TOOLS_PATH_DEFAULT, "tools", "tl-spiffs")
57+
self.packages["tl-spiffs"]["version"] = tl_path
5158
if variables.get("upload_protocol"):
5259
self.packages["tl-openocd"]["optional"] = False
60+
tl_path = "file://" + join(IDF_TOOLS_PATH_DEFAULT, "tools", "tl-openocd")
61+
self.packages["tl-openocd"]["version"] = tl_path
5362
if os.path.isdir("ulp"):
5463
self.packages["tc-ulp"]["optional"] = False
64+
ulp_path = "file://" + join(IDF_TOOLS_PATH_DEFAULT, "tools", "tc-ulp")
65+
self.packages["tc-ulp"]["version"] = ulp_path
5566

5667
if "downloadfs" in targets:
5768
filesystem = variables.get("board_build.filesystem", "littlefs")
5869
if filesystem == "littlefs":
5970
# Use mklittlefs v4.0.0 to unpack, older version is incompatible
6071
self.packages["tl-littlefs400"]["optional"] = False
72+
tl_path = "file://" + join(IDF_TOOLS_PATH_DEFAULT, "tools", "tl-littlefs400")
73+
self.packages["tl-littlefs400"]["version"] = tl_path
6174
del self.packages["tl-littlefs320"]
6275

6376
# Currently only Arduino Nano ESP32 uses the dfuutil tool as uploader
6477
if variables.get("board") == "arduino_nano_esp32":
6578
self.packages["tl-dfuutil"]["optional"] = False
79+
tl_path = "file://" + join(IDF_TOOLS_PATH_DEFAULT, "tools", "tl-dfuutil")
80+
self.packages["tl-dfuutil"]["version"] = tl_path
6681
else:
6782
del self.packages["tl-dfuutil"]
6883

@@ -71,17 +86,25 @@ def configure_default_packages(self, variables, targets):
7186
# and RISC-V targets.
7287
for gdb_package in ("tl-xt-gdb", "tl-rv-gdb"):
7388
self.packages[gdb_package]["optional"] = False
89+
tl_path = "file://" + join(IDF_TOOLS_PATH_DEFAULT, "tools", gdb_package)
90+
self.packages[gdb_package]["version"] = tl_path
7491

7592
# Common packages for IDF and mixed Arduino+IDF projects
7693
if "espidf" in frameworks:
7794
self.packages["tc-ulp"]["optional"] = False
95+
ulp_path = "file://" + join(IDF_TOOLS_PATH_DEFAULT, "tools", "tc-ulp")
96+
self.packages["tc-ulp"]["version"] = ulp_path
7897
for p in self.packages:
7998
if p in ("tl-cmake", "tl-ninja"):
8099
self.packages[p]["optional"] = False
100+
tl_path = "file://" + join(IDF_TOOLS_PATH_DEFAULT, "tools", p)
101+
self.packages[p]["version"] = tl_path
81102

82103
for available_mcu in ("esp32", "esp32s2", "esp32s3"):
83104
if available_mcu == mcu:
84105
self.packages["tc-xt-%s" % mcu]["optional"] = False
106+
tc_path = "file://" + join(IDF_TOOLS_PATH_DEFAULT, "tools", "tc-xt-%s" % mcu)
107+
self.packages["tc-xt-%s" % mcu]["version"] = tc_path
85108
else:
86109
self.packages.pop("tc-xt-%s" % available_mcu, None)
87110

@@ -90,6 +113,8 @@ def configure_default_packages(self, variables, targets):
90113
self.packages.pop("tc-ulp", None)
91114
# RISC-V based toolchain for ESP32C3, ESP32C6 ESP32S2, ESP32S3 ULP
92115
self.packages["tc-rv32"]["optional"] = False
116+
rv32_path = "file://" + join(IDF_TOOLS_PATH_DEFAULT, "tools", "tc-rv32")
117+
self.packages["tc-rv32"]["version"] = rv32_path
93118

94119
return super().configure_default_packages(variables, targets)
95120

0 commit comments

Comments
 (0)