feat(soc): Add soc_caps macros for sleep support

- modify console example to use the new SOC_LIGHT_SLEEP_SUPPORTED
and SOC_DEEP_SLEEP_SUPPORTED macros when registering sleep commands

- remove exclusion of esp32p4 in basic and advanced example in
.build-test-rules.yml

- replace exclusion of esp32p4 for deep and light sleep tests with newly introduced macro

- remove the temporary disable check for esp32p4 and uses the
SOC_LIGHT_SLEEP_SUPPORTED maccro instead.
This commit is contained in:
Guillaume Souchere
2024-02-01 11:28:28 +01:00
parent 5f85aefe0d
commit 0b9f01ac20
26 changed files with 119 additions and 43 deletions

View File

@@ -12,8 +12,9 @@
#include "unity.h" #include "unity.h"
#include "esp_rom_sys.h" #include "esp_rom_sys.h"
#include "esp_sleep.h" #include "esp_sleep.h"
#include "soc/soc_caps.h"
#if !TEMPORARY_DISABLED_FOR_TARGETS(ESP32P4) // TODO Light Sleep support - IDF-7528 #if SOC_LIGHT_SLEEP_SUPPORTED
static void timer_cb1(void *arg) static void timer_cb1(void *arg)
{ {
@@ -53,4 +54,4 @@ TEST_CASE("Test the periodic timer does not handle lost events during light slee
TEST_ESP_OK(esp_timer_delete(periodic_timer)); TEST_ESP_OK(esp_timer_delete(periodic_timer));
} }
#endif //#!TEMPORARY_DISABLED_FOR_TARGETS(ESP32P4) #endif // SOC_SLEEP_SUPPORTED

View File

@@ -171,6 +171,14 @@ config SOC_RNG_SUPPORTED
bool bool
default y default y
config SOC_LIGHT_SLEEP_SUPPORTED
bool
default y
config SOC_DEEP_SLEEP_SUPPORTED
bool
default y
config SOC_DPORT_WORKAROUND_DIS_INTERRUPT_LVL config SOC_DPORT_WORKAROUND_DIS_INTERRUPT_LVL
int int
default 5 default 5

View File

@@ -100,6 +100,8 @@
#define SOC_WDT_SUPPORTED 1 #define SOC_WDT_SUPPORTED 1
#define SOC_SPI_FLASH_SUPPORTED 1 #define SOC_SPI_FLASH_SUPPORTED 1
#define SOC_RNG_SUPPORTED 1 #define SOC_RNG_SUPPORTED 1
#define SOC_LIGHT_SLEEP_SUPPORTED 1
#define SOC_DEEP_SLEEP_SUPPORTED 1
#if SOC_CAPS_ECO_VER < 200 #if SOC_CAPS_ECO_VER < 200
#define SOC_DPORT_WORKAROUND 1 #define SOC_DPORT_WORKAROUND 1

View File

@@ -115,6 +115,14 @@ config SOC_RNG_SUPPORTED
bool bool
default y default y
config SOC_LIGHT_SLEEP_SUPPORTED
bool
default y
config SOC_DEEP_SLEEP_SUPPORTED
bool
default y
config SOC_XTAL_SUPPORT_26M config SOC_XTAL_SUPPORT_26M
bool bool
default y default y

View File

@@ -45,6 +45,8 @@
#define SOC_WDT_SUPPORTED 1 #define SOC_WDT_SUPPORTED 1
#define SOC_SPI_FLASH_SUPPORTED 1 #define SOC_SPI_FLASH_SUPPORTED 1
#define SOC_RNG_SUPPORTED 1 #define SOC_RNG_SUPPORTED 1
#define SOC_LIGHT_SLEEP_SUPPORTED 1
#define SOC_DEEP_SLEEP_SUPPORTED 1
/*-------------------------- XTAL CAPS ---------------------------------------*/ /*-------------------------- XTAL CAPS ---------------------------------------*/
#define SOC_XTAL_SUPPORT_26M 1 #define SOC_XTAL_SUPPORT_26M 1

View File

@@ -167,6 +167,14 @@ config SOC_RNG_SUPPORTED
bool bool
default y default y
config SOC_LIGHT_SLEEP_SUPPORTED
bool
default y
config SOC_DEEP_SLEEP_SUPPORTED
bool
default y
config SOC_XTAL_SUPPORT_40M config SOC_XTAL_SUPPORT_40M
bool bool
default y default y

View File

@@ -61,6 +61,8 @@
#define SOC_WDT_SUPPORTED 1 #define SOC_WDT_SUPPORTED 1
#define SOC_SPI_FLASH_SUPPORTED 1 #define SOC_SPI_FLASH_SUPPORTED 1
#define SOC_RNG_SUPPORTED 1 #define SOC_RNG_SUPPORTED 1
#define SOC_LIGHT_SLEEP_SUPPORTED 1
#define SOC_DEEP_SLEEP_SUPPORTED 1
/*-------------------------- XTAL CAPS ---------------------------------------*/ /*-------------------------- XTAL CAPS ---------------------------------------*/
#define SOC_XTAL_SUPPORT_40M 1 #define SOC_XTAL_SUPPORT_40M 1

View File

@@ -72,6 +72,8 @@
// #define SOC_ECDSA_SUPPORTED 1 // TODO: [ESP32C5] IDF-8618 // #define SOC_ECDSA_SUPPORTED 1 // TODO: [ESP32C5] IDF-8618
// #define SOC_KEY_MANAGER_SUPPORTED 1 // TODO: [ESP32C5] IDF-8621 // #define SOC_KEY_MANAGER_SUPPORTED 1 // TODO: [ESP32C5] IDF-8621
// #define SOC_HUK_SUPPORTED 1 // TODO: [ESP32C5] IDF-8617 // #define SOC_HUK_SUPPORTED 1 // TODO: [ESP32C5] IDF-8617
// #define SOC_LIGHT_SLEEP_SUPPORTED 1 // TODO: [ESP32C5] IDF-8640
// #define SOC_DEEP_SLEEP_SUPPORTED 1 // TODO: [ESP32C5] IDF-8638
/*-------------------------- XTAL CAPS ---------------------------------------*/ /*-------------------------- XTAL CAPS ---------------------------------------*/
#define SOC_XTAL_SUPPORT_40M 1 #define SOC_XTAL_SUPPORT_40M 1

View File

@@ -223,6 +223,14 @@ config SOC_RNG_SUPPORTED
bool bool
default y default y
config SOC_LIGHT_SLEEP_SUPPORTED
bool
default y
config SOC_DEEP_SLEEP_SUPPORTED
bool
default y
config SOC_XTAL_SUPPORT_40M config SOC_XTAL_SUPPORT_40M
bool bool
default y default y

View File

@@ -72,6 +72,8 @@
#define SOC_WDT_SUPPORTED 1 #define SOC_WDT_SUPPORTED 1
#define SOC_SPI_FLASH_SUPPORTED 1 #define SOC_SPI_FLASH_SUPPORTED 1
#define SOC_RNG_SUPPORTED 1 #define SOC_RNG_SUPPORTED 1
#define SOC_LIGHT_SLEEP_SUPPORTED 1
#define SOC_DEEP_SLEEP_SUPPORTED 1
/*-------------------------- XTAL CAPS ---------------------------------------*/ /*-------------------------- XTAL CAPS ---------------------------------------*/
#define SOC_XTAL_SUPPORT_40M 1 #define SOC_XTAL_SUPPORT_40M 1

View File

@@ -211,6 +211,14 @@ config SOC_RNG_SUPPORTED
bool bool
default y default y
config SOC_LIGHT_SLEEP_SUPPORTED
bool
default y
config SOC_DEEP_SLEEP_SUPPORTED
bool
default y
config SOC_XTAL_SUPPORT_32M config SOC_XTAL_SUPPORT_32M
bool bool
default y default y

View File

@@ -69,6 +69,8 @@
#define SOC_WDT_SUPPORTED 1 #define SOC_WDT_SUPPORTED 1
#define SOC_SPI_FLASH_SUPPORTED 1 #define SOC_SPI_FLASH_SUPPORTED 1
#define SOC_RNG_SUPPORTED 1 #define SOC_RNG_SUPPORTED 1
#define SOC_LIGHT_SLEEP_SUPPORTED 1
#define SOC_DEEP_SLEEP_SUPPORTED 1
/*-------------------------- XTAL CAPS ---------------------------------------*/ /*-------------------------- XTAL CAPS ---------------------------------------*/
#define SOC_XTAL_SUPPORT_32M 1 #define SOC_XTAL_SUPPORT_32M 1

View File

@@ -86,6 +86,8 @@
// #define SOC_RNG_SUPPORTED 1 //TODO: IDF-6522 // #define SOC_RNG_SUPPORTED 1 //TODO: IDF-6522
#define SOC_MULTI_USAGE_LDO_SUPPORTED 1 #define SOC_MULTI_USAGE_LDO_SUPPORTED 1
// #define SOC_PPA_SUPPORTED 1 //TODO: IDF-6878 // #define SOC_PPA_SUPPORTED 1 //TODO: IDF-6878
// #define SOC_LIGHT_SLEEP_SUPPORTED 1 //TODO: IDF-7528
// #define SOC_DEEP_SLEEP_SUPPORTED 1 //TODO: IDF-7529
/*-------------------------- XTAL CAPS ---------------------------------------*/ /*-------------------------- XTAL CAPS ---------------------------------------*/
#define SOC_XTAL_SUPPORT_40M 1 #define SOC_XTAL_SUPPORT_40M 1

View File

@@ -195,6 +195,14 @@ config SOC_RNG_SUPPORTED
bool bool
default y default y
config SOC_LIGHT_SLEEP_SUPPORTED
bool
default y
config SOC_DEEP_SLEEP_SUPPORTED
bool
default y
config SOC_XTAL_SUPPORT_40M config SOC_XTAL_SUPPORT_40M
bool bool
default y default y

View File

@@ -85,6 +85,8 @@
#define SOC_WDT_SUPPORTED 1 #define SOC_WDT_SUPPORTED 1
#define SOC_SPI_FLASH_SUPPORTED 1 #define SOC_SPI_FLASH_SUPPORTED 1
#define SOC_RNG_SUPPORTED 1 #define SOC_RNG_SUPPORTED 1
#define SOC_LIGHT_SLEEP_SUPPORTED 1
#define SOC_DEEP_SLEEP_SUPPORTED 1
/*-------------------------- XTAL CAPS ---------------------------------------*/ /*-------------------------- XTAL CAPS ---------------------------------------*/
#define SOC_XTAL_SUPPORT_40M 1 #define SOC_XTAL_SUPPORT_40M 1

View File

@@ -235,6 +235,14 @@ config SOC_RNG_SUPPORTED
bool bool
default y default y
config SOC_LIGHT_SLEEP_SUPPORTED
bool
default y
config SOC_DEEP_SLEEP_SUPPORTED
bool
default y
config SOC_XTAL_SUPPORT_40M config SOC_XTAL_SUPPORT_40M
bool bool
default y default y

View File

@@ -75,6 +75,8 @@
#define SOC_WDT_SUPPORTED 1 #define SOC_WDT_SUPPORTED 1
#define SOC_SPI_FLASH_SUPPORTED 1 #define SOC_SPI_FLASH_SUPPORTED 1
#define SOC_RNG_SUPPORTED 1 #define SOC_RNG_SUPPORTED 1
#define SOC_LIGHT_SLEEP_SUPPORTED 1
#define SOC_DEEP_SLEEP_SUPPORTED 1
/*-------------------------- XTAL CAPS ---------------------------------------*/ /*-------------------------- XTAL CAPS ---------------------------------------*/
#define SOC_XTAL_SUPPORT_40M 1 #define SOC_XTAL_SUPPORT_40M 1

View File

@@ -11,10 +11,6 @@ examples/system/base_mac_address:
- esp_hw_support - esp_hw_support
examples/system/console/advanced: examples/system/console/advanced:
disable:
- if: IDF_TARGET == "esp32p4"
temporary: true
reason: not supported on p4 # TODO: IDF-8078
disable_test: disable_test:
- if: IDF_TARGET not in ["esp32", "esp32c3"] - if: IDF_TARGET not in ["esp32", "esp32c3"]
reason: Sufficient to run this app on one chip with each architecture reason: Sufficient to run this app on one chip with each architecture
@@ -30,10 +26,6 @@ examples/system/console/advanced_usb_cdc:
- vfs - vfs
examples/system/console/basic: examples/system/console/basic:
disable:
- if: IDF_TARGET == "esp32p4"
temporary: true
reason: not supported on p4 # TODO: IDF-8078
disable_test: disable_test:
- if: IDF_TARGET not in ["esp32", "esp32c3"] - if: IDF_TARGET not in ["esp32", "esp32c3"]
reason: Sufficient to run this app on one chip with each architecture reason: Sufficient to run this app on one chip with each architecture
@@ -43,9 +35,7 @@ examples/system/console/basic:
examples/system/deep_sleep: examples/system/deep_sleep:
disable: disable:
- if: IDF_TARGET in ["esp32p4"] - if: SOC_DEEP_SLEEP_SUPPORTED != 1
temporary: true
reason: target(s) is not supported yet # TODO: IDF-7529
examples/system/deep_sleep_wake_stub: examples/system/deep_sleep_wake_stub:
disable: disable:
@@ -63,9 +53,7 @@ examples/system/efuse:
examples/system/esp_timer: examples/system/esp_timer:
disable: disable:
- if: IDF_TARGET in ["esp32p4"] - if: SOC_LIGHT_SLEEP_SUPPORTED != 1
temporary: true
reason: Light Sleep support TBD # TODO: IDF-7528
depends_components: depends_components:
- esp_timer - esp_timer
@@ -134,9 +122,7 @@ examples/system/ipc/ipc_isr/xtensa:
examples/system/light_sleep: examples/system/light_sleep:
disable: disable:
- if: IDF_TARGET in ["esp32p4"] - if: SOC_LIGHT_SLEEP_SUPPORTED != 1
temporary: true
reason: target(s) is not supported yet
examples/system/ota/advanced_https_ota: examples/system/ota/advanced_https_ota:
disable: disable:

View File

@@ -1,5 +1,5 @@
| Supported Targets | ESP32 | ESP32-C2 | ESP32-C3 | ESP32-C6 | ESP32-H2 | ESP32-S2 | ESP32-S3 | | Supported Targets | ESP32 | ESP32-C2 | ESP32-C3 | ESP32-C6 | ESP32-H2 | ESP32-P4 | ESP32-S2 | ESP32-S3 |
| ----------------- | ----- | -------- | -------- | -------- | -------- | -------- | -------- | | ----------------- | ----- | -------- | -------- | -------- | -------- | -------- | -------- | -------- |
# Console Example # Console Example

View File

@@ -14,5 +14,12 @@
void register_system(void) void register_system(void)
{ {
register_system_common(); register_system_common();
register_system_sleep();
#if SOC_LIGHT_SLEEP_SUPPORTED
register_system_light_sleep();
#endif
#if SOC_DEEP_SLEEP_SUPPORTED
register_system_deep_sleep();
#endif
} }

View File

@@ -19,7 +19,8 @@ void register_system(void);
void register_system_common(void); void register_system_common(void);
// Register deep and light sleep functions // Register deep and light sleep functions
void register_system_sleep(void); void register_system_deep_sleep(void);
void register_system_light_sleep(void);
#ifdef __cplusplus #ifdef __cplusplus
} }

