18
18
import json
19
19
import re
20
20
import requests
21
+ from os .path import isfile , join
21
22
22
23
from platformio .public import PlatformBase , to_unix_path
24
+ from platformio .project .config import ProjectConfig
23
25
24
26
25
27
IS_WINDOWS = sys .platform .startswith ("win" )
@@ -45,22 +47,24 @@ def configure_default_packages(self, variables, targets):
45
47
if "arduino" in frameworks :
46
48
self .packages ["framework-arduinoespressif32" ]["optional" ] = False
47
49
self .packages ["framework-arduinoespressif32-libs" ]["optional" ] = False
48
- try :
49
- # use latest stable release Arduino core
50
- ARDUINO_CORE_API_URL = "https://api.github.com/repos/espressif/Arduino-esp32/releases/latest"
51
- api_data = requests .get (ARDUINO_CORE_API_URL , timeout = 2 ).json ()
52
- zipball = api_data .get ("zipball_url" )
53
- tag = api_data .get ("tag_name" )
54
- if tag is not None :
55
- # print("Latest release Arduino core URL:", zipball)
56
- self .packages ["framework-arduinoespressif32" ]["version" ] = zipball
57
- # use corresponding espressif Arduino libs to release
58
- URL = "https://raw.githubusercontent.com/espressif/arduino-esp32/" + tag + "/package/package_esp32_index.template.json"
59
- packjdata = requests .get (URL , timeout = 10 ).json ()
60
- dyn_lib_url = packjdata ['packages' ][0 ]['tools' ][0 ]['systems' ][0 ]['url' ]
61
- self .packages ["framework-arduinoespressif32-libs" ]["version" ] = dyn_lib_url
62
- except :
63
- pass
50
+ ARDUINO_FRAMEWORK_DIR = os .path .join (ProjectConfig .get_instance ().get ("platformio" , "packages_dir" ), "framework-arduinoespressif32" )
51
+ if not bool (os .path .exists (ARDUINO_FRAMEWORK_DIR )):
52
+ try :
53
+ # use latest stable release Arduino core
54
+ ARDUINO_CORE_API_URL = "https://api.github.com/repos/espressif/Arduino-esp32/releases/latest"
55
+ api_data = requests .get (ARDUINO_CORE_API_URL , timeout = 2 ).json ()
56
+ zipball = api_data .get ("zipball_url" )
57
+ tag = api_data .get ("tag_name" )
58
+ if tag is not None :
59
+ # print("Latest release Arduino core URL:", zipball)
60
+ self .packages ["framework-arduinoespressif32" ]["version" ] = zipball
61
+ # use corresponding espressif Arduino libs to release
62
+ URL = "https://raw.githubusercontent.com/espressif/arduino-esp32/" + tag + "/package/package_esp32_index.template.json"
63
+ packjdata = requests .get (URL , timeout = 10 ).json ()
64
+ dyn_lib_url = packjdata ['packages' ][0 ]['tools' ][0 ]['systems' ][0 ]['url' ]
65
+ self .packages ["framework-arduinoespressif32-libs" ]["version" ] = dyn_lib_url
66
+ except :
67
+ pass
64
68
65
69
if "buildfs" in targets :
66
70
filesystem = variables .get ("board_build.filesystem" , "littlefs" )
@@ -132,10 +136,10 @@ def configure_default_packages(self, variables, targets):
132
136
# and RISC-V targets.
133
137
for gdb_package in ("tool-xtensa-esp-elf-gdb" , "tool-riscv32-esp-elf-gdb" ):
134
138
self .packages [gdb_package ]["optional" ] = False
135
- if IS_WINDOWS :
139
+ # if IS_WINDOWS:
136
140
# Note: On Windows GDB v12 is not able to
137
141
# launch a GDB server in pipe mode while v11 works fine
138
- self .packages [gdb_package ]["version" ] = "~11.2.0"
142
+ # self.packages[gdb_package]["version"] = "~11.2.0"
139
143
140
144
# Common packages for IDF and mixed Arduino+IDF projects
141
145
if "espidf" in frameworks :
0 commit comments