arch/risc-v/esp32[-c3|-c6|-h2]: Add auto sleep

Add auto sleep for risc-v based Espressif devices

Signed-off-by: Eren Terzioglu <eren.terzioglu@espressif.com>
This commit is contained in:
Tiago Medicci Serrano
2026-03-30 16:28:28 -03:00
committed by Xiang Xiao
parent ad168fdf2d
commit 213a651509
24 changed files with 1067 additions and 25 deletions
@@ -34,6 +34,13 @@ list(APPEND SRCS esp_irq.c esp_gpio.c esp_rtc_gpio.c esp_libc_stubs.c)
list(APPEND SRCS esp_lowputc.c esp_serial.c)
list(APPEND SRCS esp_systemreset.c)
if(CONFIG_ARCH_HAVE_EXTRA_HEAPS)
list(APPEND SRCS esp_extraheaps.c)
if(CONFIG_ESPRESSIF_RETENTION_HEAP)
list(APPEND SRCS esp_retentionheap.c)
endif()
endif()
if(CONFIG_SCHED_TICKLESS)
list(APPEND SRCS esp_tickless.c)
else()
@@ -202,7 +209,7 @@ if(DEFINED ENV{ESP_HAL_3RDPARTY_VERSION})
CACHE STRING "ESP HAL 3rdparty version")
else()
set(ESP_HAL_3RDPARTY_VERSION
5d8324708f55d5a927329553cdceebf7eafbd8c6
b7e51db97a3f9dc82d3b3524d2bad298ba1e2647
CACHE STRING "ESP HAL 3rdparty version")
endif()
+17
View File
@@ -469,6 +469,22 @@ endmenu # LP Core (Low-power core) Coprocessor Configuration
menu "PM Configuration"
config ESPRESSIF_AUTO_SLEEP
bool "Auto-sleep"
default n
select PM
select ESPRESSIF_HR_TIMER
select ARCH_HAVE_EXTRA_HEAPS if ARCH_CHIP_ESP32C3
select ESPRESSIF_RETENTION_HEAP if ARCH_CHIP_ESP32C3
select SCHED_TICKLESS
---help---
Enable Auto-sleep
config ESPRESSIF_RETENTION_HEAP
bool "Use retention memory as a separate heap"
depends on ARCH_CHIP_ESP32C3
default n
if PM
config PM_EXT1_WAKEUP
@@ -615,6 +631,7 @@ config PM_ULP_WAKEUP
config PM_GPIO_WAKEUP
bool "PM GPIO Wakeup"
default n
depends on ARCH_CHIP_ESP32C3
---help---
Enable GPIO wakeup functionality.
This allows the system to wake up from PM_STANDBY
+8 -1
View File
@@ -39,6 +39,13 @@ CHIP_CSRCS += esp_irq.c esp_gpio.c esp_rtc_gpio.c esp_libc_stubs.c
CHIP_CSRCS += esp_lowputc.c esp_serial.c
CHIP_CSRCS += esp_systemreset.c
ifeq ($(CONFIG_ARCH_HAVE_EXTRA_HEAPS),y)
CHIP_CSRCS += esp_extraheaps.c
ifeq ($(CONFIG_ESPRESSIF_RETENTION_HEAP),y)
CHIP_CSRCS += esp_retentionheap.c
endif
endif
ifeq ($(CONFIG_SCHED_TICKLESS),y)
CHIP_CSRCS += esp_tickless.c
else
@@ -210,7 +217,7 @@ endif
ESP_HAL_3RDPARTY_REPO = esp-hal-3rdparty
ifndef ESP_HAL_3RDPARTY_VERSION
ESP_HAL_3RDPARTY_VERSION = 5d8324708f55d5a927329553cdceebf7eafbd8c6
ESP_HAL_3RDPARTY_VERSION = b7e51db97a3f9dc82d3b3524d2bad298ba1e2647
endif
ifndef ESP_HAL_3RDPARTY_URL
@@ -36,11 +36,20 @@
#include "riscv_internal.h"
#include "rom/rom_layout.h"
#ifdef CONFIG_ESPRESSIF_RETENTION_HEAP
# include "esp_retentionheap.h"
#endif
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
/****************************************************************************
* Public Data
****************************************************************************/
uintptr_t _heap_start;
/****************************************************************************
* Public Functions
****************************************************************************/
@@ -77,11 +86,22 @@ void up_allocate_heap(void **heap_start, size_t *heap_size)
* Check boards/risc-v/espressif.
*/
#ifdef CONFIG_ESPRESSIF_RETENTION_HEAP
uintptr_t rstart;
uintptr_t rend;
#endif
board_autoled_on(LED_HEAPALLOCATE);
*heap_start = (void *)g_idle_topstack;
#ifdef CONFIG_ESPRESSIF_RETENTION_HEAP
esp_retentionheap_find_region(&rstart, &rend);
*heap_size = (uintptr_t) rstart - g_idle_topstack;
#else
*heap_size = (uintptr_t)ets_rom_layout_p->dram0_rtos_reserved_start -
g_idle_topstack;
#endif
_heap_start = g_idle_topstack;
}
/****************************************************************************
@@ -0,0 +1,43 @@
/****************************************************************************
* arch/risc-v/src/common/espressif/esp_extraheaps.c
*
* SPDX-License-Identifier: Apache-2.0
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. The
* ASF licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
****************************************************************************/
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
#include <nuttx/arch.h>
#ifdef CONFIG_ESPRESSIF_RETENTION_HEAP
# include "esp_retentionheap.h"
#endif
/****************************************************************************
* Public Functions
****************************************************************************/
void up_extraheaps_init(void)
{
#ifdef CONFIG_ESPRESSIF_RETENTION_HEAP
esp_retentionheap_initialize();
#endif
}
+28 -3
View File
@@ -34,10 +34,26 @@
#include <nuttx/spinlock.h>
#include <nuttx/debug.h>
#include <nuttx/arch.h>
#include <sys/param.h>
#include "riscv_internal.h"
#include "esp_pm.h"
#ifdef CONFIG_ESPRESSIF_HR_TIMER
#include "esp_hr_timer.h"
#endif
#ifdef CONFIG_SCHED_TICKLESS
#include "esp_tickless.h"
#endif
#ifdef CONFIG_ESPRESSIF_AUTO_SLEEP
#include "esp_private/pm_impl.h"
#include "platform/os.h"
#endif
#include "esp_sleep.h"
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
@@ -87,6 +103,9 @@ static spinlock_t g_esp_idle_lock = SP_UNLOCKED;
static void up_idlepm(void)
{
irqstate_t flags;
# ifdef CONFIG_ESPRESSIF_AUTO_SLEEP
esp_os_application_sleep();
# else
static enum pm_state_e oldstate = PM_NORMAL;
enum pm_state_e newstate;
int ret;
@@ -169,16 +188,17 @@ static void up_idlepm(void)
}
else
{
# ifdef CONFIG_WATCHDOG
# ifdef CONFIG_WATCHDOG
/* Announce the power management state change to feed watchdog */
pm_changestate(PM_IDLE_DOMAIN, PM_NORMAL);
# endif
# endif
}
# endif /* CONFIG_ESPRESSIF_AUTO_SLEEP */
}
#else
# define up_idlepm()
#endif
#endif /* CONFIG_PM */
/****************************************************************************
* Public Functions
@@ -216,7 +236,12 @@ void up_idle(void)
* sleep in a reduced power mode until an interrupt occurs to save power
*/
#ifdef CONFIG_ESPRESSIF_AUTO_SLEEP
esp_pm_impl_idle_hook();
esp_pm_impl_waiti();
#else
asm("WFI");
#endif
/* Perform IDLE mode power management */
+305 -7
View File
@@ -30,7 +30,10 @@
#include <nuttx/debug.h>
#include "esp_pm.h"
#include "include/esp_pm.h"
#include "espressif/esp_pm.h"
#include "esp_hr_timer.h"
#ifdef CONFIG_SCHED_TICKLESS
# include "esp_tickless.h"
#endif
@@ -38,6 +41,9 @@
#include "soc/rtc.h"
#include "esp_sleep_internal.h"
#include "esp_pmu.h"
#include "esp_attr.h"
#include "esp_private/pm_impl.h"
#ifdef CONFIG_PM_EXT1_WAKEUP
# include "driver/rtc_io.h"
#endif
@@ -57,7 +63,7 @@
* Pre-processor Definitions
****************************************************************************/
#if defined(CONFIG_ARCH_CHIP_ESP32C3_GENERIC) || \
#if defined(CONFIG_ARCH_CHIP_ESP32C3) || \
defined(CONFIG_ARCH_CHIP_ESP32C6)
# define CHECK_VDD_SPI 1
# if defined(CONFIG_ARCH_CHIP_ESP32C6)
@@ -69,6 +75,19 @@
# endif /* CONFIG_ARCH_CHIP_ESP32C6 */
#endif /* CONFIG_ARCH_CHIP_ESP32C3_GENERIC || CONFIG_ARCH_CHIP_ESP32C6 */
#ifdef CONFIG_PM_EXT0_WAKEUP
# define EXT0_WAIT_TIME_US 5000000
#endif
#ifdef CONFIG_PM_EXT1_WAKEUP
# define EXT1_WAIT_TIME_US 5000000
#endif
#ifdef CONFIG_PM_GPIO_WAKEUP
# define GPIO_WAIT_TIME_US 5000000
#endif
#ifdef CONFIG_PM_UART_WAKEUP
# define UART_WAIT_TIME_US 5000000
#endif
/****************************************************************************
* Private Data
****************************************************************************/
@@ -94,10 +113,41 @@ const char *g_wakeup_reasons[] =
""
};
static esp_sleep_wakeup_cause_t g_last_wakeup_reason =
ESP_SLEEP_WAKEUP_UNDEFINED;
static uint64_t g_last_wakeup_time = 0;
/****************************************************************************
* Private Functions
****************************************************************************/
#ifdef CONFIG_PM_EXT0_WAKEUP
/****************************************************************************
* Name: esp_pm_ext0_wakeup_prepare
*
* Description:
* Configure ext0 gpios to use as wakeup source.
*
* Input Parameters:
* None
*
* Returned Value:
* None
*
****************************************************************************/
static void IRAM_ATTR esp_pm_ext0_wakeup_prepare(void)
{
int pin = CONFIG_PM_EXT0_WAKEUP_GPIO;
# ifdef CONFIG_PM_EXT0_WAKEUP_TRIGGER_LOW
int level_mode = 0;
# else
int level_mode = 1;
# endif /* CONFIG_PM_EXT0_WAKEUP */
esp_sleep_enable_ext0_wakeup(pin, level_mode);
}
#endif /* CONFIG_PM_EXT0_WAKEUP */
#ifdef CONFIG_PM_EXT1_WAKEUP
/****************************************************************************
* Name: esp_pm_get_ext1_io_mask
@@ -410,6 +460,163 @@ static void IRAM_ATTR esp_pm_uart_wakeup_prepare(void)
}
#endif /* CONFIG_PM_UART_WAKEUP */
#ifdef CONFIG_ESPRESSIF_AUTO_SLEEP
/****************************************************************************
* Name: esp_pm_skip_light_sleep
*
* Description:
* Callback for the power manager's "skip light sleep" hook. This function
* checks if the system should defer entering light sleep after waking up
* from any supported wakeup source (EXT0, EXT1, GPIO, UART). It compares
* the current time to the last wakeup time for each source. If the system
* is still within the configured guard window for any wakeup source, it
* returns true to skip light sleep and let peripheral activity finish. If
* the guard window has elapsed or there was no wakeup, it returns false
* and allows light sleep to proceed.
*
* Placed in IRAM because it runs in timing-critical power management
* decision paths.
*
* Input Parameters:
* None
*
* Returned Value:
* true - Skip light sleep (recent EXT0, EXT1, GPIO, or UART wakeup still
* within the configured guard window).
* false - Allow light sleep (no relevant wakeup or guard window elapsed).
*
****************************************************************************/
static bool IRAM_ATTR esp_pm_skip_light_sleep(void)
{
bool skip = false;
#if defined(CONFIG_PM_EXT0_WAKEUP) || \
defined(CONFIG_PM_EXT1_WAKEUP) || \
defined(CONFIG_PM_GPIO_WAKEUP) || \
defined(CONFIG_PM_UART_WAKEUP)
uint64_t current_time = esp_hr_timer_time_us();
#endif
#ifdef CONFIG_PM_EXT0_WAKEUP
if (g_last_wakeup_reason == ESP_SLEEP_WAKEUP_EXT0 &&
current_time < (g_last_wakeup_time + EXT0_WAIT_TIME_US))
{
pwrinfo("EXT0 wakeup still within guard window\n");
skip = true;
}
#endif
#ifdef CONFIG_PM_EXT1_WAKEUP
if (g_last_wakeup_reason == ESP_SLEEP_WAKEUP_EXT1 &&
current_time < (g_last_wakeup_time + EXT1_WAIT_TIME_US))
{
pwrinfo("EXT1 wakeup still within guard window\n");
skip = true;
}
#endif
#ifdef CONFIG_PM_GPIO_WAKEUP
if (g_last_wakeup_reason == ESP_SLEEP_WAKEUP_GPIO &&
current_time < (g_last_wakeup_time + GPIO_WAIT_TIME_US))
{
pwrinfo("GPIO wakeup still within guard window\n");
skip = true;
}
#endif
#ifdef CONFIG_PM_UART_WAKEUP
if (g_last_wakeup_reason == ESP_SLEEP_WAKEUP_UART &&
current_time < (g_last_wakeup_time + UART_WAIT_TIME_US))
{
pwrinfo("UART wakeup still within guard window\n");
skip = true;
}
#endif
return skip;
}
/****************************************************************************
* Name: esp_pm_light_sleep_exit_cb
*
* Description:
* Store wakeup reason and timestamp on light sleep exit.
*
* Input Parameters:
* sleep_time_us - Actual sleep time in microseconds (unused).
* arg - User callback argument (unused).
*
* Returned Value:
* ESP_OK
*
****************************************************************************/
static esp_err_t IRAM_ATTR esp_pm_light_sleep_exit_cb(int64_t sleep_time_us,
void *arg)
{
esp_sleep_wakeup_cause_t wc;
uint64_t tw;
UNUSED(sleep_time_us);
UNUSED(arg);
wc = esp_sleep_get_wakeup_cause();
tw = esp_hr_timer_time_us();
pwrinfo("Light sleep exit: %s, time: %lld\n", g_wakeup_reasons[wc], tw);
esp_pm_wakeup_set_last_reason((int32_t)wc);
esp_pm_wakeup_set_last_time(tw);
return ESP_OK;
}
#endif /* CONFIG_ESPRESSIF_AUTO_SLEEP */
/****************************************************************************
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: esp_pm_wakeup_set_last_reason
*
* Description:
* Store the sleep exit wakeup cause after light sleep.
*
* Input Parameters:
* reason - Value from esp_sleep_get_wakeup_cause().
*
* Returned Value:
* None
*
****************************************************************************/
void esp_pm_wakeup_set_last_reason(int32_t reason)
{
g_last_wakeup_reason = reason;
}
/****************************************************************************
* Name: esp_pm_wakeup_set_last_time
*
* Description:
* Store the high-resolution timestamp (microseconds) for the last light
* sleep exit, together with the cause from
* esp_pm_wakeup_set_last_reason().
*
* Input Parameters:
* time_us - Time from esp_hr_timer_time_us() at exit from light sleep.
*
* Returned Value:
* None
*
****************************************************************************/
void esp_pm_wakeup_set_last_time(uint64_t time_us)
{
g_last_wakeup_time = time_us;
}
/****************************************************************************
* Name: esp_pm_sleep_enable_timer_wakeup
*
@@ -424,15 +631,11 @@ static void IRAM_ATTR esp_pm_uart_wakeup_prepare(void)
*
****************************************************************************/
static void esp_pm_sleep_enable_timer_wakeup(uint64_t time_in_us)
void esp_pm_sleep_enable_timer_wakeup(uint64_t time_in_us)
{
esp_sleep_enable_timer_wakeup(time_in_us);
}
/****************************************************************************
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: esp_pm_light_sleep_start
*
@@ -510,6 +713,9 @@ void esp_pmstandby(uint64_t time_in_us)
#ifdef CONFIG_PM_GPIO_WAKEUP
int64_t gpio_mask;
#endif
#ifdef CONFIG_PM_EXT0_WAKEUP
esp_pm_ext0_wakeup_prepare();
#endif
#ifdef CONFIG_PM_EXT1_WAKEUP
int64_t ext1_mask;
esp_pm_ext1_wakeup_prepare();
@@ -518,6 +724,7 @@ void esp_pmstandby(uint64_t time_in_us)
esp_pm_gpio_wakeup_prepare();
#endif
#ifdef CONFIG_PM_ULP_WAKEUP
esp_sleep_pd_config(ESP_PD_DOMAIN_RTC_PERIPH, ESP_PD_OPTION_ON);
esp_sleep_enable_ulp_wakeup();
#endif
#ifdef CONFIG_PM_UART_WAKEUP
@@ -579,3 +786,94 @@ void esp_pmsleep(uint64_t time_in_us)
esp_pm_sleep_enable_timer_wakeup(time_in_us);
esp_pm_deep_sleep_start();
}
#ifdef CONFIG_ESPRESSIF_AUTO_SLEEP
/****************************************************************************
* Name: esp_pmconfigure
*
* Description:
* Configure power manager.
*
* Input Parameters:
* None.
*
* Returned Value:
* Returns OK on success; a negated errno value on failure.
*
****************************************************************************/
int esp_pmconfigure(void)
{
int ret;
esp_err_t err = ESP_OK;
#ifdef CONFIG_PM_EXT1_WAKEUP
int64_t ext1_mask;
#endif
#ifdef CONFIG_PM_GPIO_WAKEUP
int64_t gpio_mask;
#endif
esp_pm_config_t pm_config =
{
.max_freq_mhz = CONFIG_ESPRESSIF_CPU_FREQ_MHZ,
.min_freq_mhz = CONFIG_ESPRESSIF_CPU_FREQ_MHZ,
#ifdef CONFIG_ESPRESSIF_AUTO_SLEEP
.light_sleep_enable = true
#endif
};
ret = esp_pm_configure(&pm_config);
if (ret != OK)
{
return ret;
}
#ifdef CONFIG_PM_EXT0_WAKEUP
esp_pm_ext0_wakeup_prepare();
#endif
#ifdef CONFIG_PM_EXT1_WAKEUP
esp_pm_ext1_wakeup_prepare();
#endif
#ifdef CONFIG_PM_GPIO_WAKEUP
esp_pm_gpio_wakeup_prepare();
#endif
#ifdef CONFIG_PM_UART_WAKEUP
esp_pm_uart_wakeup_prepare();
#endif /* CONFIG_PM_UART_WAKEUP */
err = esp_pm_register_skip_light_sleep_callback(
esp_pm_skip_light_sleep);
if (err != ESP_OK)
{
pwrerr("Failed to register skip light sleep callback: %d\n", err);
return -ENOMEM;
}
esp_pm_sleep_cbs_register_config_t sleep_cbs =
{
.enter_cb = NULL,
.exit_cb = esp_pm_light_sleep_exit_cb,
.enter_cb_user_arg = NULL,
.exit_cb_user_arg = NULL,
.enter_cb_prior = 0,
.exit_cb_prior = 0,
};
err = esp_pm_light_sleep_register_cbs(&sleep_cbs);
if (err != ESP_OK)
{
pwrerr("Failed to register light sleep callbacks: %d\n", err);
return -ENOMEM;
}
err =
esp_sleep_set_console_uart_handling_mode(ESP_SLEEP_ALWAYS_FLUSH_UART);
if (err != ESP_OK)
{
pwrerr("Failed to set console UART handling mode: %d\n", err);
return -ENOMEM;
}
return ret;
}
#endif /* CONFIG_ESPRESSIF_AUTO_SLEEP */
+73
View File
@@ -44,11 +44,32 @@ extern "C"
#endif
#ifdef CONFIG_PM
/****************************************************************************
* Public Types
****************************************************************************/
typedef bool (*skip_light_sleep_cb_t)(void);
/****************************************************************************
* Public Function Prototypes
****************************************************************************/
/****************************************************************************
* Name: esp_pm_sleep_enable_timer_wakeup
*
* Description:
* Configure wakeup interval
*
* Input Parameters:
* time_in_us - Sleep duration in microseconds.
*
* Returned Value:
* None
*
****************************************************************************/
void esp_pm_sleep_enable_timer_wakeup(uint64_t time_in_us);
/****************************************************************************
* Name: esp_pm_light_sleep_start
*
@@ -114,6 +135,58 @@ void esp_pmstandby(uint64_t time_in_us);
void esp_pmsleep(uint64_t time_in_us);
/****************************************************************************
* Name: esp_pmconfigure
*
* Description:
* Configure power manager.
*
* Input Parameters:
* None
*
* Returned Value:
* Returns OK on success; a negated errno value on failure.
*
****************************************************************************/
#ifdef CONFIG_ESPRESSIF_AUTO_SLEEP
int esp_pmconfigure(void);
#endif
/****************************************************************************
* Name: esp_pm_wakeup_set_last_reason
*
* Description:
* Store the sleep exit wakeup cause after light sleep. Used with
* esp_pm_wakeup_set_last_time() so the skip-light-sleep hook can
* detect a recent UART wakeup.
*
* Input Parameters:
* reason - Value from esp_sleep_get_wakeup_cause().
*
* Returned Value:
* None
*
****************************************************************************/
void esp_pm_wakeup_set_last_reason(int32_t reason);
/****************************************************************************
* Name: esp_pm_wakeup_set_last_time
*
* Description:
* Store the high-resolution timestamp (microseconds) aligned with
* the wakeup cause set by esp_pm_wakeup_set_last_reason().
*
* Input Parameters:
* time_us - Time from esp_hr_timer_time_us() at exit from light sleep.
*
* Returned Value:
* None
*
****************************************************************************/
void esp_pm_wakeup_set_last_time(uint64_t time_us);
#endif /* CONFIG_PM */
#ifdef __cplusplus
@@ -0,0 +1,292 @@
/****************************************************************************
* arch/risc-v/src/common/espressif/esp_retentionheap.c
*
* SPDX-License-Identifier: Apache-2.0
*
****************************************************************************/
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
#ifdef CONFIG_ESPRESSIF_RETENTION_HEAP
#include <debug.h>
#include <stdint.h>
#include <stddef.h>
#include <sys/types.h>
#include <nuttx/mm/mm.h>
#include "esp_retentionheap.h"
#include "soc/soc.h"
#include "heap_memory_layout.h"
#include "esp_heap_caps.h"
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
#define APP_USABLE_DRAM_END (SOC_ROM_STACK_START - SOC_ROM_STACK_SIZE)
/****************************************************************************
* Private Data
****************************************************************************/
static struct mm_heap_s *g_retentionheap;
/****************************************************************************
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: esp_retentionheap_find_region
*
* Description:
* Find address of retention heap.
*
* Input Parameters:
* rstart - Starting address of the region
* rend - Ending address of the region
*
* Returned Value:
* True if region found; false otherwise
*
****************************************************************************/
bool esp_retentionheap_find_region(uintptr_t *rstart, uintptr_t *rend)
{
for (size_t i = 0; i < soc_memory_region_count; i++)
{
const soc_memory_region_t *reg = &soc_memory_regions[i];
if ((soc_memory_types[reg->type].caps[0] & MALLOC_CAP_RETENTION) != 0
&& (reg->startup_stack == false))
{
*rstart = (uintptr_t)reg->start;
*rend = *rstart + reg->size;
return true;
}
}
return false;
}
/****************************************************************************
* Name: esp_retentionheap_initialize
*
* Description:
* Initialize the retention heap.
*
* Input Parameters:
* None
*
* Returned Value:
* None
*
****************************************************************************/
void esp_retentionheap_initialize(void)
{
size_t sz;
uintptr_t rstart;
uintptr_t rend;
if (!esp_retentionheap_find_region(&rstart, &rend))
{
_warn("MALLOC_CAP_RETENTION region did not find\n");
return;
}
if (rend <= rstart)
{
return;
}
sz = (size_t)(rend - rstart);
g_retentionheap = mm_initialize("retention", (void *)rstart, sz);
if (g_retentionheap == NULL)
{
_err("retention heap mm_initialize failed size=%zu\n", sz);
}
}
/****************************************************************************
* Name: esp_retentionheap_malloc
*
* Description:
* Allocate memory from the retention heap.
*
* Input Parameters:
* size - Size to allocate memory in bytes
*
* Returned Value:
* Valid address reference on success; NULL, otherwise.
*
****************************************************************************/
void *esp_retentionheap_malloc(size_t size)
{
if (g_retentionheap == NULL)
{
return NULL;
}
return mm_malloc(g_retentionheap, size);
}
/****************************************************************************
* Name: esp_retentionheap_calloc
*
* Description:
* Calculates the size of the allocation and allocate memory from
* the retention heap.
*
* Input Parameters:
* n - Number of elements to allocate.
* elem_size - Size of each element, in bytes.
*
* Returned Value:
* Valid address reference on success; NULL, otherwise.
*
****************************************************************************/
void *esp_retentionheap_calloc(size_t n, size_t elem_size)
{
if (g_retentionheap == NULL)
{
return NULL;
}
return mm_calloc(g_retentionheap, n, elem_size);
}
/****************************************************************************
* Name: esp_retentionheap_memalign
*
* Description:
* memalign requests more than enough space from malloc, finds a region
* within that chunk that meets the alignment request and then frees any
* leading or trailing space.
*
* The alignment argument must be a power of two (not checked). 8-byte
* alignment is guaranteed by normal malloc calls.
*
* Input Parameters:
* alignment - Required byte alignment; must be a power of two and usually
* at least sizeof(void *).
* size - Number of bytes to allocate.
*
* Returned Value:
* Valid address reference on success; NULL, otherwise.
*
****************************************************************************/
void *esp_retentionheap_memalign(size_t alignment, size_t size)
{
if (g_retentionheap == NULL)
{
return NULL;
}
return mm_memalign(g_retentionheap, alignment, size);
}
/****************************************************************************
* Name: esp_retentionheap_realloc
*
* Description:
* Reallocate memory from the retention heap.
*
* Input Parameters:
* mem - The address to reallocate
* size - New requested size
*
* Returned Value:
* Valid address reference on success; NULL, otherwise.
*
****************************************************************************/
void *esp_retentionheap_realloc(void *ptr, size_t size)
{
if (g_retentionheap == NULL)
{
return NULL;
}
return mm_realloc(g_retentionheap, ptr, size);
}
/****************************************************************************
* Name: esp_retentionheap_free
*
* Description:
* Free memory from the retention heap.
*
* Input Parameters:
* mem - The address to free
*
* Returned Value:
* None.
*
****************************************************************************/
void esp_retentionheap_free(void *mem)
{
if (g_retentionheap == NULL || mem == NULL)
{
return;
}
mm_free(g_retentionheap, mem);
}
/****************************************************************************
* Name: esp_retentionheap_heapmember
*
* Description:
* Check if an address lies in the retention heap.
*
* Parameters:
* mem - The address to check
*
* Return Value:
* True if the address is in the retention heap; false if not.
*
****************************************************************************/
bool esp_retentionheap_heapmember(void *mem)
{
if (g_retentionheap == NULL || mem == NULL)
{
return false;
}
return mm_heapmember(g_retentionheap, mem);
}
/****************************************************************************
* Name: esp_retentionheap_malloc_size
*
* Description:
* Get size of the allocated space in retention heap
*
* Input Parameters:
* mem - The address to check
*
* Returned Value:
* Size of allocated space related to address.
*
****************************************************************************/
size_t esp_retentionheap_malloc_size(void *mem)
{
if (g_retentionheap == NULL || mem == NULL)
{
return 0;
}
return mm_malloc_size(g_retentionheap, mem);
}
#endif /* CONFIG_ESPRESSIF_RETENTION_HEAP */
@@ -0,0 +1,222 @@
/****************************************************************************
* arch/risc-v/src/common/espressif/esp_retentionheap.h
*
* SPDX-License-Identifier: Apache-2.0
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. The
* ASF licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
****************************************************************************/
#ifndef __ARCH_RISC_V_SRC_COMMON_ESPRESSIF_ESP_RETENTIONHEAP_H
#define __ARCH_RISC_V_SRC_COMMON_ESPRESSIF_ESP_RETENTIONHEAP_H
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
/****************************************************************************
* Public Types
****************************************************************************/
/****************************************************************************
* Public Data
****************************************************************************/
#ifndef __ASSEMBLY__
#ifdef __cplusplus
extern "C"
{
#endif
/****************************************************************************
* Public Functions Prototypes
****************************************************************************/
/****************************************************************************
* Public Function Prototypes
****************************************************************************/
#if defined(CONFIG_ESPRESSIF_RETENTION_HEAP)
/****************************************************************************
* Name: esp_retentionheap_find_region
*
* Description:
* Find address of retention heap.
*
* Input Parameters:
* rstart - Starting address of the region
* rend - Ending address of the region
*
* Returned Value:
* True if region found; false otherwise
*
****************************************************************************/
bool esp_retentionheap_find_region(uintptr_t *rstart, uintptr_t *rend);
/****************************************************************************
* Name: esp_retentionheap_initialize
*
* Description:
* Initialize the retention heap.
*
* Input Parameters:
* None
*
* Returned Value:
* None
*
****************************************************************************/
void esp_retentionheap_initialize(void);
/****************************************************************************
* Name: esp_retentionheap_malloc
*
* Description:
* Allocate memory from the retention heap.
*
* Input Parameters:
* size - Size to allocate memory in bytes
*
* Returned Value:
* Valid address reference on success; NULL, otherwise.
*
****************************************************************************/
void *esp_retentionheap_malloc(size_t size);
/****************************************************************************
* Name: esp_retentionheap_calloc
*
* Description:
* Calculates the size of the allocation and allocate memory from
* the retention heap.
*
* Input Parameters:
* n - Number of elements to allocate.
* elem_size - Size of each element, in bytes.
*
* Returned Value:
* Valid address reference on success; NULL, otherwise.
*
****************************************************************************/
void *esp_retentionheap_calloc(size_t n, size_t elem_size);
/****************************************************************************
* Name: esp_retentionheap_memalign
*
* Description:
* memalign requests more than enough space from malloc, finds a region
* within that chunk that meets the alignment request and then frees any
* leading or trailing space.
*
* The alignment argument must be a power of two (not checked). 8-byte
* alignment is guaranteed by normal malloc calls.
*
* Input Parameters:
* alignment - Required byte alignment; must be a power of two and usually
* at least sizeof(void *).
* size - Number of bytes to allocate.
*
* Returned Value:
* Valid address reference on success; NULL, otherwise.
*
****************************************************************************/
void *esp_retentionheap_memalign(size_t alignment, size_t size);
/****************************************************************************
* Name: esp_retentionheap_realloc
*
* Description:
* Reallocate memory from the retention heap.
*
* Input Parameters:
* mem - The address to reallocate
* size - New requested size
*
* Returned Value:
* Valid address reference on success; NULL, otherwise.
*
****************************************************************************/
void *esp_retentionheap_realloc(void *ptr, size_t size);
/****************************************************************************
* Name: esp_retentionheap_free
*
* Description:
* Free memory from the retention heap.
*
* Input Parameters:
* mem - The address to free
*
* Returned Value:
* None.
*
****************************************************************************/
void esp_retentionheap_free(void *mem);
/****************************************************************************
* Name: esp_retentionheap_heapmember
*
* Description:
* Check if an address lies in the retention heap.
*
* Parameters:
* mem - The address to check
*
* Return Value:
* True if the address is a member of the RTC heap. false if not
*
****************************************************************************/
bool esp_retentionheap_heapmember(void *mem);
/****************************************************************************
* Name: esp_retentionheap_malloc_size
*
* Description:
* Get size of the allocated space in retention heap
*
* Input Parameters:
* mem - The address to check
*
* Returned Value:
* Size of allocated space related to address.
*
****************************************************************************/
size_t esp_retentionheap_malloc_size(void *mem);
#endif /* CONFIG_ESPRESSIF_RETENTION_HEAP */
#ifdef __cplusplus
}
#endif
#endif /* __ASSEMBLY__ */
#endif /* __ARCH_RISC_V_SRC_COMMON_ESPRESSIF_ESP_RETENTIONHEAP_H */
@@ -117,7 +117,7 @@ static int esp_tickless_isr(int irq, void *context, void *arg)
*
* Returned Value:
* The time in system ticks remaining for idle.
* Zero means system is busy.
* Zero means that the system is in idle mode without any timer running.
*
****************************************************************************/
@@ -46,7 +46,7 @@
*
* Returned Value:
* The time in system ticks remaining for idle.
* Zero means system is busy.
* Zero means that the system is in idle mode without any timer running.
*
****************************************************************************/
+11 -3
View File
@@ -64,6 +64,7 @@ target_include_directories(
${ESP_HAL_3RDPARTY_REPO}/components/upper_hal_gpio/include
${ESP_HAL_3RDPARTY_REPO}/components/upper_hal_rmt/include
${ESP_HAL_3RDPARTY_REPO}/components/upper_hal_rmt/src
${ESP_HAL_3RDPARTY_REPO}/components/upper_hal_uart/include
# ESP HAL RMT (hal/rmt_hal.h)
${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_rmt/include
${ESP_HAL_3RDPARTY_REPO}/components/esp_hal_rmt/${CHIP_SERIES}/include
@@ -89,6 +90,7 @@ target_include_directories(
${ESP_HAL_3RDPARTY_REPO}/components/esp_phy/${CHIP_SERIES}/include
${ESP_HAL_3RDPARTY_REPO}/components/esp_phy/include
# ESP PM
${ESP_HAL_3RDPARTY_REPO}/components/esp_pm
${ESP_HAL_3RDPARTY_REPO}/components/esp_pm/include
# ESP ROM
${ESP_HAL_3RDPARTY_REPO}/components/esp_rom
@@ -302,7 +304,7 @@ list(
${ESP_HAL_3RDPARTY_REPO}/components/esp_mm/esp_mmu_map.c
${ESP_HAL_3RDPARTY_REPO}/components/esp_mm/esp_cache_utils.c
${ESP_HAL_3RDPARTY_REPO}/components/esp_mm/port/${CHIP_SERIES}/ext_mem_layout.c
)
${ESP_HAL_3RDPARTY_REPO}/components/heap/port/${CHIP_SERIES}/memory_layout.c)
# ESP PHY sources
list(
@@ -313,6 +315,10 @@ list(
${ESP_HAL_3RDPARTY_REPO}/components/esp_phy/src/phy_init.c
${ESP_HAL_3RDPARTY_REPO}/components/esp_phy/${CHIP_SERIES}/phy_init_data.c)
# ESP PM sources
list(APPEND HAL_SRCS ${ESP_HAL_3RDPARTY_REPO}/components/esp_pm/pm_locks.c
${ESP_HAL_3RDPARTY_REPO}/components/esp_pm/pm_impl.c)
# ESP ROM sources
list(
APPEND
@@ -408,7 +414,8 @@ list(
HAL_SRCS
${ESP_HAL_3RDPARTY_REPO}/components/riscv/instruction_decode.c
${ESP_HAL_3RDPARTY_REPO}/components/riscv/interrupt.c
${ESP_HAL_3RDPARTY_REPO}/components/riscv/interrupt_intc.c)
${ESP_HAL_3RDPARTY_REPO}/components/riscv/interrupt_intc.c
${ESP_HAL_3RDPARTY_REPO}/components/riscv/rv_utils.c)
# SPI Flash sources
list(
@@ -478,7 +485,8 @@ list(
${ESP_HAL_3RDPARTY_REPO}/components/upper_hal_rmt/src/rmt_encoder_copy.c
${ESP_HAL_3RDPARTY_REPO}/components/upper_hal_rmt/src/rmt_encoder_simple.c
${ESP_HAL_3RDPARTY_REPO}/components/upper_hal_rmt/src/rmt_rx.c
${ESP_HAL_3RDPARTY_REPO}/components/upper_hal_rmt/src/rmt_tx.c)
${ESP_HAL_3RDPARTY_REPO}/components/upper_hal_rmt/src/rmt_tx.c
${ESP_HAL_3RDPARTY_REPO}/components/upper_hal_uart/src/uart_wakeup.c)
# Bootloader flash encrypt source
list(APPEND HAL_SRCS
+7
View File
@@ -104,6 +104,7 @@ INCLUDES += $(INCDIR_PREFIX)$(ARCH_SRCDIR)$(DELIM)chip$(DELIM)$(ESP_HAL_3RDPARTY
INCLUDES += $(INCDIR_PREFIX)$(ARCH_SRCDIR)$(DELIM)chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)esp_mm$(DELIM)include
INCLUDES += $(INCDIR_PREFIX)$(ARCH_SRCDIR)$(DELIM)chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)esp_phy$(DELIM)$(CHIP_SERIES)$(DELIM)include
INCLUDES += $(INCDIR_PREFIX)$(ARCH_SRCDIR)$(DELIM)chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)esp_phy$(DELIM)include
INCLUDES += $(INCDIR_PREFIX)$(ARCH_SRCDIR)$(DELIM)chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)esp_pm
INCLUDES += $(INCDIR_PREFIX)$(ARCH_SRCDIR)$(DELIM)chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)esp_pm$(DELIM)include
INCLUDES += $(INCDIR_PREFIX)$(ARCH_SRCDIR)$(DELIM)chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)esp_rom
INCLUDES += $(INCDIR_PREFIX)$(ARCH_SRCDIR)$(DELIM)chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)esp_rom$(DELIM)include
@@ -145,6 +146,7 @@ INCLUDES += $(INCDIR_PREFIX)$(ARCH_SRCDIR)$(DELIM)chip$(DELIM)$(ESP_HAL_3RDPARTY
INCLUDES += $(INCDIR_PREFIX)$(ARCH_SRCDIR)$(DELIM)chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)upper_hal_gpio$(DELIM)include
INCLUDES += $(INCDIR_PREFIX)$(ARCH_SRCDIR)$(DELIM)chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)upper_hal_rmt$(DELIM)include
INCLUDES += $(INCDIR_PREFIX)$(ARCH_SRCDIR)$(DELIM)chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)upper_hal_rmt$(DELIM)src
INCLUDES += $(INCDIR_PREFIX)$(ARCH_SRCDIR)$(DELIM)chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)upper_hal_uart$(DELIM)include
INCLUDES += $(INCDIR_PREFIX)$(ARCH_SRCDIR)$(DELIM)chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)nuttx$(DELIM)src$(DELIM)components$(DELIM)esp_libc$(DELIM)platform_include
ifeq ($(CONFIG_ESPRESSIF_SIMPLE_BOOT),y)
@@ -225,6 +227,8 @@ CHIP_CSRCS += chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)esp_
CHIP_CSRCS += chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)esp_phy$(DELIM)src$(DELIM)phy_common.c
CHIP_CSRCS += chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)esp_phy$(DELIM)src$(DELIM)phy_init.c
CHIP_CSRCS += chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)esp_phy$(DELIM)$(CHIP_SERIES)$(DELIM)phy_init_data.c
CHIP_CSRCS += chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)esp_pm$(DELIM)pm_locks.c
CHIP_CSRCS += chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)esp_pm$(DELIM)pm_impl.c
CHIP_CSRCS += chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)esp_rom$(DELIM)patches$(DELIM)esp_rom_sys.c
CHIP_CSRCS += chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)esp_rom$(DELIM)patches$(DELIM)esp_rom_print.c
CHIP_CSRCS += chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)esp_rom$(DELIM)patches$(DELIM)esp_rom_crc.c
@@ -280,6 +284,7 @@ CHIP_CSRCS += chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)esp_
CHIP_CSRCS += chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)esp_hal_wdt$(DELIM)xt_wdt_hal.c
CHIP_CSRCS += chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)esp_hal_clock$(DELIM)$(CHIP_SERIES)$(DELIM)clk_tree_hal.c
CHIP_CSRCS += chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)hal$(DELIM)$(CHIP_SERIES)$(DELIM)efuse_hal.c
CHIP_CSRCS += chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)heap$(DELIM)port$(DELIM)${CHIP_SERIES}$(DELIM)memory_layout.c
CHIP_CSRCS += chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)log$(DELIM)src$(DELIM)log.c
CHIP_CSRCS += chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)log$(DELIM)src$(DELIM)log_level$(DELIM)log_level.c
CHIP_CSRCS += chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)log$(DELIM)src$(DELIM)log_level$(DELIM)tag_log_level$(DELIM)tag_log_level.c
@@ -309,6 +314,7 @@ CHIP_CSRCS += chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)spi_
CHIP_CSRCS += chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)spi_flash$(DELIM)flash_mmap.c
CHIP_CSRCS += chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)spi_flash$(DELIM)flash_brownout_hook.c
CHIP_CSRCS += chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)spi_flash$(DELIM)cache_utils.c
CHIP_CSRCS += chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)riscv$(DELIM)rv_utils.c
CHIP_CSRCS += chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)soc$(DELIM)lldesc.c
CHIP_CSRCS += chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)esp_hal_ana_conv$(DELIM)$(CHIP_SERIES)$(DELIM)adc_periph.c
CHIP_CSRCS += chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)esp_hal_gpio$(DELIM)$(CHIP_SERIES)$(DELIM)dedic_gpio_periph.c
@@ -341,6 +347,7 @@ CHIP_CSRCS += chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)uppe
CHIP_CSRCS += chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)upper_hal_rmt$(DELIM)src$(DELIM)rmt_encoder_simple.c
CHIP_CSRCS += chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)upper_hal_rmt$(DELIM)src$(DELIM)rmt_rx.c
CHIP_CSRCS += chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)upper_hal_rmt$(DELIM)src$(DELIM)rmt_tx.c
CHIP_CSRCS += chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)upper_hal_uart$(DELIM)src$(DELIM)uart_wakeup.c
# Bootloader files
+5 -2
View File
@@ -112,6 +112,7 @@ target_include_directories(
${ESP_HAL_3RDPARTY_REPO}/components/esp_mm/include
${ESP_HAL_3RDPARTY_REPO}/components/esp_phy/${CHIP_SERIES}/include
${ESP_HAL_3RDPARTY_REPO}/components/esp_phy/include
${ESP_HAL_3RDPARTY_REPO}/components/esp_pm
${ESP_HAL_3RDPARTY_REPO}/components/esp_pm/include
${ESP_HAL_3RDPARTY_REPO}/components/esp_rom
${ESP_HAL_3RDPARTY_REPO}/components/esp_rom/include
@@ -317,7 +318,8 @@ list(
${ESP_HAL_3RDPARTY_REPO}/components/esp_phy/${CHIP_SERIES}/phy_init_data.c)
# ESP PM
list(APPEND HAL_SRCS ${ESP_HAL_3RDPARTY_REPO}/components/esp_pm/pm_impl.c)
list(APPEND HAL_SRCS ${ESP_HAL_3RDPARTY_REPO}/components/esp_pm/pm_locks.c
${ESP_HAL_3RDPARTY_REPO}/components/esp_pm/pm_impl.c)
# ESP ROM
list(
@@ -497,7 +499,8 @@ list(
${ESP_HAL_3RDPARTY_REPO}/components/upper_hal_rmt/src/rmt_rx.c
${ESP_HAL_3RDPARTY_REPO}/components/upper_hal_rmt/src/rmt_tx.c
${ESP_HAL_3RDPARTY_REPO}/components/upper_hal_gpio/src/gpio.c
${ESP_HAL_3RDPARTY_REPO}/components/upper_hal_gpio/src/rtc_io.c)
${ESP_HAL_3RDPARTY_REPO}/components/upper_hal_gpio/src/rtc_io.c
${ESP_HAL_3RDPARTY_REPO}/components/upper_hal_uart/src/uart_wakeup.c)
# Sleep ASM
list(
+3 -1
View File
@@ -100,6 +100,7 @@ INCLUDES += $(INCDIR_PREFIX)$(ARCH_SRCDIR)$(DELIM)chip$(DELIM)$(ESP_HAL_3RDPARTY
INCLUDES += $(INCDIR_PREFIX)$(ARCH_SRCDIR)$(DELIM)chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)esp_mm$(DELIM)include
INCLUDES += $(INCDIR_PREFIX)$(ARCH_SRCDIR)$(DELIM)chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)esp_phy$(DELIM)$(CHIP_SERIES)$(DELIM)include
INCLUDES += $(INCDIR_PREFIX)$(ARCH_SRCDIR)$(DELIM)chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)esp_phy$(DELIM)include
INCLUDES += $(INCDIR_PREFIX)$(ARCH_SRCDIR)$(DELIM)chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)esp_pm
INCLUDES += $(INCDIR_PREFIX)$(ARCH_SRCDIR)$(DELIM)chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)esp_pm$(DELIM)include
INCLUDES += $(INCDIR_PREFIX)$(ARCH_SRCDIR)$(DELIM)chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)esp_rom
INCLUDES += $(INCDIR_PREFIX)$(ARCH_SRCDIR)$(DELIM)chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)esp_rom$(DELIM)include
@@ -250,6 +251,7 @@ CHIP_CSRCS += chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)esp_
CHIP_CSRCS += chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)esp_phy$(DELIM)src$(DELIM)phy_common.c
CHIP_CSRCS += chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)esp_phy$(DELIM)src$(DELIM)phy_init.c
CHIP_CSRCS += chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)esp_phy$(DELIM)$(CHIP_SERIES)$(DELIM)phy_init_data.c
CHIP_CSRCS += chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)esp_pm$(DELIM)pm_locks.c
CHIP_CSRCS += chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)esp_pm$(DELIM)pm_impl.c
CHIP_CSRCS += chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)esp_rom$(DELIM)patches$(DELIM)esp_rom_sys.c
CHIP_CSRCS += chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)esp_rom$(DELIM)patches$(DELIM)esp_rom_print.c
@@ -373,9 +375,9 @@ CHIP_CSRCS += chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)uppe
CHIP_CSRCS += chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)upper_hal_rmt$(DELIM)src$(DELIM)rmt_tx.c
CHIP_CSRCS += chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)upper_hal_gpio$(DELIM)src$(DELIM)gpio.c
CHIP_CSRCS += chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)upper_hal_gpio$(DELIM)src$(DELIM)rtc_io.c
CHIP_CSRCS += chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)upper_hal_uart$(DELIM)src$(DELIM)uart_wakeup.c
CHIP_ASRCS += chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)esp_hw_support$(DELIM)lowpower$(DELIM)port$(DELIM)esp32c6$(DELIM)sleep_cpu_asm.S
CHIP_CSRCS += chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)nuttx$(DELIM)src$(DELIM)platform$(DELIM)os.c
CHIP_CSRCS += chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)nuttx$(DELIM)src$(DELIM)heap_caps.c
CHIP_CSRCS += chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)nuttx$(DELIM)src$(DELIM)components$(DELIM)newlib$(DELIM)newlib$(DELIM)libc$(DELIM)misc$(DELIM)init.c
+5 -2
View File
@@ -111,6 +111,7 @@ target_include_directories(
${ESP_HAL_3RDPARTY_REPO}/components/esp_hw_support/port/${CHIP_SERIES}/private_include
${ESP_HAL_3RDPARTY_REPO}/components/esp_hw_support/power_supply/include
${ESP_HAL_3RDPARTY_REPO}/components/esp_mm/include
${ESP_HAL_3RDPARTY_REPO}/components/esp_pm
${ESP_HAL_3RDPARTY_REPO}/components/esp_pm/include
${ESP_HAL_3RDPARTY_REPO}/components/esp_rom
${ESP_HAL_3RDPARTY_REPO}/components/esp_rom/include
@@ -304,7 +305,8 @@ list(
)
# ESP PM
list(APPEND HAL_SRCS ${ESP_HAL_3RDPARTY_REPO}/components/esp_pm/pm_impl.c)
list(APPEND HAL_SRCS ${ESP_HAL_3RDPARTY_REPO}/components/esp_pm/pm_locks.c
${ESP_HAL_3RDPARTY_REPO}/components/esp_pm/pm_impl.c)
# ESP ROM
list(
@@ -474,7 +476,8 @@ list(
${ESP_HAL_3RDPARTY_REPO}/components/upper_hal_rmt/src/rmt_rx.c
${ESP_HAL_3RDPARTY_REPO}/components/upper_hal_rmt/src/rmt_tx.c
${ESP_HAL_3RDPARTY_REPO}/components/upper_hal_gpio/src/gpio.c
${ESP_HAL_3RDPARTY_REPO}/components/upper_hal_gpio/src/rtc_io.c)
${ESP_HAL_3RDPARTY_REPO}/components/upper_hal_gpio/src/rtc_io.c
${ESP_HAL_3RDPARTY_REPO}/components/upper_hal_uart/src/uart_wakeup.c)
# Sleep ASM
list(
+3
View File
@@ -98,6 +98,7 @@ INCLUDES += $(INCDIR_PREFIX)$(ARCH_SRCDIR)$(DELIM)chip$(DELIM)$(ESP_HAL_3RDPARTY
INCLUDES += $(INCDIR_PREFIX)$(ARCH_SRCDIR)$(DELIM)chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)esp_hw_support$(DELIM)port$(DELIM)$(CHIP_SERIES)$(DELIM)private_include
INCLUDES += $(INCDIR_PREFIX)$(ARCH_SRCDIR)$(DELIM)chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)esp_hw_support$(DELIM)power_supply$(DELIM)include
INCLUDES += $(INCDIR_PREFIX)$(ARCH_SRCDIR)$(DELIM)chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)esp_mm$(DELIM)include
INCLUDES += $(INCDIR_PREFIX)$(ARCH_SRCDIR)$(DELIM)chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)esp_pm
INCLUDES += $(INCDIR_PREFIX)$(ARCH_SRCDIR)$(DELIM)chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)esp_pm$(DELIM)include
INCLUDES += $(INCDIR_PREFIX)$(ARCH_SRCDIR)$(DELIM)chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)esp_rom
INCLUDES += $(INCDIR_PREFIX)$(ARCH_SRCDIR)$(DELIM)chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)esp_rom$(DELIM)include
@@ -231,6 +232,8 @@ CHIP_CSRCS += chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)esp_
CHIP_CSRCS += chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)esp_mm$(DELIM)esp_mmu_map.c
CHIP_CSRCS += chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)esp_mm$(DELIM)esp_cache_utils.c
CHIP_CSRCS += chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)esp_mm$(DELIM)port$(DELIM)$(CHIP_SERIES)$(DELIM)ext_mem_layout.c
CHIP_CSRCS += chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)esp_pm$(DELIM)pm_locks.c
CHIP_CSRCS += chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)esp_pm$(DELIM)pm_impl.c
CHIP_CSRCS += chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)esp_rom$(DELIM)patches$(DELIM)esp_rom_sys.c
CHIP_CSRCS += chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)esp_rom$(DELIM)patches$(DELIM)esp_rom_print.c
CHIP_CSRCS += chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)esp_rom$(DELIM)patches$(DELIM)esp_rom_crc.c
@@ -116,6 +116,7 @@ set(ESP32P4_INCLUDES
${ESP_HAL_3RDPARTY_REPO}/components/esp_hw_support/power_supply/include
${ESP_HAL_3RDPARTY_REPO}/components/esp_libc/priv_include
${ESP_HAL_3RDPARTY_REPO}/components/esp_mm/include
${ESP_HAL_3RDPARTY_REPO}/components/esp_pm
${ESP_HAL_3RDPARTY_REPO}/components/esp_pm/include
${ESP_HAL_3RDPARTY_REPO}/components/esp_rom/${CHIP_SERIES}
${ESP_HAL_3RDPARTY_REPO}/components/esp_rom/${CHIP_SERIES}/include
+1
View File
@@ -106,6 +106,7 @@ INCLUDES += $(INCDIR_PREFIX)$(ARCH_SRCDIR)$(DELIM)chip$(DELIM)$(ESP_HAL_3RDPARTY
INCLUDES += $(INCDIR_PREFIX)$(ARCH_SRCDIR)$(DELIM)chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)esp_hw_support$(DELIM)power_supply$(DELIM)include
INCLUDES += $(INCDIR_PREFIX)$(ARCH_SRCDIR)$(DELIM)chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)esp_libc$(DELIM)priv_include
INCLUDES += $(INCDIR_PREFIX)$(ARCH_SRCDIR)$(DELIM)chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)esp_mm$(DELIM)include
INCLUDES += $(INCDIR_PREFIX)$(ARCH_SRCDIR)$(DELIM)chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)esp_pm
INCLUDES += $(INCDIR_PREFIX)$(ARCH_SRCDIR)$(DELIM)chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)esp_pm$(DELIM)include
INCLUDES += $(INCDIR_PREFIX)$(ARCH_SRCDIR)$(DELIM)chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)esp_rom$(DELIM)$(CHIP_SERIES)
INCLUDES += $(INCDIR_PREFIX)$(ARCH_SRCDIR)$(DELIM)chip$(DELIM)$(ESP_HAL_3RDPARTY_REPO)$(DELIM)components$(DELIM)esp_rom$(DELIM)$(CHIP_SERIES)$(DELIM)include
+1 -1
View File
@@ -194,7 +194,7 @@ endif
ESP_HAL_3RDPARTY_REPO = esp-hal-3rdparty
ifndef ESP_HAL_3RDPARTY_VERSION
ESP_HAL_3RDPARTY_VERSION = 6c272b562a73107a852d44b9c6fb5df57245cbd7
ESP_HAL_3RDPARTY_VERSION = b7e51db97a3f9dc82d3b3524d2bad298ba1e2647
endif
ifndef ESP_HAL_3RDPARTY_URL
+1 -1
View File
@@ -127,7 +127,7 @@ endif
ESP_HAL_3RDPARTY_REPO = esp-hal-3rdparty
ifndef ESP_HAL_3RDPARTY_VERSION
ESP_HAL_3RDPARTY_VERSION = 6c272b562a73107a852d44b9c6fb5df57245cbd7
ESP_HAL_3RDPARTY_VERSION = b7e51db97a3f9dc82d3b3524d2bad298ba1e2647
endif
ifndef ESP_HAL_3RDPARTY_URL
+1 -1
View File
@@ -192,7 +192,7 @@ endif
ESP_HAL_3RDPARTY_REPO = esp-hal-3rdparty
ifndef ESP_HAL_3RDPARTY_VERSION
ESP_HAL_3RDPARTY_VERSION = 6c272b562a73107a852d44b9c6fb5df57245cbd7
ESP_HAL_3RDPARTY_VERSION = b7e51db97a3f9dc82d3b3524d2bad298ba1e2647
endif
ifndef ESP_HAL_3RDPARTY_URL
@@ -457,6 +457,16 @@ int esp_bringup(void)
}
#endif /* CONFIG_ESPRESSIF_LEDC */
#ifdef CONFIG_ESPRESSIF_AUTO_SLEEP
/* Configure PM */
ret = esp_pmconfigure();
if (ret < 0)
{
syslog(LOG_ERR, "ERROR: esp_pmconfigure failed: %d\n", ret);
}
#endif
#ifdef CONFIG_SYSTEM_NXDIAG_ESPRESSIF_CHIP_WO_TOOL
ret = esp_nxdiag_initialize();
if (ret < 0)