View File

@@ -1,5 +1,5 @@
/* /*
* SPDX-FileCopyrightText: 2023 Espressif Systems (Shanghai) CO LTD * SPDX-FileCopyrightText: 2023-2024 Espressif Systems (Shanghai) CO LTD
* *
* SPDX-License-Identifier: Unlicense OR CC0-1.0 * SPDX-License-Identifier: Unlicense OR CC0-1.0
*/ */
@@ -29,16 +29,6 @@
static const char *TAG = "cmd_system_sleep"; static const char *TAG = "cmd_system_sleep";
static void register_deep_sleep(void);
static void register_light_sleep(void);
void register_system_sleep(void)
{
register_deep_sleep();
register_light_sleep();
}
/** 'deep_sleep' command puts the chip into deep sleep mode */ /** 'deep_sleep' command puts the chip into deep sleep mode */
static struct { static struct {
@@ -95,7 +85,7 @@ static int deep_sleep(int argc, char **argv)
return 1; return 1;
} }
static void register_deep_sleep(void) void register_system_deep_sleep(void)
{ {
int num_args = 1; int num_args = 1;
deep_sleep_args.wakeup_time = deep_sleep_args.wakeup_time =
@@ -196,7 +186,7 @@ static int light_sleep(int argc, char **argv)
return 0; return 0;
} }
static void register_light_sleep(void) void register_system_light_sleep(void)
{ {
light_sleep_args.wakeup_time = light_sleep_args.wakeup_time =
arg_int0("t", "time", "<t>", "Wake up time, ms"); arg_int0("t", "time", "<t>", "Wake up time, ms");

View File

@@ -168,7 +168,12 @@ void app_main(void)
/* Register commands */ /* Register commands */
esp_console_register_help_command(); esp_console_register_help_command();
register_system_common(); register_system_common();
register_system_sleep(); #if SOC_LIGHT_SLEEP_SUPPORTED
register_system_light_sleep();
#endif
#if SOC_DEEP_SLEEP_SUPPORTED
register_system_deep_sleep();
#endif
#if SOC_WIFI_SUPPORTED #if SOC_WIFI_SUPPORTED
register_wifi(); register_wifi();
#endif #endif

View File

@@ -1,5 +1,5 @@
/* /*
* SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD * SPDX-FileCopyrightText: 2022-2024 Espressif Systems (Shanghai) CO LTD
* *
* SPDX-License-Identifier: Unlicense OR CC0-1.0 * SPDX-License-Identifier: Unlicense OR CC0-1.0
*/ */
@@ -95,9 +95,16 @@ void app_main(void)
/* Register commands */ /* Register commands */
esp_console_register_help_command(); esp_console_register_help_command();
register_system_common(); register_system_common();
register_system_sleep(); #if SOC_LIGHT_SLEEP_SUPPORTED
register_nvs(); register_system_light_sleep();
#endif
#if SOC_DEEP_SLEEP_SUPPORTED
register_system_deep_sleep();
#endif
#if SOC_WIFI_SUPPORTED
register_wifi(); register_wifi();
#endif
register_nvs();
/* Prompt to be printed before each line. /* Prompt to be printed before each line.
* This can be customized, made dynamic, etc. * This can be customized, made dynamic, etc.

View File

@@ -1,5 +1,5 @@
| Supported Targets | ESP32 | ESP32-C2 | ESP32-C3 | ESP32-C6 | ESP32-H2 | ESP32-S2 | ESP32-S3 | | Supported Targets | ESP32 | ESP32-C2 | ESP32-C3 | ESP32-C6 | ESP32-H2 | ESP32-P4 | ESP32-S2 | ESP32-S3 |
| ----------------- | ----- | -------- | -------- | -------- | -------- | -------- | -------- | | ----------------- | ----- | -------- | -------- | -------- | -------- | -------- | -------- | -------- |
# Basic Console Example (`esp_console_repl`) # Basic Console Example (`esp_console_repl`)

View File

@@ -91,7 +91,12 @@ void app_main(void)
/* Register commands */ /* Register commands */
esp_console_register_help_command(); esp_console_register_help_command();
register_system_common(); register_system_common();
register_system_sleep(); #if SOC_LIGHT_SLEEP_SUPPORTED
register_system_light_sleep();
#endif
#if SOC_DEEP_SLEEP_SUPPORTED
register_system_deep_sleep();
#endif
#if SOC_WIFI_SUPPORTED #if SOC_WIFI_SUPPORTED
register_wifi(); register_wifi();
#endif #endif