Merge branch 'bugfix/c61_systimer_etm' into 'master'

fix(systimer): fixed ETM not working with systimer on C61 ECO3

Closes IDFCI-3000, IDFCI-3002, and IDFCI-3003

See merge request espressif/esp-idf!40526
This commit is contained in:
Marius Vikhammer
2025-07-18 09:17:13 +08:00
16 changed files with 43 additions and 4 deletions

View File

@@ -43,6 +43,10 @@ config ESP_ROM_HAS_HAL_SYSTIMER
bool bool
default y default y
config ESP_ROM_SYSTIMER_INIT_PATCH
bool
default y
config ESP_ROM_HAS_HEAP_TLSF config ESP_ROM_HAS_HEAP_TLSF
bool bool
default y default y

View File

@@ -16,6 +16,7 @@
#define ESP_ROM_HAS_RVFPLIB (1) // ROM has the rvfplib #define ESP_ROM_HAS_RVFPLIB (1) // ROM has the rvfplib
#define ESP_ROM_HAS_HAL_WDT (1) // ROM has the implementation of Watchdog HAL driver #define ESP_ROM_HAS_HAL_WDT (1) // ROM has the implementation of Watchdog HAL driver
#define ESP_ROM_HAS_HAL_SYSTIMER (1) // ROM has the implementation of Systimer HAL driver #define ESP_ROM_HAS_HAL_SYSTIMER (1) // ROM has the implementation of Systimer HAL driver
#define ESP_ROM_SYSTIMER_INIT_PATCH (1) // ROM version initializes SYSTIMER without ETM
#define ESP_ROM_HAS_HEAP_TLSF (1) // ROM has the implementation of the tlsf and multi-heap library #define ESP_ROM_HAS_HEAP_TLSF (1) // ROM has the implementation of the tlsf and multi-heap library
#define ESP_ROM_TLSF_CHECK_PATCH (1) // ROM does not contain the patch of tlsf_check_pool() #define ESP_ROM_TLSF_CHECK_PATCH (1) // ROM does not contain the patch of tlsf_check_pool()
#define ESP_ROM_MULTI_HEAP_WALK_PATCH (1) // ROM does not contain the patch of multi_heap_walk() #define ESP_ROM_MULTI_HEAP_WALK_PATCH (1) // ROM does not contain the patch of multi_heap_walk()

View File

@@ -43,6 +43,10 @@ config ESP_ROM_HAS_HAL_SYSTIMER
bool bool
default y default y
config ESP_ROM_SYSTIMER_INIT_PATCH
bool
default y
config ESP_ROM_HAS_HEAP_TLSF config ESP_ROM_HAS_HEAP_TLSF
bool bool
default y default y

View File

@@ -16,6 +16,7 @@
#define ESP_ROM_HAS_RVFPLIB (1) // ROM has the rvfplib #define ESP_ROM_HAS_RVFPLIB (1) // ROM has the rvfplib
#define ESP_ROM_HAS_HAL_WDT (1) // ROM has the implementation of Watchdog HAL driver #define ESP_ROM_HAS_HAL_WDT (1) // ROM has the implementation of Watchdog HAL driver
#define ESP_ROM_HAS_HAL_SYSTIMER (1) // ROM has the implementation of Systimer HAL driver #define ESP_ROM_HAS_HAL_SYSTIMER (1) // ROM has the implementation of Systimer HAL driver
#define ESP_ROM_SYSTIMER_INIT_PATCH (1) // ROM version initializes SYSTIMER without ETM
#define ESP_ROM_HAS_HEAP_TLSF (1) // ROM has the implementation of the tlsf and multi-heap library #define ESP_ROM_HAS_HEAP_TLSF (1) // ROM has the implementation of the tlsf and multi-heap library
#define ESP_ROM_TLSF_CHECK_PATCH (1) // ROM does not contain the patch of tlsf_check_pool() #define ESP_ROM_TLSF_CHECK_PATCH (1) // ROM does not contain the patch of tlsf_check_pool()
#define ESP_ROM_MULTI_HEAP_WALK_PATCH (1) // ROM does not contain the patch of multi_heap_walk() #define ESP_ROM_MULTI_HEAP_WALK_PATCH (1) // ROM does not contain the patch of multi_heap_walk()

