|
12 | 12 | # See the License for the specific language governing permissions and
|
13 | 13 | # limitations under the License.
|
14 | 14 |
|
15 |
| -import copy |
16 | 15 | import os
|
17 | 16 | import urllib
|
18 | 17 | import sys
|
19 | 18 | import json
|
20 | 19 | import re
|
21 | 20 | import requests
|
22 | 21 |
|
23 |
| -from platformio import fs |
24 |
| -from platformio.managers.platform import PlatformBase |
25 |
| -from platformio.util import get_systype |
| 22 | +from platformio.managers.platform import PlatformBase, to_unix_path |
| 23 | + |
| 24 | + |
| 25 | +IS_WINDOWS = sys.platform.startswith("win") |
26 | 26 |
|
27 | 27 |
|
28 | 28 | class Espressif32Platform(PlatformBase):
|
29 | 29 | def configure_default_packages(self, variables, targets):
|
30 | 30 | if not variables.get("board"):
|
31 |
| - return PlatformBase.configure_default_packages(self, variables, targets) |
| 31 | + return super().configure_default_packages(variables, targets) |
32 | 32 |
|
33 | 33 | board_config = self.board_config(variables.get("board"))
|
34 | 34 | mcu = variables.get("board_build.mcu", board_config.get("build.mcu", "esp32"))
|
@@ -92,7 +92,7 @@ def configure_default_packages(self, variables, targets):
|
92 | 92 | for p in self.packages:
|
93 | 93 | if p in ("tool-cmake", "tool-ninja", "toolchain-%sulp" % mcu):
|
94 | 94 | self.packages[p]["optional"] = False
|
95 |
| - elif p in ("tool-mconf", "tool-idf") and "windows" in get_systype(): |
| 95 | + elif p in ("tool-mconf", "tool-idf") and IS_WINDOWS: |
96 | 96 | self.packages[p]["optional"] = False
|
97 | 97 |
|
98 | 98 | for available_mcu in ("esp32", "esp32s2", "esp32s3"):
|
@@ -143,10 +143,10 @@ def configure_default_packages(self, variables, targets):
|
143 | 143 | self.packages["tool-mbctool"]["type"] = "uploader"
|
144 | 144 | self.packages["tool-mbctool"]["optional"] = False
|
145 | 145 |
|
146 |
| - return PlatformBase.configure_default_packages(self, variables, targets) |
| 146 | + return super().configure_default_packages(variables, targets) |
147 | 147 |
|
148 | 148 | def get_boards(self, id_=None):
|
149 |
| - result = PlatformBase.get_boards(self, id_) |
| 149 | + result = super().get_boards(id_) |
150 | 150 | if not result:
|
151 | 151 | return result
|
152 | 152 | if id_:
|
@@ -266,60 +266,19 @@ def configure_debug_session(self, debug_config):
|
266 | 266 |
|
267 | 267 | load_cmds = [
|
268 | 268 | 'monitor program_esp "{{{path}}}" {offset} verify'.format(
|
269 |
| - path=fs.to_unix_path(item["path"]), offset=item["offset"] |
| 269 | + path=to_unix_path(item["path"]), offset=item["offset"] |
270 | 270 | )
|
271 | 271 | for item in flash_images
|
272 | 272 | ]
|
273 | 273 | load_cmds.append(
|
274 | 274 | 'monitor program_esp "{%s.bin}" %s verify'
|
275 | 275 | % (
|
276 |
| - fs.to_unix_path(debug_config.build_data["prog_path"][:-4]), |
| 276 | + to_unix_path(debug_config.build_data["prog_path"][:-4]), |
277 | 277 | build_extra_data.get("application_offset", "0x10000"),
|
278 | 278 | )
|
279 | 279 | )
|
280 | 280 | debug_config.load_cmds = load_cmds
|
281 | 281 |
|
282 |
| - def configure_debug_options(self, initial_debug_options, ide_data): |
283 |
| - """ |
284 |
| - Deprecated. Remove method when PlatformIO Core 5.2 is released |
285 |
| - """ |
286 |
| - ide_extra_data = ide_data.get("extra", {}) |
287 |
| - flash_images = ide_extra_data.get("flash_images", []) |
288 |
| - debug_options = copy.deepcopy(initial_debug_options) |
289 |
| - |
290 |
| - if "openocd" in debug_options["server"].get("executable", ""): |
291 |
| - debug_options["server"]["arguments"].extend( |
292 |
| - [ |
293 |
| - "-c", |
294 |
| - "adapter_khz %s" % (initial_debug_options.get("speed") or "5000"), |
295 |
| - ] |
296 |
| - ) |
297 |
| - |
298 |
| - ignore_conds = [ |
299 |
| - initial_debug_options["load_cmds"] != ["load"], |
300 |
| - not flash_images, |
301 |
| - not all([os.path.isfile(item["path"]) for item in flash_images]), |
302 |
| - ] |
303 |
| - |
304 |
| - if any(ignore_conds): |
305 |
| - return debug_options |
306 |
| - |
307 |
| - load_cmds = [ |
308 |
| - 'monitor program_esp "{{{path}}}" {offset} verify'.format( |
309 |
| - path=fs.to_unix_path(item["path"]), offset=item["offset"] |
310 |
| - ) |
311 |
| - for item in flash_images |
312 |
| - ] |
313 |
| - load_cmds.append( |
314 |
| - 'monitor program_esp "{%s.bin}" %s verify' |
315 |
| - % ( |
316 |
| - fs.to_unix_path(ide_data["prog_path"][:-4]), |
317 |
| - ide_extra_data.get("application_offset", "0x10000"), |
318 |
| - ) |
319 |
| - ) |
320 |
| - debug_options["load_cmds"] = load_cmds |
321 |
| - return debug_options |
322 |
| - |
323 | 282 | @staticmethod
|
324 | 283 | def extract_toolchain_versions(tool_deps):
|
325 | 284 | def _parse_version(original_version):
|
|
0 commit comments