mirror of
https://github.com/espressif/esp-idf.git
synced 2026-09-22 13:01:16 +03:00
Merge branch 'feature/recovery_bootloader_support' into 'master'
feat(bootloader): Support recovery bootloader for ESP32P4 Closes IDF-15653 and IDF-13165 See merge request espressif/esp-idf!48215
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2023-2025 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileCopyrightText: 2023-2026 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
@@ -451,6 +451,30 @@ void intr_matrix_set(int cpu_no, uint32_t model_num, uint32_t intr_num);
|
||||
|
||||
#define ETS_MEM_BAR() asm volatile ( "" : : : "memory" )
|
||||
|
||||
/**
|
||||
* @brief Returns the offset from which the bootloader image is used to load.
|
||||
*
|
||||
* The offset can point to either the PRIMARY or RECOVERY bootloader.
|
||||
*
|
||||
* @note The bootloader offset variable in ROM is stored in a memory that will be reclaimed by heap component.
|
||||
* Read it before the heap is initialized, otherwise it may return an invalid value.
|
||||
*
|
||||
* @return The offset of the active bootloader.
|
||||
*/
|
||||
uint32_t ets_get_bootloader_offset(void);
|
||||
|
||||
/**
|
||||
* @brief Sets the offset from which the bootloader image is used to load.
|
||||
*
|
||||
* The offset can point to either the PRIMARY or RECOVERY bootloader.
|
||||
*
|
||||
* @note The bootloader offset variable in ROM is stored in a memory that will be reclaimed by heap component.
|
||||
* Setting it after the heap is initialized, may corrupt the heap memory.
|
||||
*
|
||||
* @param offset The offset value to set for the active bootloader.
|
||||
*/
|
||||
void ets_set_bootloader_offset(uint32_t offset);
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2025 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileCopyrightText: 2025-2026 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
@@ -462,6 +462,30 @@ void intr_matrix_set(int cpu_no, uint32_t model_num, uint32_t intr_num);
|
||||
|
||||
#define ETS_MEM_BAR() asm volatile ( "" : : : "memory" )
|
||||
|
||||
/**
|
||||
* @brief Returns the offset from which the bootloader image is used to load.
|
||||
*
|
||||
* The offset can point to either the PRIMARY or RECOVERY bootloader.
|
||||
*
|
||||
* @note The bootloader offset variable in ROM is stored in a memory that will be reclaimed by heap component.
|
||||
* Read it before the heap is initialized, otherwise it may return an invalid value.
|
||||
*
|
||||
* @return The offset of the active bootloader.
|
||||
*/
|
||||
uint32_t ets_get_bootloader_offset(void);
|
||||
|
||||
/**
|
||||
* @brief Sets the offset from which the bootloader image is used to load.
|
||||
*
|
||||
* The offset can point to either the PRIMARY or RECOVERY bootloader.
|
||||
*
|
||||
* @note The bootloader offset variable in ROM is stored in a memory that will be reclaimed by heap component.
|
||||
* Setting it after the heap is initialized, may corrupt the heap memory.
|
||||
*
|
||||
* @param offset The offset value to set for the active bootloader.
|
||||
*/
|
||||
void ets_set_bootloader_offset(uint32_t offset);
|
||||
|
||||
typedef enum {
|
||||
OK = 0,
|
||||
FAIL,
|
||||
|
||||
@@ -119,11 +119,17 @@ void esp_rom_set_cpu_ticks_per_us(uint32_t ticks_per_us)
|
||||
#if SOC_RECOVERY_BOOTLOADER_SUPPORTED
|
||||
uint32_t esp_rom_get_bootloader_offset(void)
|
||||
{
|
||||
#if CONFIG_IDF_TARGET_ESP32P4 && CONFIG_ESP32P4_REV_MIN_FULL < 300
|
||||
// For early revisions of ESP32-P4 does not recovery bootloader feature.
|
||||
// Return the default bootloader offset.
|
||||
return CONFIG_BOOTLOADER_OFFSET_IN_FLASH;
|
||||
#else
|
||||
static uint32_t offset_of_active_bootloader = UINT32_MAX;
|
||||
if (offset_of_active_bootloader == UINT32_MAX) {
|
||||
offset_of_active_bootloader = ets_get_bootloader_offset();
|
||||
}
|
||||
return offset_of_active_bootloader;
|
||||
#endif
|
||||
}
|
||||
#endif // SOC_RECOVERY_BOOTLOADER_SUPPORTED
|
||||
|
||||
|
||||
Reference in New Issue
Block a user