View File

@@ -43,6 +43,10 @@ config ESP_ROM_HAS_HAL_SYSTIMER
bool bool
default y default y
config ESP_ROM_SYSTIMER_INIT_PATCH
bool
default y
config ESP_ROM_HAS_HEAP_TLSF config ESP_ROM_HAS_HEAP_TLSF
bool bool
default y default y

View File

@@ -16,6 +16,7 @@
#define ESP_ROM_HAS_RVFPLIB (1) // ROM has the rvfplib #define ESP_ROM_HAS_RVFPLIB (1) // ROM has the rvfplib
#define ESP_ROM_HAS_HAL_WDT (1) // ROM has the implementation of Watchdog HAL driver #define ESP_ROM_HAS_HAL_WDT (1) // ROM has the implementation of Watchdog HAL driver
#define ESP_ROM_HAS_HAL_SYSTIMER (1) // ROM has the implementation of Systimer HAL driver #define ESP_ROM_HAS_HAL_SYSTIMER (1) // ROM has the implementation of Systimer HAL driver
#define ESP_ROM_SYSTIMER_INIT_PATCH (1) // ROM version initializes SYSTIMER without ETM
#define ESP_ROM_HAS_HEAP_TLSF (1) // ROM has the implementation of the tlsf and multi-heap library #define ESP_ROM_HAS_HEAP_TLSF (1) // ROM has the implementation of the tlsf and multi-heap library
#define ESP_ROM_TLSF_CHECK_PATCH (1) // ROM does not contain the patch of tlsf_check_pool() #define ESP_ROM_TLSF_CHECK_PATCH (1) // ROM does not contain the patch of tlsf_check_pool()
#define ESP_ROM_MULTI_HEAP_WALK_PATCH (1) // ROM does not contain the patch of multi_heap_walk() #define ESP_ROM_MULTI_HEAP_WALK_PATCH (1) // ROM does not contain the patch of multi_heap_walk()

View File

@@ -9,8 +9,11 @@
***************************************/ ***************************************/
/* Functions */ /* Functions */
systimer_hal_init = 0x400003d0;
systimer_hal_deinit = 0x400003d4; /* The following ROM functions are commented out because they're patched in the esp_rom_systimer.c */
/* systimer_hal_init = 0x400003d0; */
/* systimer_hal_deinit = 0x400003d4; */
systimer_hal_set_tick_rate_ops = 0x400003d8; systimer_hal_set_tick_rate_ops = 0x400003d8;
systimer_hal_get_counter_value = 0x400003dc; systimer_hal_get_counter_value = 0x400003dc;
systimer_hal_get_time = 0x400003e0; systimer_hal_get_time = 0x400003e0;

View File

@@ -35,6 +35,10 @@ config ESP_ROM_HAS_HAL_SYSTIMER
bool bool
default y default y
config ESP_ROM_SYSTIMER_INIT_PATCH
bool
default y
config ESP_ROM_HAS_HEAP_TLSF config ESP_ROM_HAS_HEAP_TLSF
bool bool
default y default y

View File

@@ -14,6 +14,7 @@
#define ESP_ROM_GET_CLK_FREQ (1) // Get clk frequency with rom function `ets_get_cpu_frequency` #define ESP_ROM_GET_CLK_FREQ (1) // Get clk frequency with rom function `ets_get_cpu_frequency`
#define ESP_ROM_HAS_HAL_WDT (1) // ROM has the implementation of Watchdog HAL driver #define ESP_ROM_HAS_HAL_WDT (1) // ROM has the implementation of Watchdog HAL driver
#define ESP_ROM_HAS_HAL_SYSTIMER (1) // ROM has the implementation of Systimer HAL driver #define ESP_ROM_HAS_HAL_SYSTIMER (1) // ROM has the implementation of Systimer HAL driver
#define ESP_ROM_SYSTIMER_INIT_PATCH (1) // ROM version initializes SYSTIMER without ETM
#define ESP_ROM_HAS_HEAP_TLSF (1) // ROM has the implementation of the tlsf and multi-heap library #define ESP_ROM_HAS_HEAP_TLSF (1) // ROM has the implementation of the tlsf and multi-heap library
#define ESP_ROM_TLSF_CHECK_PATCH (1) // ROM does not contain the patch of tlsf_check_pool() #define ESP_ROM_TLSF_CHECK_PATCH (1) // ROM does not contain the patch of tlsf_check_pool()
#define ESP_ROM_MULTI_HEAP_WALK_PATCH (1) // ROM does not contain the patch of multi_heap_walk() #define ESP_ROM_MULTI_HEAP_WALK_PATCH (1) // ROM does not contain the patch of multi_heap_walk()

