Add compatibility with PIO Core 6.0

This commit is contained in:
Ivan Kravets
2022-05-27 17:27:53 +03:00
parent 886f388e4d
commit 2b15a4eeee
4 changed files with 18 additions and 61 deletions
+5 -7
View File
@@ -8,7 +8,6 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
python-version: [3.7]
example:
- "examples/arduino-ble5-advertising"
- "examples/arduino-blink"
@@ -31,18 +30,17 @@ jobs:
- "examples/espidf-ulp-pulse"
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
submodules: "recursive"
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v1
- name: Set up Python
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
python-version: "3.9"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -U https://github.com/platformio/platformio/archive/develop.zip
pio pkg install --global --platform symlink://.
- name: Build examples
run: |
pio run -d ${{ matrix.example }}
platformio run -d ${{ matrix.example }}
+2 -2
View File
@@ -1,4 +1,4 @@
# Espressif 32: development platform for [PlatformIO](http://platformio.org)
# Espressif 32: development platform for [PlatformIO](https://platformio.org)
[![Build Status](https://github.com/platformio/platform-espressif32/workflows/Examples/badge.svg)](https://github.com/platformio/platform-espressif32/actions)
@@ -9,7 +9,7 @@ Espressif Systems is a privately held fabless semiconductor company. They provid
# Usage
1. [Install PlatformIO](http://platformio.org)
1. [Install PlatformIO](https://platformio.org)
2. Create PlatformIO project and configure a platform option in [platformio.ini](https://docs.platformio.org/page/projectconf.html) file:
## Stable version
+1 -1
View File
@@ -12,7 +12,7 @@
"RISC-V"
],
"engines": {
"platformio": "^5"
"platformio": "^6"
},
"repository": {
"type": "git",
+10 -51
View File
@@ -12,7 +12,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import copy
import os
import urllib
import sys
@@ -20,15 +19,16 @@ import json
import re
import requests
from platformio import fs
from platformio.managers.platform import PlatformBase
from platformio.util import get_systype
from platformio.managers.platform import PlatformBase, to_unix_path
IS_WINDOWS = sys.platform.startswith("win")
class Espressif32Platform(PlatformBase):
def configure_default_packages(self, variables, targets):
if not variables.get("board"):
return PlatformBase.configure_default_packages(self, variables, targets)
return super().configure_default_packages(variables, targets)
board_config = self.board_config(variables.get("board"))
mcu = variables.get("board_build.mcu", board_config.get("build.mcu", "esp32"))
@@ -92,7 +92,7 @@ class Espressif32Platform(PlatformBase):
for p in self.packages:
if p in ("tool-cmake", "tool-ninja", "toolchain-%sulp" % mcu):
self.packages[p]["optional"] = False
elif p in ("tool-mconf", "tool-idf") and "windows" in get_systype():
elif p in ("tool-mconf", "tool-idf") and IS_WINDOWS:
self.packages[p]["optional"] = False
for available_mcu in ("esp32", "esp32s2", "esp32s3"):
@@ -143,10 +143,10 @@ class Espressif32Platform(PlatformBase):
self.packages["tool-mbctool"]["type"] = "uploader"
self.packages["tool-mbctool"]["optional"] = False
return PlatformBase.configure_default_packages(self, variables, targets)
return super().configure_default_packages(variables, targets)
def get_boards(self, id_=None):
result = PlatformBase.get_boards(self, id_)
result = super().get_boards(id_)
if not result:
return result
if id_:
@@ -266,60 +266,19 @@ class Espressif32Platform(PlatformBase):
load_cmds = [
'monitor program_esp "{{{path}}}" {offset} verify'.format(
path=fs.to_unix_path(item["path"]), offset=item["offset"]
path=to_unix_path(item["path"]), offset=item["offset"]
)
for item in flash_images
]
load_cmds.append(
'monitor program_esp "{%s.bin}" %s verify'
% (
fs.to_unix_path(debug_config.build_data["prog_path"][:-4]),
to_unix_path(debug_config.build_data["prog_path"][:-4]),
build_extra_data.get("application_offset", "0x10000"),
)
)
debug_config.load_cmds = load_cmds
def configure_debug_options(self, initial_debug_options, ide_data):
"""
Deprecated. Remove method when PlatformIO Core 5.2 is released
"""
ide_extra_data = ide_data.get("extra", {})
flash_images = ide_extra_data.get("flash_images", [])
debug_options = copy.deepcopy(initial_debug_options)
if "openocd" in debug_options["server"].get("executable", ""):
debug_options["server"]["arguments"].extend(
[
"-c",
"adapter_khz %s" % (initial_debug_options.get("speed") or "5000"),
]
)
ignore_conds = [
initial_debug_options["load_cmds"] != ["load"],
not flash_images,
not all([os.path.isfile(item["path"]) for item in flash_images]),
]
if any(ignore_conds):
return debug_options
load_cmds = [
'monitor program_esp "{{{path}}}" {offset} verify'.format(
path=fs.to_unix_path(item["path"]), offset=item["offset"]
)
for item in flash_images
]
load_cmds.append(
'monitor program_esp "{%s.bin}" %s verify'
% (
fs.to_unix_path(ide_data["prog_path"][:-4]),
ide_extra_data.get("application_offset", "0x10000"),
)
)
debug_options["load_cmds"] = load_cmds
return debug_options
@staticmethod
def extract_toolchain_versions(tool_deps):
def _parse_version(original_version):