Arduino Core 3.3.0
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
# pioarduino (p)eople (i)nitiated (o)ptimized (arduino)
|
||||
|
||||
[](https://github.com/pioarduino/platform-espressif32/actions)
|
||||
[](https://github.com/pioarduino/platform-espressif32/actions/workflows/examples.yml)
|
||||
[](https://discord.gg/Nutz9crnZr)
|
||||
[](https://github.com/pioarduino/platform-espressif32/releases/latest)
|
||||
|
||||
@@ -9,8 +9,8 @@ Espressif Systems is a privately held, fabless semiconductor company renowned fo
|
||||
## General
|
||||
* Issues with boards (wrong / missing). All issues caused from boards will not be fixed from the maintainer(s). A PR needs to be provided against branch `develop` to solve.
|
||||
* No support for the Arduino Nora Nano board, issues needs to be solved by the community
|
||||
## IDE Preparation
|
||||
|
||||
## IDE Preparation
|
||||
- [Download and install Microsoft Visual Studio Code](https://code.visualstudio.com/). pioarduino IDE is on top of it.
|
||||
- Open the extension manager.
|
||||
- Search for the `pioarduino ide` extension.
|
||||
@@ -25,7 +25,7 @@ Espressif Systems is a privately held, fabless semiconductor company renowned fo
|
||||
The Wiki is AI generated and insane detailed and accurate.
|
||||
|
||||
### Stable Arduino
|
||||
currently espressif Arduino 3.2.1 and IDF 5.4.2
|
||||
currently espressif Arduino 3.3.0 and IDF 5.5.0
|
||||
|
||||
```ini
|
||||
[env:stable]
|
||||
@@ -49,13 +49,13 @@ Example configuration:
|
||||
|
||||
```ini
|
||||
[env:esp32solo1]
|
||||
platform = https://github.com/pioarduino/platform-espressif32/releases/download/stable/platform-espressif32.zip
|
||||
platform = https://github.com/pioarduino/platform-espressif32.git#develop
|
||||
framework = arduino
|
||||
board = esp32-solo1
|
||||
monitor_speed = 115200
|
||||
|
||||
[env:esp32-c2-devkitm-1]
|
||||
platform = https://github.com/pioarduino/platform-espressif32/releases/download/stable/platform-espressif32.zip
|
||||
platform = https://github.com/pioarduino/platform-espressif32.git#develop
|
||||
framework = arduino
|
||||
board = esp32-c2-devkitm-1
|
||||
monitor_speed = 115200
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
{
|
||||
"build": {
|
||||
"core": "esp32",
|
||||
"f_cpu": "240000000L",
|
||||
"f_flash": "80000000L",
|
||||
"flash_mode": "qio",
|
||||
"mcu": "esp32c5",
|
||||
"variant": "esp32c5"
|
||||
},
|
||||
"connectivity": [
|
||||
"bluetooth",
|
||||
"wifi"
|
||||
],
|
||||
"debug": {
|
||||
"openocd_target": "esp32c5.cfg"
|
||||
},
|
||||
"frameworks": [
|
||||
"arduino",
|
||||
"espidf"
|
||||
],
|
||||
"name": "Espressif ESP32-C5-DevKitC-1 4MB no PSRAM",
|
||||
"upload": {
|
||||
"flash_size": "4MB",
|
||||
"maximum_ram_size": 327680,
|
||||
"maximum_size": 4194304,
|
||||
"require_upload_port": true,
|
||||
"speed": 460800
|
||||
},
|
||||
"url": "https://docs.espressif.com/projects/esp-dev-kits/en/latest/esp32c5/esp32-c5-devkitc-1/user_guide.html",
|
||||
"vendor": "Espressif"
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
{
|
||||
"build": {
|
||||
"arduino":{
|
||||
"partitions": "default_8MB.csv",
|
||||
"memory_type": "qio_qspi"
|
||||
},
|
||||
"core": "esp32",
|
||||
"extra_flags": [
|
||||
"-DARDUINO_YB_ESP32S3_DRV",
|
||||
"-DARDUINO_USB_MODE=1",
|
||||
"-DARDUINO_USB_CDC_ON_BOOT=1",
|
||||
"-DARDUINO_RUNNING_CORE=1",
|
||||
"-DARDUINO_EVENT_RUNNING_CORE=1",
|
||||
"-DBOARD_HAS_PSRAM"
|
||||
],
|
||||
"f_cpu": "240000000L",
|
||||
"f_flash": "80000000L",
|
||||
"flash_mode": "qio",
|
||||
"hwids": [
|
||||
[
|
||||
"0x303A",
|
||||
"0x1001"
|
||||
]
|
||||
],
|
||||
"mcu": "esp32s3",
|
||||
"variant": "yb_esp32s3_drv"
|
||||
},
|
||||
"connectivity": [
|
||||
"wifi",
|
||||
"bluetooth"
|
||||
],
|
||||
"debug": {
|
||||
"openocd_target": "esp32s3.cfg"
|
||||
},
|
||||
"frameworks": [
|
||||
"arduino",
|
||||
"espidf"
|
||||
],
|
||||
"name": "YelloByte YB-ESP32-S3-DRV",
|
||||
"upload": {
|
||||
"flash_size": "8MB",
|
||||
"maximum_ram_size": 327680,
|
||||
"maximum_size": 8388608,
|
||||
"require_upload_port": true,
|
||||
"speed": 460800
|
||||
},
|
||||
"url": "https://github.com/yellobyte/YB-ESP32-S3-DRV",
|
||||
"vendor": "YelloByte"
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
/*
|
||||
Based on Neil Kolban example for IDF: https://github.com/nkolban/esp32-snippets/blob/master/cpp_utils/tests/BLE%20Tests/SampleScan.cpp
|
||||
Ported to Arduino ESP32 by Evandro Copercini
|
||||
*/
|
||||
|
||||
#include <BLEDevice.h>
|
||||
#include <BLEUtils.h>
|
||||
#include <BLEScan.h>
|
||||
#include <BLEAdvertisedDevice.h>
|
||||
|
||||
int scanTime = 5; //In seconds
|
||||
BLEScan *pBLEScan;
|
||||
|
||||
class MyAdvertisedDeviceCallbacks : public BLEAdvertisedDeviceCallbacks {
|
||||
void onResult(BLEAdvertisedDevice advertisedDevice) {
|
||||
Serial.printf("Advertised Device: %s \n", advertisedDevice.toString().c_str());
|
||||
}
|
||||
};
|
||||
|
||||
void setup() {
|
||||
Serial.begin(115200);
|
||||
Serial.println("Scanning...");
|
||||
|
||||
BLEDevice::init("");
|
||||
pBLEScan = BLEDevice::getScan(); //create new scan
|
||||
pBLEScan->setAdvertisedDeviceCallbacks(new MyAdvertisedDeviceCallbacks());
|
||||
pBLEScan->setActiveScan(true); //active scan uses more power, but get results faster
|
||||
pBLEScan->setInterval(100);
|
||||
pBLEScan->setWindow(99); // less or equal setInterval value
|
||||
}
|
||||
|
||||
void loop() {
|
||||
// put your main code here, to run repeatedly:
|
||||
BLEScanResults *foundDevices = pBLEScan->start(scanTime, false);
|
||||
Serial.print("Devices found: ");
|
||||
Serial.println(foundDevices->getCount());
|
||||
Serial.println("Scan done!");
|
||||
pBLEScan->clearResults(); // delete results fromBLEScan buffer to release memory
|
||||
delay(2000);
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
.pio
|
||||
.vscode
|
||||
.dependencies.lock
|
||||
sdkconfig.esp32c6
|
||||
managed_components
|
||||
@@ -0,0 +1,3 @@
|
||||
cmake_minimum_required(VERSION 3.16.0)
|
||||
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
|
||||
project(espidf-arduino-c6-ulp-blink)
|
||||
@@ -0,0 +1,9 @@
|
||||
# Arduino ULP Example for the ESP32-C6
|
||||
|
||||
This example shows how to run a C program on the ESP32-C6 ULP core with Arduino (as an component of ESP-IDF)
|
||||
|
||||
## Two programs run parallel
|
||||
|
||||
1. **Arduino on the High Power Core (HP Core):** The Arduino program blinks the onboard RGB
|
||||
2. **C Program on the Ultra-Low Power Core (ULP):** The ULP C program blinks an external LED connected to GPIO3
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
|
||||
This directory is intended for project header files.
|
||||
|
||||
A header file is a file containing C declarations and macro definitions
|
||||
to be shared between several project source files. You request the use of a
|
||||
header file in your project source file (C, C++, etc) located in `src` folder
|
||||
by including it, with the C preprocessing directive `#include'.
|
||||
|
||||
```src/main.c
|
||||
|
||||
#include "header.h"
|
||||
|
||||
int main (void)
|
||||
{
|
||||
...
|
||||
}
|
||||
```
|
||||
|
||||
Including a header file produces the same results as copying the header file
|
||||
into each source file that needs it. Such copying would be time-consuming
|
||||
and error-prone. With a header file, the related declarations appear
|
||||
in only one place. If they need to be changed, they can be changed in one
|
||||
place, and programs that include the header file will automatically use the
|
||||
new version when next recompiled. The header file eliminates the labor of
|
||||
finding and changing all the copies as well as the risk that a failure to
|
||||
find one copy will result in inconsistencies within a program.
|
||||
|
||||
In C, the usual convention is to give header files names that end with `.h'.
|
||||
It is most portable to use only letters, digits, dashes, and underscores in
|
||||
header file names, and at most one dot.
|
||||
|
||||
Read more about using header files in official GCC documentation:
|
||||
|
||||
* Include Syntax
|
||||
* Include Operation
|
||||
* Once-Only Headers
|
||||
* Computed Includes
|
||||
|
||||
https://gcc.gnu.org/onlinedocs/cpp/Header-Files.html
|
||||
@@ -0,0 +1,46 @@
|
||||
|
||||
This directory is intended for project specific (private) libraries.
|
||||
PlatformIO will compile them to static libraries and link into executable file.
|
||||
|
||||
The source code of each library should be placed in a an own separate directory
|
||||
("lib/your_library_name/[here are source files]").
|
||||
|
||||
For example, see a structure of the following two libraries `Foo` and `Bar`:
|
||||
|
||||
|--lib
|
||||
| |
|
||||
| |--Bar
|
||||
| | |--docs
|
||||
| | |--examples
|
||||
| | |--src
|
||||
| | |- Bar.c
|
||||
| | |- Bar.h
|
||||
| | |- library.json (optional, custom build options, etc) https://docs.platformio.org/page/librarymanager/config.html
|
||||
| |
|
||||
| |--Foo
|
||||
| | |- Foo.c
|
||||
| | |- Foo.h
|
||||
| |
|
||||
| |- README --> THIS FILE
|
||||
|
|
||||
|- platformio.ini
|
||||
|--src
|
||||
|- main.c
|
||||
|
||||
and a contents of `src/main.c`:
|
||||
```
|
||||
#include <Foo.h>
|
||||
#include <Bar.h>
|
||||
|
||||
int main (void)
|
||||
{
|
||||
...
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
PlatformIO Library Dependency Finder will find automatically dependent
|
||||
libraries scanning project source files.
|
||||
|
||||
More information about PlatformIO Library Dependency Finder
|
||||
- https://docs.platformio.org/page/librarymanager/ldf.html
|
||||
@@ -0,0 +1,28 @@
|
||||
; PlatformIO Project Configuration File
|
||||
;
|
||||
; Build options: build flags, source filter, extra scripting
|
||||
; Upload options: custom port, speed, and extra flags
|
||||
; Library options: dependencies, extra library storages
|
||||
;
|
||||
; Documentation: https://docs.platformio.org/page/projectconf.html
|
||||
|
||||
[env:esp32c6]
|
||||
platform = espressif32
|
||||
framework = arduino, espidf
|
||||
board = esp32-c6-devkitc-1
|
||||
monitor_speed = 115200
|
||||
lib_deps =
|
||||
Adafruit NeoPixel@1.12.3
|
||||
custom_component_remove =
|
||||
espressif/esp_hosted
|
||||
espressif/esp_wifi_remote
|
||||
espressif/esp-dsp
|
||||
espressif/esp32-camera
|
||||
espressif/libsodium
|
||||
espressif/esp-modbus
|
||||
espressif/qrcode
|
||||
espressif/esp_insights
|
||||
espressif/esp_diag_data_store
|
||||
espressif/esp_diagnostics
|
||||
espressif/esp_rainmaker
|
||||
espressif/rmaker_common
|
||||
@@ -0,0 +1,19 @@
|
||||
# C6 devkit has 8 MB flash
|
||||
CONFIG_ESPTOOLPY_FLASHSIZE_8MB=y
|
||||
|
||||
# Enable ULP
|
||||
CONFIG_ULP_COPROC_ENABLED=y
|
||||
CONFIG_ULP_COPROC_TYPE_LP_CORE=y
|
||||
CONFIG_ULP_COPROC_RESERVE_MEM=8192
|
||||
|
||||
# Set log level
|
||||
CONFIG_BOOTLOADER_LOG_LEVEL_WARN=y
|
||||
CONFIG_BOOTLOADER_LOG_LEVEL=2
|
||||
CONFIG_LOG_DEFAULT_LEVEL_WARN=y
|
||||
CONFIG_LOG_DEFAULT_LEVEL=2
|
||||
|
||||
# Arduino settings
|
||||
CONFIG_AUTOSTART_ARDUINO=y
|
||||
CONFIG_FREERTOS_HZ=1000
|
||||
CONFIG_MBEDTLS_PSK_MODES=y
|
||||
CONFIG_MBEDTLS_KEY_EXCHANGE_PSK=y
|
||||
@@ -0,0 +1,20 @@
|
||||
idf_component_register(SRCS "main.cpp")
|
||||
|
||||
#
|
||||
# ULP support additions to component CMakeLists.txt.
|
||||
#
|
||||
# 1. The ULP app name must be "ulp_main"
|
||||
set(ulp_app_name ulp_main)
|
||||
#
|
||||
# 2. Specify all assembly source files.
|
||||
# Paths are relative because ULP files are placed into a special directory "ulp"
|
||||
# in the root of the project
|
||||
set(ulp_s_sources "../ulp/blink.c")
|
||||
#
|
||||
# 3. List all the component source files which include automatically
|
||||
# generated ULP export file, ${ulp_app_name}.h:
|
||||
set(ulp_exp_dep_srcs "main.c")
|
||||
#
|
||||
# 4. Call function to build ULP binary and embed in project using the argument
|
||||
# values above.
|
||||
ulp_embed_binary(${ulp_app_name} ${ulp_s_sources} ${ulp_exp_dep_srcs})
|
||||
@@ -0,0 +1,69 @@
|
||||
#include <Arduino.h>
|
||||
#include <Adafruit_NeoPixel.h>
|
||||
#include "ulp_lp_core.h"
|
||||
#include "esp_err.h"
|
||||
|
||||
// Define the built-in RGB LED pin and number of LEDs
|
||||
#define LED_PIN 8
|
||||
#define NUM_LEDS 1
|
||||
|
||||
Adafruit_NeoPixel rgbLed(NUM_LEDS, LED_PIN, NEO_GRB + NEO_KHZ800);
|
||||
|
||||
// Define some colors
|
||||
struct RGB {
|
||||
uint8_t r, g, b;
|
||||
};
|
||||
|
||||
constexpr RGB COLOR_RED = {255, 0, 0};
|
||||
constexpr RGB COLOR_GREEN = {0, 255, 0};
|
||||
constexpr RGB COLOR_BLUE = {0, 0, 255};
|
||||
constexpr RGB COLOR_OFF = {0, 0, 0};
|
||||
|
||||
extern const uint8_t bin_start[] asm("_binary_ulp_main_bin_start"); //refering to app name ulp_main defined in CMakelists.txt
|
||||
extern const uint8_t bin_end[] asm("_binary_ulp_main_bin_end"); //refering to app name ulp_main defined in CMakelists.txt
|
||||
|
||||
void start_ulp_program() {
|
||||
// Change: Load the ULP binary into RTC memory
|
||||
ESP_ERROR_CHECK(ulp_lp_core_load_binary(bin_start, (bin_end - bin_start)));
|
||||
|
||||
// Change: Configure the ULP LP core wake-up source and timer
|
||||
ulp_lp_core_cfg_t cfg = {
|
||||
.wakeup_source = ULP_LP_CORE_WAKEUP_SOURCE_LP_TIMER, // Wake up using LP timer
|
||||
.lp_timer_sleep_duration_us = 1000000, // 1-second sleep duration
|
||||
};
|
||||
|
||||
// Change: Start the ULP LP core program
|
||||
ESP_ERROR_CHECK(ulp_lp_core_run(&cfg));
|
||||
}
|
||||
|
||||
void setColor(const RGB& color) {
|
||||
rgbLed.setPixelColor(0, rgbLed.Color(color.r, color.g, color.b));
|
||||
rgbLed.show();
|
||||
}
|
||||
|
||||
void setup() {
|
||||
Serial.begin(115200);
|
||||
Serial.println("Starting ULP Program...");
|
||||
start_ulp_program();
|
||||
Serial.println("Starting RGB LED blinking...");
|
||||
rgbLed.begin(); // Initialize the NeoPixel library
|
||||
rgbLed.show(); // Turn off all LEDs initially
|
||||
}
|
||||
|
||||
void loop() {
|
||||
Serial.println("Setting color to RED");
|
||||
setColor(COLOR_RED);
|
||||
delay(1000);
|
||||
|
||||
Serial.println("Setting color to GREEN");
|
||||
setColor(COLOR_GREEN);
|
||||
delay(1000);
|
||||
|
||||
Serial.println("Setting color to BLUE");
|
||||
setColor(COLOR_BLUE);
|
||||
delay(1000);
|
||||
|
||||
Serial.println("Turning off LED");
|
||||
setColor(COLOR_OFF);
|
||||
delay(1000);
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
|
||||
This directory is intended for PIO Unit Testing and project tests.
|
||||
|
||||
Unit Testing is a software testing method by which individual units of
|
||||
source code, sets of one or more MCU program modules together with associated
|
||||
control data, usage procedures, and operating procedures, are tested to
|
||||
determine whether they are fit for use. Unit testing finds problems early
|
||||
in the development cycle.
|
||||
|
||||
More information about PIO Unit Testing:
|
||||
- https://docs.platformio.org/page/plus/unit-testing.html
|
||||
@@ -0,0 +1,34 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2023 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Unlicense OR CC0-1.0
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include "ulp_lp_core.h"
|
||||
#include "ulp_lp_core_utils.h"
|
||||
#include "ulp_lp_core_gpio.h"
|
||||
|
||||
#define BLINK_PIN LP_IO_NUM_3 // Define the GPIO pin connected to the LED
|
||||
#define BLINK_DELAY_MS 1000 // Define the delay in milliseconds between toggles
|
||||
|
||||
// Global variables can be accessed from the main program
|
||||
volatile bool ulp_led_state;
|
||||
|
||||
int main(void)
|
||||
{
|
||||
// Initialize the GPIO pin as output
|
||||
ulp_lp_core_gpio_init(BLINK_PIN);
|
||||
ulp_lp_core_gpio_output_enable(BLINK_PIN);
|
||||
|
||||
// Toggle the LED state
|
||||
ulp_led_state = !ulp_led_state;
|
||||
ulp_lp_core_gpio_set_level(BLINK_PIN, (int)ulp_led_state);
|
||||
|
||||
// Delay for BLINK_DELAY_MS
|
||||
ulp_lp_core_delay_us(BLINK_DELAY_MS * 1000);
|
||||
|
||||
/* ulp_lp_core_halt() is called automatically when main exits */
|
||||
return 0;
|
||||
}
|
||||
+23
-16
@@ -18,7 +18,7 @@
|
||||
"type": "git",
|
||||
"url": "https://github.com/pioarduino/platform-espressif32.git"
|
||||
},
|
||||
"version": "54.03.21",
|
||||
"version": "55.03.30",
|
||||
"frameworks": {
|
||||
"arduino": {
|
||||
"script": "builder/frameworks/arduino.py"
|
||||
@@ -33,25 +33,25 @@
|
||||
"type": "framework",
|
||||
"optional": true,
|
||||
"owner": "espressif",
|
||||
"version": "https://github.com/espressif/arduino-esp32/releases/download/3.2.1/esp32-3.2.1.zip"
|
||||
"version": "https://github.com/espressif/arduino-esp32/releases/download/3.3.0/esp32-3.3.0.zip"
|
||||
},
|
||||
"framework-arduinoespressif32-libs": {
|
||||
"type": "framework",
|
||||
"optional": true,
|
||||
"owner": "espressif",
|
||||
"version": "https://github.com/espressif/esp32-arduino-lib-builder/releases/download/idf-release_v5.4/esp32-arduino-libs-idf-release_v5.4-858a988d-v1.zip"
|
||||
"version": "https://github.com/espressif/esp32-arduino-lib-builder/releases/download/idf-release_v5.5/esp32-arduino-libs-idf-release_v5.5-b66b5448-v1.zip"
|
||||
},
|
||||
"framework-arduino-c2-skeleton-lib": {
|
||||
"type": "framework",
|
||||
"optional": true,
|
||||
"owner": "espressif",
|
||||
"version": "https://github.com/pioarduino/platform-espressif32/releases/download/54.03.20/c2_arduino_compile_skeleton.zip"
|
||||
"version": "https://github.com/pioarduino/platform-espressif32/releases/download/55.03.30-alpha1/c2_cbe9388f45_compile_skeleton.zip"
|
||||
},
|
||||
"framework-espidf": {
|
||||
"type": "framework",
|
||||
"optional": true,
|
||||
"owner": "pioarduino",
|
||||
"version": "https://github.com/pioarduino/esp-idf/releases/download/v5.4.2/esp-idf-v5.4.2.zip"
|
||||
"version": "https://github.com/pioarduino/esp-idf/releases/download/v5.5.0/esp-idf-v5.5.0.zip"
|
||||
},
|
||||
"toolchain-xtensa-esp-elf": {
|
||||
"type": "toolchain",
|
||||
@@ -90,15 +90,22 @@
|
||||
},
|
||||
"tool-esptoolpy": {
|
||||
"type": "uploader",
|
||||
"optional": false,
|
||||
"optional": true,
|
||||
"owner": "pioarduino",
|
||||
"version": "https://github.com/pioarduino/esptool/releases/download/v5.0.0-dev1/esptool.zip"
|
||||
"package-version": "5.0.1",
|
||||
"version": "https://github.com/pioarduino/registry/releases/download/0.0.1/esptoolpy-v5.0.1.zip"
|
||||
},
|
||||
"tl-install": {
|
||||
"type": "tool",
|
||||
"optional": false,
|
||||
"owner": "pioarduino",
|
||||
"version": "https://github.com/pioarduino/esp_install/releases/download/v5.0.0/esp_install-v5.0.0.zip"
|
||||
"version": "https://github.com/pioarduino/esp_install/releases/download/v5.1.0/esp_install-v5.1.0.zip"
|
||||
},
|
||||
"contrib-piohome": {
|
||||
"optional": true,
|
||||
"owner": "pioarduino",
|
||||
"package-version": "3.4.4",
|
||||
"version": "https://github.com/pioarduino/registry/releases/download/0.0.1/contrib-piohome-3.4.4.tar.gz"
|
||||
},
|
||||
"tool-dfuutil-arduino": {
|
||||
"type": "uploader",
|
||||
@@ -111,22 +118,22 @@
|
||||
"type": "debugger",
|
||||
"optional": true,
|
||||
"owner": "pioarduino",
|
||||
"package-version": "2.1200.20250422",
|
||||
"version": "https://github.com/pioarduino/registry/releases/download/0.0.1/openocd-v0.12.0-esp32-20250422.zip"
|
||||
"package-version": "2.1200.20250707",
|
||||
"version": "https://github.com/pioarduino/registry/releases/download/0.0.1/openocd-v0.12.0-esp32-20250707.zip"
|
||||
},
|
||||
"tool-mklittlefs": {
|
||||
"type": "uploader",
|
||||
"optional": true,
|
||||
"owner": "pioarduino",
|
||||
"package-version": "3.2.0",
|
||||
"version": "https://github.com/pioarduino/registry/releases/download/0.0.1/mklittlefs-3.2.0.zip"
|
||||
"version": "https://github.com/pioarduino/registry/releases/download/0.0.1/mklittlefs-3.2.0-new.zip"
|
||||
},
|
||||
"tool-mklittlefs-4.0.0": {
|
||||
"tool-mklittlefs4": {
|
||||
"type": "uploader",
|
||||
"optional": true,
|
||||
"owner": "pioarduino",
|
||||
"package-version": "4.0.0",
|
||||
"version": "https://github.com/pioarduino/registry/releases/download/0.0.1/mklittlefs-4.0.0.zip"
|
||||
"package-version": "4.0.2",
|
||||
"version": "https://github.com/pioarduino/registry/releases/download/0.0.1/mklittlefs-4.0.2.zip"
|
||||
},
|
||||
"tool-mkspiffs": {
|
||||
"type": "uploader",
|
||||
@@ -181,8 +188,8 @@
|
||||
"type": "tool",
|
||||
"optional": true,
|
||||
"owner": "pioarduino",
|
||||
"package-version": "1.10.2",
|
||||
"version": "https://github.com/pioarduino/registry/releases/download/0.0.1/ninja-1.10.2.zip"
|
||||
"package-version": "1.13.0",
|
||||
"version": "https://github.com/pioarduino/registry/releases/download/0.0.1/ninja-1.13.0.zip"
|
||||
},
|
||||
"tool-scons": {
|
||||
"type": "tool",
|
||||
|
||||
+25
-19
@@ -14,7 +14,6 @@
|
||||
|
||||
import fnmatch
|
||||
import os
|
||||
import contextlib
|
||||
import json
|
||||
import subprocess
|
||||
import sys
|
||||
@@ -30,8 +29,6 @@ from platformio.package.manager.tool import ToolPackageManager
|
||||
# Constants
|
||||
RETRY_LIMIT = 3
|
||||
SUBPROCESS_TIMEOUT = 300
|
||||
MKLITTLEFS_VERSION_320 = "3.2.0"
|
||||
MKLITTLEFS_VERSION_400 = "4.0.0"
|
||||
DEFAULT_DEBUG_SPEED = "5000"
|
||||
DEFAULT_APP_OFFSET = "0x10000"
|
||||
|
||||
@@ -330,13 +327,14 @@ class Espressif32Platform(PlatformBase):
|
||||
return self.install_tool(tool_name, retry_count + 1)
|
||||
|
||||
def _configure_arduino_framework(self, frameworks: List[str]) -> None:
|
||||
"""Configure Arduino framework with dynamic library URL fetching."""
|
||||
"""Configure Arduino framework"""
|
||||
if "arduino" not in frameworks:
|
||||
return
|
||||
|
||||
self.packages["framework-arduinoespressif32"]["optional"] = False
|
||||
self.packages["framework-arduinoespressif32-libs"]["optional"] = False
|
||||
|
||||
|
||||
def _configure_espidf_framework(
|
||||
self, frameworks: List[str], variables: Dict, board_config: Dict, mcu: str
|
||||
) -> None:
|
||||
@@ -409,6 +407,10 @@ class Espressif32Platform(PlatformBase):
|
||||
if os.path.exists(installer_path):
|
||||
self.packages["tl-install"]["optional"] = True
|
||||
|
||||
def _install_esptool_package(self) -> None:
|
||||
"""Install esptool package required for all builds."""
|
||||
self.install_tool("tool-esptoolpy")
|
||||
|
||||
def _install_common_idf_packages(self) -> None:
|
||||
"""Install common ESP-IDF packages required for all builds."""
|
||||
for package in COMMON_IDF_PACKAGES:
|
||||
@@ -417,6 +419,7 @@ class Espressif32Platform(PlatformBase):
|
||||
def _configure_check_tools(self, variables: Dict) -> None:
|
||||
"""Configure static analysis and check tools based on configuration."""
|
||||
check_tools = variables.get("check_tool", [])
|
||||
self.install_tool("contrib-piohome")
|
||||
if not check_tools:
|
||||
return
|
||||
|
||||
@@ -432,37 +435,38 @@ class Espressif32Platform(PlatformBase):
|
||||
try:
|
||||
with open(piopm_path, 'r', encoding='utf-8') as f:
|
||||
package_data = json.load(f)
|
||||
if package_data.get('version') != MKLITTLEFS_VERSION_320:
|
||||
version = package_data.get('version', '')
|
||||
if not version.startswith("3."):
|
||||
os.remove(piopm_path)
|
||||
logger.info("Outdated mklittlefs version removed")
|
||||
logger.info(f"Incompatible mklittlefs version {version} removed (required: 3.x)")
|
||||
except (json.JSONDecodeError, KeyError) as e:
|
||||
logger.error(f"Error reading mklittlefs package data: {e}")
|
||||
|
||||
def _setup_mklittlefs_for_download(self) -> None:
|
||||
"""Setup mklittlefs for download functionality with version 4.0.0."""
|
||||
"""Setup mklittlefs for download functionality with version 4.x."""
|
||||
mklittlefs_dir = os.path.join(self.packages_dir, "tool-mklittlefs")
|
||||
mklittlefs400_dir = os.path.join(
|
||||
self.packages_dir, "tool-mklittlefs-4.0.0"
|
||||
mklittlefs4_dir = os.path.join(
|
||||
self.packages_dir, "tool-mklittlefs4"
|
||||
)
|
||||
|
||||
# Ensure mklittlefs 3.2.0 is installed
|
||||
# Ensure mklittlefs 3.x is installed
|
||||
if not os.path.exists(mklittlefs_dir):
|
||||
self.install_tool("tool-mklittlefs")
|
||||
if os.path.exists(os.path.join(mklittlefs_dir, "tools.json")):
|
||||
self.install_tool("tool-mklittlefs")
|
||||
|
||||
# Install mklittlefs 4.0.0
|
||||
if not os.path.exists(mklittlefs400_dir):
|
||||
self.install_tool("tool-mklittlefs-4.0.0")
|
||||
if os.path.exists(os.path.join(mklittlefs400_dir, "tools.json")):
|
||||
self.install_tool("tool-mklittlefs-4.0.0")
|
||||
# Install mklittlefs 4.x
|
||||
if not os.path.exists(mklittlefs4_dir):
|
||||
self.install_tool("tool-mklittlefs4")
|
||||
if os.path.exists(os.path.join(mklittlefs4_dir, "tools.json")):
|
||||
self.install_tool("tool-mklittlefs4")
|
||||
|
||||
# Copy mklittlefs 4.0.0 over 3.2.0
|
||||
if os.path.exists(mklittlefs400_dir):
|
||||
# Copy mklittlefs 4.x over 3.x
|
||||
if os.path.exists(mklittlefs4_dir):
|
||||
package_src = os.path.join(mklittlefs_dir, "package.json")
|
||||
package_dst = os.path.join(mklittlefs400_dir, "package.json")
|
||||
package_dst = os.path.join(mklittlefs4_dir, "package.json")
|
||||
safe_copy_file(package_src, package_dst)
|
||||
shutil.copytree(mklittlefs400_dir, mklittlefs_dir, dirs_exist_ok=True)
|
||||
shutil.copytree(mklittlefs4_dir, mklittlefs_dir, dirs_exist_ok=True)
|
||||
self.packages.pop("tool-mkfatfs", None)
|
||||
|
||||
def _handle_littlefs_tool(self, for_download: bool) -> None:
|
||||
@@ -513,9 +517,11 @@ class Espressif32Platform(PlatformBase):
|
||||
try:
|
||||
# Configuration steps
|
||||
self._configure_installer()
|
||||
self._install_esptool_package()
|
||||
self._configure_arduino_framework(frameworks)
|
||||
self._configure_espidf_framework(frameworks, variables, board_config, mcu)
|
||||
self._configure_mcu_toolchains(mcu, variables, targets)
|
||||
self._handle_littlefs_tool(for_download=False) # Ensure mklittlefs is installed
|
||||
|
||||
if "espidf" in frameworks:
|
||||
self._install_common_idf_packages()
|
||||
|
||||
Reference in New Issue
Block a user