From cc32808a48a5572928ffb44b78c42bb0edf73028 Mon Sep 17 00:00:00 2001 From: me-no-dev Date: Mon, 9 Dec 2024 23:43:34 +0200 Subject: [PATCH 1/3] feat(chip): Add definition for BOOT_PIN for all chips For use in sketches as default button --- cores/esp32/esp32-hal.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/cores/esp32/esp32-hal.h b/cores/esp32/esp32-hal.h index d80bf2f15de..798174c8089 100644 --- a/cores/esp32/esp32-hal.h +++ b/cores/esp32/esp32-hal.h @@ -61,6 +61,20 @@ extern "C" { #define ARDUINO_EVENT_RUNNING_CORE CONFIG_ARDUINO_EVENT_RUNNING_CORE #endif +#if CONFIG_IDF_TARGET_ESP32 || CONFIG_IDF_TARGET_ESP32S2 || CONFIG_IDF_TARGET_ESP32S3 +const uint8_t BOOT_PIN = 0; +#define BOOT_PIN BOOT_PIN +#elif CONFIG_IDF_TARGET_ESP32C2 || CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32H2 || CONFIG_IDF_TARGET_ESP32C61 +const uint8_t BOOT_PIN = 9; +#define BOOT_PIN BOOT_PIN +#elif CONFIG_IDF_TARGET_ESP32P4 +const uint8_t BOOT_PIN = 35; +#define BOOT_PIN BOOT_PIN +#elif CONFIG_IDF_TARGET_ESP32C5 +const uint8_t BOOT_PIN = 28; +#define BOOT_PIN BOOT_PIN +#endif + //forward declaration from freertos/portmacro.h void vPortYield(void); void yield(void); From f163f37328277c28b42e8b7ac4eede0d6e0a1af2 Mon Sep 17 00:00:00 2001 From: me-no-dev Date: Mon, 9 Dec 2024 23:55:09 +0200 Subject: [PATCH 2/3] fix(core): Make BOOT_PIN static --- cores/esp32/esp32-hal.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/cores/esp32/esp32-hal.h b/cores/esp32/esp32-hal.h index 798174c8089..de7ba6ca48f 100644 --- a/cores/esp32/esp32-hal.h +++ b/cores/esp32/esp32-hal.h @@ -62,16 +62,16 @@ extern "C" { #endif #if CONFIG_IDF_TARGET_ESP32 || CONFIG_IDF_TARGET_ESP32S2 || CONFIG_IDF_TARGET_ESP32S3 -const uint8_t BOOT_PIN = 0; +static const uint8_t BOOT_PIN = 0; #define BOOT_PIN BOOT_PIN #elif CONFIG_IDF_TARGET_ESP32C2 || CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32H2 || CONFIG_IDF_TARGET_ESP32C61 -const uint8_t BOOT_PIN = 9; +static const uint8_t BOOT_PIN = 9; #define BOOT_PIN BOOT_PIN #elif CONFIG_IDF_TARGET_ESP32P4 -const uint8_t BOOT_PIN = 35; +static const uint8_t BOOT_PIN = 35; #define BOOT_PIN BOOT_PIN #elif CONFIG_IDF_TARGET_ESP32C5 -const uint8_t BOOT_PIN = 28; +static const uint8_t BOOT_PIN = 28; #define BOOT_PIN BOOT_PIN #endif From 8e336d8f496dfb786a243cbed49b11c47de5c182 Mon Sep 17 00:00:00 2001 From: me-no-dev Date: Tue, 10 Dec 2024 00:06:43 +0200 Subject: [PATCH 3/3] fix(hal): BOOT_PIN should always be defined --- cores/esp32/esp32-hal.h | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/cores/esp32/esp32-hal.h b/cores/esp32/esp32-hal.h index de7ba6ca48f..d0bd4b8bc93 100644 --- a/cores/esp32/esp32-hal.h +++ b/cores/esp32/esp32-hal.h @@ -63,17 +63,16 @@ extern "C" { #if CONFIG_IDF_TARGET_ESP32 || CONFIG_IDF_TARGET_ESP32S2 || CONFIG_IDF_TARGET_ESP32S3 static const uint8_t BOOT_PIN = 0; -#define BOOT_PIN BOOT_PIN #elif CONFIG_IDF_TARGET_ESP32C2 || CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32H2 || CONFIG_IDF_TARGET_ESP32C61 static const uint8_t BOOT_PIN = 9; -#define BOOT_PIN BOOT_PIN #elif CONFIG_IDF_TARGET_ESP32P4 static const uint8_t BOOT_PIN = 35; -#define BOOT_PIN BOOT_PIN #elif CONFIG_IDF_TARGET_ESP32C5 static const uint8_t BOOT_PIN = 28; -#define BOOT_PIN BOOT_PIN +#else +#error BOOT_PIN not defined for this chip! #endif +#define BOOT_PIN BOOT_PIN //forward declaration from freertos/portmacro.h void vPortYield(void);