Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ESP32 Arduino v3.1.0 Preparation #10202

Open
wants to merge 19 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 3 additions & 17 deletions .github/scripts/on-release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -219,12 +219,8 @@ find "$PKG_DIR" -name '*.git*' -type f -delete
##
RVTC_NAME="riscv32-esp-elf-gcc"
RVTC_NEW_NAME="esp-rv32"
X32TC_NAME="xtensa-esp32-elf-gcc"
X32TC_NAME="xtensa-esp-elf-gcc"
X32TC_NEW_NAME="esp-x32"
XS2TC_NAME="xtensa-esp32s2-elf-gcc"
XS2TC_NEW_NAME="esp-xs2"
XS3TC_NAME="xtensa-esp32s3-elf-gcc"
XS3TC_NEW_NAME="esp-xs3"

# Replace tools locations in platform.txt
echo "Generating platform.txt..."
Expand All @@ -233,9 +229,7 @@ sed "s/version=.*/version=$RELEASE_TAG/g" | \
sed 's/tools\.esp32-arduino-libs\.path\.windows=.*//g' | \
sed 's/{runtime\.platform\.path}.tools.esp32-arduino-libs/\{runtime.tools.esp32-arduino-libs.path\}/g' | \
sed 's/{runtime\.platform\.path}.tools.xtensa-esp-elf-gdb/\{runtime.tools.xtensa-esp-elf-gdb.path\}/g' | \
sed "s/{runtime\.platform\.path}.tools.xtensa-esp32-elf/\\{runtime.tools.$X32TC_NEW_NAME.path\\}/g" | \
sed "s/{runtime\.platform\.path}.tools.xtensa-esp32s2-elf/\\{runtime.tools.$XS2TC_NEW_NAME.path\\}/g" | \
sed "s/{runtime\.platform\.path}.tools.xtensa-esp32s3-elf/\\{runtime.tools.$XS3TC_NEW_NAME.path\\}/g" | \
sed "s/{runtime\.platform\.path}.tools.xtensa-esp-elf/\\{runtime.tools.$X32TC_NEW_NAME.path\\}/g" | \
sed 's/{runtime\.platform\.path}.tools.riscv32-esp-elf-gdb/\{runtime.tools.riscv32-esp-elf-gdb.path\}/g' | \
sed "s/{runtime\.platform\.path}.tools.riscv32-esp-elf/\\{runtime.tools.$RVTC_NEW_NAME.path\\}/g" | \
sed 's/{runtime\.platform\.path}.tools.esptool/\{runtime.tools.esptool_py.path\}/g' | \
Expand Down Expand Up @@ -293,15 +287,7 @@ rvtc_jq_arg="\
(.packages[0].platforms[0].toolsDependencies[] | select(.name==\"$X32TC_NAME\")).version = \"$RVTC_VERSION\" |\
(.packages[0].platforms[0].toolsDependencies[] | select(.name==\"$X32TC_NAME\")).name = \"$X32TC_NEW_NAME\" |\
(.packages[0].tools[] | select(.name==\"$X32TC_NAME\")).version = \"$RVTC_VERSION\" |\
(.packages[0].tools[] | select(.name==\"$X32TC_NAME\")).name = \"$X32TC_NEW_NAME\" |\
(.packages[0].platforms[0].toolsDependencies[] | select(.name==\"$XS2TC_NAME\")).version = \"$RVTC_VERSION\" |\
(.packages[0].platforms[0].toolsDependencies[] | select(.name==\"$XS2TC_NAME\")).name = \"$XS2TC_NEW_NAME\" |\
(.packages[0].tools[] | select(.name==\"$XS2TC_NAME\")).version = \"$RVTC_VERSION\" |\
(.packages[0].tools[] | select(.name==\"$XS2TC_NAME\")).name = \"$XS2TC_NEW_NAME\" |\
(.packages[0].platforms[0].toolsDependencies[] | select(.name==\"$XS3TC_NAME\")).version = \"$RVTC_VERSION\" |\
(.packages[0].platforms[0].toolsDependencies[] | select(.name==\"$XS3TC_NAME\")).name = \"$XS3TC_NEW_NAME\" |\
(.packages[0].tools[] | select(.name==\"$XS3TC_NAME\")).version = \"$RVTC_VERSION\" |\
(.packages[0].tools[] | select(.name==\"$XS3TC_NAME\")).name = \"$XS3TC_NEW_NAME\""
(.packages[0].tools[] | select(.name==\"$X32TC_NAME\")).name = \"$X32TC_NEW_NAME\""
cat "$PACKAGE_JSON_TEMPLATE" | jq "$rvtc_jq_arg" > "$OUTPUT_DIR/package-rvfix.json"
PACKAGE_JSON_TEMPLATE="$OUTPUT_DIR/package-rvfix.json"

Expand Down
43 changes: 22 additions & 21 deletions .github/workflows/push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -194,28 +194,29 @@ jobs:
- name: Build Sketches
run: bash ./.github/scripts/on-push.sh

# PlatformIO on Windows, Ubuntu and Mac
build-platformio:
name: PlatformIO on ${{ matrix.os }}
needs: gen-chunks
if: |
needs.gen-chunks.outputs.build_all == 'true' ||
needs.gen-chunks.outputs.build_static_sketches == 'true' ||
needs.gen-chunks.outputs.build_platformio == 'true'
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macOS-latest]
# # PlatformIO on Windows, Ubuntu and Mac
# build-platformio:
# name: PlatformIO on ${{ matrix.os }}
# needs: gen-chunks
# if: |
# needs.gen-chunks.outputs.build_all == 'true' ||
# needs.gen-chunks.outputs.build_static_sketches == 'true' ||
# needs.gen-chunks.outputs.build_platformio == 'true'
# runs-on: ${{ matrix.os }}
# strategy:
# fail-fast: false
# matrix:
# os: [ubuntu-latest, windows-latest, macOS-latest]

steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.x'
- name: Build Sketches
run: bash ./.github/scripts/on-push.sh 1 1 #equal and non-zero to trigger PIO
# steps:
# - uses: actions/checkout@v4
# - uses: actions/setup-python@v5
# with:
# python-version: '3.x'
# - name: Build Sketches
# run: bash ./.github/scripts/on-push.sh 1 1 #equal and non-zero to trigger PIO

# ESP-IDF component build
build-esp-idf-component:
name: Build with ESP-IDF ${{ matrix.idf_ver }} for ${{ matrix.idf_target }}
needs: gen-chunks
Expand All @@ -231,7 +232,7 @@ jobs:
# See https://hub.docker.com/r/espressif/idf/tags and
# https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-guides/tools/idf-docker-image.html
# for details.
idf_ver: ["release-v5.1"]
idf_ver: ["release-v5.3"]
idf_target: ["esp32", "esp32s2", "esp32s3", "esp32c2", "esp32c3", "esp32c6", "esp32h2"]
container: espressif/idf:${{ matrix.idf_ver }}
steps:
Expand Down
6 changes: 3 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
# export ARDUINO_SKIP_IDF_VERSION_CHECK=1
# idf.py build

set(min_supported_idf_version "5.1.0")
set(max_supported_idf_version "5.1.99")
set(min_supported_idf_version "5.3.0")
set(max_supported_idf_version "5.3.99")
set(idf_version "${IDF_VERSION_MAJOR}.${IDF_VERSION_MINOR}.${IDF_VERSION_PATCH}")

if ("${idf_version}" AND NOT "$ENV{ARDUINO_SKIP_IDF_VERSION_CHECK}")
Expand Down Expand Up @@ -293,7 +293,7 @@ endforeach()
set(includedirs variants/${CONFIG_ARDUINO_VARIANT}/ cores/esp32/ ${ARDUINO_LIBRARIES_INCLUDEDIRS})
set(srcs ${CORE_SRCS} ${ARDUINO_LIBRARIES_SRCS})
set(priv_includes cores/esp32/libb64)
set(requires spi_flash esp_partition mbedtls wpa_supplicant esp_adc esp_eth http_parser espressif__network_provisioning)
set(requires spi_flash esp_partition mbedtls wpa_supplicant esp_adc esp_eth http_parser esp_ringbuf esp_driver_gptimer esp_driver_usb_serial_jtag driver espressif__network_provisioning)
set(priv_requires fatfs nvs_flash app_update spiffs bootloader_support bt esp_hid usb esp_psram ${ARDUINO_LIBRARIES_REQUIRES})

if(NOT CONFIG_ARDUINO_SELECTIVE_COMPILATION OR CONFIG_ARDUINO_SELECTIVE_OpenThread)
Expand Down
84 changes: 84 additions & 0 deletions boards.txt
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,90 @@ esp32c2.menu.EraseFlash.all.upload.erase_cmd=-e

##############################################################

esp32p4.name=ESP32P4 Dev Module
esp32p4.hide=true

esp32p4.bootloader.tool=esptool_py
esp32p4.bootloader.tool.default=esptool_py

esp32p4.upload.tool=esptool_py
esp32p4.upload.tool.default=esptool_py
esp32p4.upload.tool.network=esp_ota

esp32p4.upload.maximum_size=1310720
esp32p4.upload.maximum_data_size=327680
esp32p4.upload.flags=
esp32p4.upload.extra_flags=
esp32p4.upload.use_1200bps_touch=false
esp32p4.upload.wait_for_upload_port=false

esp32p4.serial.disableDTR=false
esp32p4.serial.disableRTS=false

esp32p4.build.tarch=riscv32
esp32p4.build.target=esp
esp32p4.build.mcu=esp32p4
esp32p4.build.core=esp32
esp32p4.build.variant=esp32p4
esp32p4.build.board=ESP32P4_DEV
esp32p4.build.bootloader_addr=0x0

esp32p4.build.cdc_on_boot=0
esp32p4.build.f_cpu=400000000L
esp32p4.build.flash_size=4MB
esp32p4.build.flash_freq=80m
esp32p4.build.img_freq=80m
esp32p4.build.flash_mode=qio
esp32p4.build.boot=qio
esp32p4.build.partitions=default
esp32p4.build.defines=

## IDE 2.0 Seems to not update the value
esp32p4.menu.JTAGAdapter.default=Disabled
esp32p4.menu.JTAGAdapter.default.build.copy_jtag_files=0

esp32p4.menu.CDCOnBoot.default=Disabled
esp32p4.menu.CDCOnBoot.default.build.cdc_on_boot=0
esp32p4.menu.CDCOnBoot.cdc=Enabled
esp32p4.menu.CDCOnBoot.cdc.build.cdc_on_boot=1

esp32p4.menu.PartitionScheme.default=Default 4MB with spiffs (1.2MB APP/1.5MB SPIFFS)
esp32p4.menu.PartitionScheme.default.build.partitions=default
esp32p4.menu.PartitionScheme.no_fs=No FS 4MB (2MB APP x2)
esp32p4.menu.PartitionScheme.no_fs.build.partitions=no_fs
esp32p4.menu.PartitionScheme.no_fs.upload.maximum_size=2031616
esp32p4.menu.PartitionScheme.huge_app=Huge APP (3MB No OTA/1MB SPIFFS)
esp32p4.menu.PartitionScheme.huge_app.build.partitions=huge_app
esp32p4.menu.PartitionScheme.huge_app.upload.maximum_size=3145728
esp32p4.menu.PartitionScheme.custom=Custom
esp32p4.menu.PartitionScheme.custom.build.partitions=
esp32p4.menu.PartitionScheme.custom.upload.maximum_size=16777216

esp32p4.menu.UploadSpeed.921600=921600
esp32p4.menu.UploadSpeed.921600.upload.speed=921600
esp32p4.menu.UploadSpeed.115200=115200
esp32p4.menu.UploadSpeed.115200.upload.speed=115200

esp32p4.menu.DebugLevel.none=None
esp32p4.menu.DebugLevel.none.build.code_debug=0
esp32p4.menu.DebugLevel.error=Error
esp32p4.menu.DebugLevel.error.build.code_debug=1
esp32p4.menu.DebugLevel.warn=Warn
esp32p4.menu.DebugLevel.warn.build.code_debug=2
esp32p4.menu.DebugLevel.info=Info
esp32p4.menu.DebugLevel.info.build.code_debug=3
esp32p4.menu.DebugLevel.debug=Debug
esp32p4.menu.DebugLevel.debug.build.code_debug=4
esp32p4.menu.DebugLevel.verbose=Verbose
esp32p4.menu.DebugLevel.verbose.build.code_debug=5

esp32p4.menu.EraseFlash.none=Disabled
esp32p4.menu.EraseFlash.none.upload.erase_cmd=
esp32p4.menu.EraseFlash.all=Enabled
esp32p4.menu.EraseFlash.all.upload.erase_cmd=-e

##############################################################

esp32h2.name=ESP32H2 Dev Module

esp32h2.bootloader.tool=esptool_py
Expand Down
2 changes: 2 additions & 0 deletions cores/esp32/Client.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@
class Client : public Stream {
public:
virtual int connect(IPAddress ip, uint16_t port) = 0;
virtual int connect(IPAddress ip, uint16_t port, int32_t timeout) = 0;
virtual int connect(const char *host, uint16_t port) = 0;
virtual int connect(const char *host, uint16_t port, int32_t timeout) = 0;
virtual size_t write(uint8_t) = 0;
virtual size_t write(const uint8_t *buf, size_t size) = 0;
virtual int available() = 0;
Expand Down
16 changes: 8 additions & 8 deletions cores/esp32/HWCDC.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -286,14 +286,14 @@ bool HWCDC::deinit(void *busptr) {
running = true;
// Setting USB D+ D- pins
bool retCode = true;
retCode &= perimanClearPinBus(USB_DM_GPIO_NUM);
retCode &= perimanClearPinBus(USB_DP_GPIO_NUM);
retCode &= perimanClearPinBus(USB_INT_PHY0_DM_GPIO_NUM);
retCode &= perimanClearPinBus(USB_INT_PHY0_DP_GPIO_NUM);
if (retCode) {
// Force the host to re-enumerate (BUS_RESET)
pinMode(USB_DM_GPIO_NUM, OUTPUT_OPEN_DRAIN);
pinMode(USB_DP_GPIO_NUM, OUTPUT_OPEN_DRAIN);
digitalWrite(USB_DM_GPIO_NUM, LOW);
digitalWrite(USB_DP_GPIO_NUM, LOW);
pinMode(USB_INT_PHY0_DM_GPIO_NUM, OUTPUT_OPEN_DRAIN);
pinMode(USB_INT_PHY0_DP_GPIO_NUM, OUTPUT_OPEN_DRAIN);
digitalWrite(USB_INT_PHY0_DM_GPIO_NUM, LOW);
digitalWrite(USB_INT_PHY0_DP_GPIO_NUM, LOW);
}
// release the flag
running = false;
Expand Down Expand Up @@ -323,11 +323,11 @@ void HWCDC::begin(unsigned long baud) {
// delay(10); // USB Host has to enumerate it again

// Peripheral Manager setting for USB D+ D- pins
uint8_t pin = USB_DM_GPIO_NUM;
uint8_t pin = USB_INT_PHY0_DM_GPIO_NUM;
if (!perimanSetPinBus(pin, ESP32_BUS_TYPE_USB_DM, (void *)this, -1, -1)) {
goto err;
}
pin = USB_DP_GPIO_NUM;
pin = USB_INT_PHY0_DP_GPIO_NUM;
if (!perimanSetPinBus(pin, ESP32_BUS_TYPE_USB_DP, (void *)this, -1, -1)) {
goto err;
}
Expand Down
24 changes: 12 additions & 12 deletions cores/esp32/HardwareSerial.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,23 +26,23 @@
void serialEvent(void) __attribute__((weak));
void serialEvent(void) {}

#if SOC_UART_NUM > 1
#if SOC_UART_HP_NUM > 1
void serialEvent1(void) __attribute__((weak));
void serialEvent1(void) {}
#endif /* SOC_UART_NUM > 1 */
#endif /* SOC_UART_HP_NUM > 1 */

#if SOC_UART_NUM > 2
#if SOC_UART_HP_NUM > 2
void serialEvent2(void) __attribute__((weak));
void serialEvent2(void) {}
#endif /* SOC_UART_NUM > 2 */
#endif /* SOC_UART_HP_NUM > 2 */

#if !defined(NO_GLOBAL_INSTANCES) && !defined(NO_GLOBAL_SERIAL)
// There is always Seria0 for UART0
HardwareSerial Serial0(0);
#if SOC_UART_NUM > 1
#if SOC_UART_HP_NUM > 1
HardwareSerial Serial1(1);
#endif
#if SOC_UART_NUM > 2
#if SOC_UART_HP_NUM > 2
HardwareSerial Serial2(2);
#endif

Expand Down Expand Up @@ -72,12 +72,12 @@ void serialEventRun(void) {
if (Serial0.available()) {
serialEvent();
}
#if SOC_UART_NUM > 1
#if SOC_UART_HP_NUM > 1
if (Serial1.available()) {
serialEvent1();
}
#endif
#if SOC_UART_NUM > 2
#if SOC_UART_HP_NUM > 2
if (Serial2.available()) {
serialEvent2();
}
Expand Down Expand Up @@ -279,8 +279,8 @@ void HardwareSerial::_uartEventTask(void *args) {
}

void HardwareSerial::begin(unsigned long baud, uint32_t config, int8_t rxPin, int8_t txPin, bool invert, unsigned long timeout_ms, uint8_t rxfifo_full_thrhd) {
if (_uart_nr >= SOC_UART_NUM) {
log_e("Serial number is invalid, please use a number from 0 to %u", SOC_UART_NUM - 1);
if (_uart_nr >= SOC_UART_HP_NUM) {
log_e("Serial number is invalid, please use a number from 0 to %u", SOC_UART_HP_NUM - 1);
return;
}

Expand All @@ -305,7 +305,7 @@ void HardwareSerial::begin(unsigned long baud, uint32_t config, int8_t rxPin, in
txPin = _txPin < 0 ? (int8_t)SOC_TX0 : _txPin;
}
break;
#if SOC_UART_NUM > 1 // may save some flash bytes...
#if SOC_UART_HP_NUM > 1 // may save some flash bytes...
case UART_NUM_1:
if (rxPin < 0 && txPin < 0) {
// do not change RX1/TX1 if it has already been set before
Expand All @@ -314,7 +314,7 @@ void HardwareSerial::begin(unsigned long baud, uint32_t config, int8_t rxPin, in
}
break;
#endif
#if SOC_UART_NUM > 2 // may save some flash bytes...
#if SOC_UART_HP_NUM > 2 // may save some flash bytes...
case UART_NUM_2:
if (rxPin < 0 && txPin < 0) {
// do not change RX2/TX2 if it has already been set before
Expand Down
12 changes: 6 additions & 6 deletions cores/esp32/HardwareSerial.h
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ typedef enum {

// Default pins for UART1 are arbitrary, and defined here for convenience.

#if SOC_UART_NUM > 1
#if SOC_UART_HP_NUM > 1
#ifndef RX1
#if CONFIG_IDF_TARGET_ESP32
#define RX1 (gpio_num_t)26
Expand Down Expand Up @@ -182,11 +182,11 @@ typedef enum {
#define TX1 (gpio_num_t)1
#endif
#endif
#endif /* SOC_UART_NUM > 1 */
#endif /* SOC_UART_HP_NUM > 1 */

// Default pins for UART2 are arbitrary, and defined here for convenience.

#if SOC_UART_NUM > 2
#if SOC_UART_HP_NUM > 2
#ifndef RX2
#if CONFIG_IDF_TARGET_ESP32
#define RX2 (gpio_num_t)4
Expand All @@ -202,7 +202,7 @@ typedef enum {
#define TX2 (gpio_num_t)20
#endif
#endif
#endif /* SOC_UART_NUM > 2 */
#endif /* SOC_UART_HP_NUM > 2 */

typedef std::function<void(void)> OnReceiveCb;
typedef std::function<void(hardwareSerial_error_t)> OnReceiveErrorCb;
Expand Down Expand Up @@ -357,10 +357,10 @@ extern void serialEventRun(void) __attribute__((weak));
#endif // ARDUINO_USB_CDC_ON_BOOT
// There is always Seria0 for UART0
extern HardwareSerial Serial0;
#if SOC_UART_NUM > 1
#if SOC_UART_HP_NUM > 1
extern HardwareSerial Serial1;
#endif
#if SOC_UART_NUM > 2
#if SOC_UART_HP_NUM > 2
extern HardwareSerial Serial2;
#endif
#endif //!defined(NO_GLOBAL_INSTANCES) && !defined(NO_GLOBAL_SERIAL)
Expand Down
Loading
Loading