Skip to content

Commit

Permalink
Merge branch 'feature/support_abort_on_lp_core' into 'master'
Browse files Browse the repository at this point in the history
lp-core: Added support for abort() function on the LP core

See merge request espressif/esp-idf!24204
  • Loading branch information
sudeep-mohanty committed Jun 20, 2023
2 parents f6b9c48 + 424a72c commit ab8ed89
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
6 changes: 6 additions & 0 deletions components/ulp/lp_core/lp_core/include/ulp_lp_core_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ extern "C" {
#endif

#include <stdint.h>
#include <stdlib.h>


/**
Expand Down Expand Up @@ -53,6 +54,11 @@ void ulp_lp_core_delay_cycles(uint32_t cycles);
*/
__attribute__((__noreturn__)) void ulp_lp_core_halt(void);

/**
* @brief The LP core puts itself to sleep and disables all wakeup sources.
*/
__attribute__((__noreturn__)) void ulp_lp_core_stop_lp_core(void);

#ifdef __cplusplus
}
#endif
15 changes: 15 additions & 0 deletions components/ulp/lp_core/lp_core/lp_core_utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -63,3 +63,18 @@ void ulp_lp_core_halt(void)

while(1);
}

void ulp_lp_core_stop_lp_core(void)
{
/* Disable wake-up source and put lp core to sleep */
REG_SET_FIELD(PMU_LP_CPU_PWR1_REG, PMU_LP_CPU_WAKEUP_EN, 0);
REG_SET_FIELD(PMU_LP_CPU_PWR1_REG, PMU_LP_CPU_SLEEP_REQ, 1);
}

void __attribute__((noreturn)) abort(void)
{
/* Stop the LP Core */
ulp_lp_core_stop_lp_core();

while (1);
}

0 comments on commit ab8ed89

Please sign in to comment.