View File

@@ -35,6 +35,10 @@ config ESP_ROM_HAS_HAL_SYSTIMER
bool bool
default y default y
config ESP_ROM_SYSTIMER_INIT_PATCH
bool
default y
config ESP_ROM_HAS_HEAP_TLSF config ESP_ROM_HAS_HEAP_TLSF
bool bool
default y default y

View File

@@ -14,6 +14,7 @@
#define ESP_ROM_GET_CLK_FREQ (1) // Get clk frequency with rom function `ets_get_cpu_frequency` #define ESP_ROM_GET_CLK_FREQ (1) // Get clk frequency with rom function `ets_get_cpu_frequency`
#define ESP_ROM_HAS_HAL_WDT (1) // ROM has the implementation of Watchdog HAL driver #define ESP_ROM_HAS_HAL_WDT (1) // ROM has the implementation of Watchdog HAL driver
#define ESP_ROM_HAS_HAL_SYSTIMER (1) // ROM has the implementation of Systimer HAL driver #define ESP_ROM_HAS_HAL_SYSTIMER (1) // ROM has the implementation of Systimer HAL driver
#define ESP_ROM_SYSTIMER_INIT_PATCH (1) // ROM version initializes SYSTIMER without ETM
#define ESP_ROM_HAS_HEAP_TLSF (1) // ROM has the implementation of the tlsf and multi-heap library #define ESP_ROM_HAS_HEAP_TLSF (1) // ROM has the implementation of the tlsf and multi-heap library
#define ESP_ROM_MULTI_HEAP_WALK_PATCH (1) // ROM does not contain the patch of multi_heap_walk() #define ESP_ROM_MULTI_HEAP_WALK_PATCH (1) // ROM does not contain the patch of multi_heap_walk()
#define ESP_ROM_HAS_LAYOUT_TABLE (1) // ROM has the layout table #define ESP_ROM_HAS_LAYOUT_TABLE (1) // ROM has the layout table

View File

@@ -35,6 +35,10 @@ config ESP_ROM_HAS_HAL_SYSTIMER
bool bool
default y default y
config ESP_ROM_SYSTIMER_INIT_PATCH
bool
default y
config ESP_ROM_HAS_HEAP_TLSF config ESP_ROM_HAS_HEAP_TLSF
bool bool
default y default y

View File

@@ -14,6 +14,7 @@
#define ESP_ROM_GET_CLK_FREQ (1) // Get clk frequency with rom function `ets_get_cpu_frequency` #define ESP_ROM_GET_CLK_FREQ (1) // Get clk frequency with rom function `ets_get_cpu_frequency`
#define ESP_ROM_HAS_HAL_WDT (1) // ROM has the implementation of Watchdog HAL driver #define ESP_ROM_HAS_HAL_WDT (1) // ROM has the implementation of Watchdog HAL driver
#define ESP_ROM_HAS_HAL_SYSTIMER (1) // ROM has the implementation of Systimer HAL driver #define ESP_ROM_HAS_HAL_SYSTIMER (1) // ROM has the implementation of Systimer HAL driver
#define ESP_ROM_SYSTIMER_INIT_PATCH (1) // ROM version initializes SYSTIMER without ETM
#define ESP_ROM_HAS_HEAP_TLSF (1) // ROM has the implementation of the tlsf and multi-heap library #define ESP_ROM_HAS_HEAP_TLSF (1) // ROM has the implementation of the tlsf and multi-heap library
#define ESP_ROM_MULTI_HEAP_WALK_PATCH (1) // ROM does not contain the patch of multi_heap_walk() #define ESP_ROM_MULTI_HEAP_WALK_PATCH (1) // ROM does not contain the patch of multi_heap_walk()
#define ESP_ROM_HAS_LAYOUT_TABLE (1) // ROM has the layout table #define ESP_ROM_HAS_LAYOUT_TABLE (1) // ROM has the layout table

