Skip to content

Commit 2b15a4e

Browse files
committed
Add compatibility with PIO Core 6.0
1 parent 886f388 commit 2b15a4e

File tree

4 files changed

+18
-61
lines changed

4 files changed

+18
-61
lines changed

.github/workflows/examples.yml

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ jobs:
88
fail-fast: false
99
matrix:
1010
os: [ubuntu-latest, windows-latest, macos-latest]
11-
python-version: [3.7]
1211
example:
1312
- "examples/arduino-ble5-advertising"
1413
- "examples/arduino-blink"
@@ -31,18 +30,17 @@ jobs:
3130
- "examples/espidf-ulp-pulse"
3231
runs-on: ${{ matrix.os }}
3332
steps:
34-
- uses: actions/checkout@v2
33+
- uses: actions/checkout@v3
3534
with:
3635
submodules: "recursive"
37-
- name: Set up Python ${{ matrix.python-version }}
38-
uses: actions/setup-python@v1
36+
- name: Set up Python
37+
uses: actions/setup-python@v3
3938
with:
40-
python-version: ${{ matrix.python-version }}
39+
python-version: "3.9"
4140
- name: Install dependencies
4241
run: |
43-
python -m pip install --upgrade pip
4442
pip install -U https://github.com/platformio/platformio/archive/develop.zip
4543
pio pkg install --global --platform symlink://.
4644
- name: Build examples
4745
run: |
48-
pio run -d ${{ matrix.example }}
46+
platformio run -d ${{ matrix.example }}

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Espressif 32: development platform for [PlatformIO](http://platformio.org)
1+
# Espressif 32: development platform for [PlatformIO](https://platformio.org)
22

33
[![Build Status](https://github.com/platformio/platform-espressif32/workflows/Examples/badge.svg)](https://github.com/platformio/platform-espressif32/actions)
44

@@ -9,7 +9,7 @@ Espressif Systems is a privately held fabless semiconductor company. They provid
99

1010
# Usage
1111

12-
1. [Install PlatformIO](http://platformio.org)
12+
1. [Install PlatformIO](https://platformio.org)
1313
2. Create PlatformIO project and configure a platform option in [platformio.ini](https://docs.platformio.org/page/projectconf.html) file:
1414

1515
## Stable version

platform.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
"RISC-V"
1313
],
1414
"engines": {
15-
"platformio": "^5"
15+
"platformio": "^6"
1616
},
1717
"repository": {
1818
"type": "git",

platform.py

Lines changed: 10 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -12,23 +12,23 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
import copy
1615
import os
1716
import urllib
1817
import sys
1918
import json
2019
import re
2120
import requests
2221

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")
2626

2727

2828
class Espressif32Platform(PlatformBase):
2929
def configure_default_packages(self, variables, targets):
3030
if not variables.get("board"):
31-
return PlatformBase.configure_default_packages(self, variables, targets)
31+
return super().configure_default_packages(variables, targets)
3232

3333
board_config = self.board_config(variables.get("board"))
3434
mcu = variables.get("board_build.mcu", board_config.get("build.mcu", "esp32"))
@@ -92,7 +92,7 @@ def configure_default_packages(self, variables, targets):
9292
for p in self.packages:
9393
if p in ("tool-cmake", "tool-ninja", "toolchain-%sulp" % mcu):
9494
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:
9696
self.packages[p]["optional"] = False
9797

9898
for available_mcu in ("esp32", "esp32s2", "esp32s3"):
@@ -143,10 +143,10 @@ def configure_default_packages(self, variables, targets):
143143
self.packages["tool-mbctool"]["type"] = "uploader"
144144
self.packages["tool-mbctool"]["optional"] = False
145145

146-
return PlatformBase.configure_default_packages(self, variables, targets)
146+
return super().configure_default_packages(variables, targets)
147147

148148
def get_boards(self, id_=None):
149-
result = PlatformBase.get_boards(self, id_)
149+
result = super().get_boards(id_)
150150
if not result:
151151
return result
152152
if id_:
@@ -266,60 +266,19 @@ def configure_debug_session(self, debug_config):
266266

267267
load_cmds = [
268268
'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"]
270270
)
271271
for item in flash_images
272272
]
273273
load_cmds.append(
274274
'monitor program_esp "{%s.bin}" %s verify'
275275
% (
276-
fs.to_unix_path(debug_config.build_data["prog_path"][:-4]),
276+
to_unix_path(debug_config.build_data["prog_path"][:-4]),
277277
build_extra_data.get("application_offset", "0x10000"),
278278
)
279279
)
280280
debug_config.load_cmds = load_cmds
281281

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-
323282
@staticmethod
324283
def extract_toolchain_versions(tool_deps):
325284
def _parse_version(original_version):

0 commit comments

Comments
 (0)