mirror of
https://github.com/espressif/esp-idf.git
synced 2025-10-04 12:29:40 +00:00
feat(ulp): added lp-core exception as wake-up source
This commit is contained in:
@@ -100,3 +100,5 @@ endif()
|
||||
|
||||
ulp_embed_binary(lp_core_test_app_prefix1 "lp_core/test_main_prefix1.c" "${lp_core_exp_dep_srcs}" PREFIX "ulp1_")
|
||||
ulp_embed_binary(lp_core_test_app_prefix2 "lp_core/test_main_prefix2.c" "${lp_core_exp_dep_srcs}" PREFIX "ulp2_")
|
||||
|
||||
ulp_embed_binary(lp_core_test_app_exception "lp_core/test_main_exception.c" "${lp_core_exp_dep_srcs}")
|
||||
|
@@ -0,0 +1,10 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2025 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
int main(void)
|
||||
{
|
||||
asm volatile("unimp");
|
||||
}
|
@@ -46,6 +46,9 @@ extern const uint8_t lp_core_main_gpio_bin_end[] asm("_binary_lp_core_test_app
|
||||
extern const uint8_t lp_core_main_isr_bin_start[] asm("_binary_lp_core_test_app_isr_bin_start");
|
||||
extern const uint8_t lp_core_main_isr_bin_end[] asm("_binary_lp_core_test_app_isr_bin_end");
|
||||
|
||||
extern const uint8_t lp_core_main_exception_bin_start[] asm("_binary_lp_core_test_app_exception_bin_start");
|
||||
extern const uint8_t lp_core_main_exception_bin_end[] asm("_binary_lp_core_test_app_exception_bin_end");
|
||||
|
||||
static void load_and_start_lp_core_firmware(ulp_lp_core_cfg_t* cfg, const uint8_t* firmware_start, const uint8_t* firmware_end)
|
||||
{
|
||||
TEST_ASSERT(ulp_lp_core_load_binary(firmware_start,
|
||||
@@ -383,3 +386,32 @@ TEST_CASE("LP core ISR tests", "[ulp]")
|
||||
TEST_ASSERT_EQUAL(ISR_TEST_ITERATIONS, ulp_io_isr_counter);
|
||||
#endif //SOC_RTCIO_PIN_COUNT > 0
|
||||
}
|
||||
|
||||
#if SOC_DEEP_SLEEP_SUPPORTED
|
||||
|
||||
void lp_core_prep_exception_wakeup(void)
|
||||
{
|
||||
/* Load ULP firmware and start the coprocessor */
|
||||
ulp_lp_core_cfg_t cfg = {
|
||||
.wakeup_source = ULP_LP_CORE_WAKEUP_SOURCE_HP_CPU,
|
||||
};
|
||||
|
||||
load_and_start_lp_core_firmware(&cfg, lp_core_main_exception_bin_start, lp_core_main_exception_bin_end);
|
||||
|
||||
TEST_ASSERT(esp_sleep_enable_ulp_wakeup() == ESP_OK);
|
||||
/* Setup test data */
|
||||
|
||||
/* Enter Deep Sleep */
|
||||
esp_deep_sleep_start();
|
||||
}
|
||||
|
||||
static void check_reset_reason_ulp_trap_wakeup(void)
|
||||
{
|
||||
printf("Wakeup cause: 0x%"PRIx32"\n", esp_sleep_get_wakeup_causes());
|
||||
TEST_ASSERT(esp_sleep_get_wakeup_causes() & BIT(ESP_SLEEP_WAKEUP_COCPU_TRAP_TRIG));
|
||||
}
|
||||
|
||||
TEST_CASE_MULTIPLE_STAGES("LP-core exception can wakeup main cpu", "[ulp]",
|
||||
lp_core_prep_exception_wakeup,
|
||||
check_reset_reason_ulp_trap_wakeup);
|
||||
#endif //SOC_DEEP_SLEEP_SUPPORTED
|
||||
|
@@ -3,4 +3,3 @@ CONFIG_ESP_TASK_WDT_INIT=n
|
||||
CONFIG_ULP_COPROC_ENABLED=y
|
||||
CONFIG_ULP_COPROC_TYPE_LP_CORE=y
|
||||
CONFIG_ULP_COPROC_RESERVE_MEM=12000
|
||||
CONFIG_ULP_PANIC_OUTPUT_ENABLE=y
|
||||
|
@@ -3,4 +3,3 @@ CONFIG_ESP_TASK_WDT_INIT=n
|
||||
CONFIG_ULP_COPROC_ENABLED=y
|
||||
CONFIG_ULP_COPROC_TYPE_LP_CORE=y
|
||||
CONFIG_ULP_COPROC_RESERVE_MEM=12000
|
||||
CONFIG_ULP_PANIC_OUTPUT_ENABLE=y
|
||||
|
Reference in New Issue
Block a user