diff --git a/.github/workflows/examples.yml b/.github/workflows/examples.yml index 6ac32b5..8feecfe 100644 --- a/.github/workflows/examples.yml +++ b/.github/workflows/examples.yml @@ -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 }} diff --git a/README.md b/README.md index 8f5d47e..f8c9a4e 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/platform.json b/platform.json index 7c5d11a..c09a3bc 100644 --- a/platform.json +++ b/platform.json @@ -12,7 +12,7 @@ "RISC-V" ], "engines": { - "platformio": "^5" + "platformio": "^6" }, "repository": { "type": "git", diff --git a/platform.py b/platform.py index 584749b..ea4ca7c 100644 --- a/platform.py +++ b/platform.py @@ -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):