View File

@@ -43,6 +43,10 @@ config ESP_ROM_HAS_HAL_SYSTIMER
bool bool
default y default y
config ESP_ROM_SYSTIMER_INIT_PATCH
bool
default y
config ESP_ROM_HAS_LAYOUT_TABLE config ESP_ROM_HAS_LAYOUT_TABLE
bool bool
default y default y

View File

@@ -16,6 +16,7 @@
#define ESP_ROM_HAS_RVFPLIB (1) // ROM has the rvfplib #define ESP_ROM_HAS_RVFPLIB (1) // ROM has the rvfplib
#define ESP_ROM_HAS_HAL_WDT (1) // ROM has the implementation of Watchdog HAL driver #define ESP_ROM_HAS_HAL_WDT (1) // ROM has the implementation of Watchdog HAL driver
#define ESP_ROM_HAS_HAL_SYSTIMER (1) // ROM has the implementation of Systimer HAL driver #define ESP_ROM_HAS_HAL_SYSTIMER (1) // ROM has the implementation of Systimer HAL driver
#define ESP_ROM_SYSTIMER_INIT_PATCH (1) // ROM version initializes SYSTIMER without ETM
#define ESP_ROM_HAS_LAYOUT_TABLE (1) // ROM has the layout table #define ESP_ROM_HAS_LAYOUT_TABLE (1) // ROM has the layout table
#define ESP_ROM_WDT_INIT_PATCH (1) // ROM version does not configure the clock #define ESP_ROM_WDT_INIT_PATCH (1) // ROM version does not configure the clock
#define ESP_ROM_HAS_LP_ROM (1) // ROM also has a LP ROM placed in LP memory #define ESP_ROM_HAS_LP_ROM (1) // ROM also has a LP ROM placed in LP memory

View File

@@ -6,6 +6,7 @@
#include "sdkconfig.h" #include "sdkconfig.h"
#include <stddef.h> #include <stddef.h>
#include "esp_rom_caps.h"
#include "hal/systimer_hal.h" #include "hal/systimer_hal.h"
#include "hal/systimer_ll.h" #include "hal/systimer_ll.h"
@@ -64,7 +65,7 @@ void systimer_hal_counter_value_advance(systimer_hal_context_t *hal, uint32_t co
} }
#endif // CONFIG_IDF_TARGET_ESP32C2 && (CONFIG_ESP32C2_REV_MIN_FULL < 200) #endif // CONFIG_IDF_TARGET_ESP32C2 && (CONFIG_ESP32C2_REV_MIN_FULL < 200)
#if CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32H2 || CONFIG_IDF_TARGET_ESP32P4 || CONFIG_IDF_TARGET_ESP32C5 || CONFIG_IDF_TARGET_ESP32H21 || CONFIG_IDF_TARGET_ESP32H4 #if ESP_ROM_SYSTIMER_INIT_PATCH
void systimer_hal_init(systimer_hal_context_t *hal) void systimer_hal_init(systimer_hal_context_t *hal)
{ {
hal->dev = &SYSTIMER; hal->dev = &SYSTIMER;
@@ -78,6 +79,6 @@ void systimer_hal_deinit(systimer_hal_context_t *hal)
systimer_ll_enable_clock(hal->dev, false); systimer_ll_enable_clock(hal->dev, false);
hal->dev = NULL; hal->dev = NULL;
} }
#endif // CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32H2 || CONFIG_IDF_TARGET_ESP32P4 || CONFIG_IDF_TARGET_ESP32C5 || CONFIG_IDF_TARGET_ESP32H21 || CONFIG_IDF_TARGET_ESP32H4 #endif // ESP_ROM_SYSTIMER_INIT_PATCH
#endif // CONFIG_HAL_SYSTIMER_USE_ROM_IMPL #endif // CONFIG_HAL_SYSTIMER_USE_ROM_IMPL