Commit Graph

106 Commits

Author SHA1 Message Date
Marius Vikhammer 4ab44312d4 fix(esp_timer): enable systimer functional clock on ESP32-S31
ESP32-S31 has a separate functional clock gate for the systimer
(reg_systimer_clk_en in HP_SYS_CLKRST) that defaults to off. Without
it, the counter snapshot never completes, hanging execution inside
esp_timer_init_nonos.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-03-18 11:08:40 +08:00
Chen Chen eeb24057c4 refactor(hal): graduate systimer hal driver into esp_hal_systimer 2026-02-06 18:08:57 +08:00
Konstantin Kondrashov 8569da1ba8 feat(esp_timer): Adds blocking stop function 2026-01-07 09:26:57 +02:00
Konstantin Kondrashov 3e74ff2b33 refactor(esp_timer): Remove unnecessary nested list lock 2026-01-06 21:52:53 +02:00
Konstantin Kondrashov 0255a7e164 feat(esp_timer): esp_timer_is_active while callback is running 2026-01-06 21:52:53 +02:00
Huelsenfrucht b3ccc1316d feat(esp_timer): Support absolute timing APIs
Merges https://github.com/espressif/esp-idf/pull/17807
2025-12-09 11:05:40 +02:00
morris aa1fd9c611 refactor: avoid function calls inside MIN/MAX macros 2025-11-17 22:17:54 +08:00
morris 71cb24caab feat(timg): graduate the hal driver into a single component 2025-09-27 17:33:10 +08:00
Marius Vikhammer 88c9af78a7 Merge branch 'change/allow_esp_timer_init_from_user_code' into 'master'
change(esp_timer): esp_timer_init_os now returns ESP_OK if esp_timer already initialized

Closes IDFGH-8182

See merge request espressif/esp-idf!42069
2025-09-25 10:23:11 +08:00
Marius Vikhammer 16cdbd9f5c change(esp_timer): esp_timer_init_os now returns ESP_OK if already initialized
Previously it would return ESP_ERR_INVALID_STATE, which meant that if called from
user-code before the system tries to initialize the timer then esp-idf would
fail to boot.

This could happen if a user wanted to use esp-timer from a cpp constructor.

Closes https://github.com/espressif/esp-idf/issues/9679
2025-09-22 14:01:56 +08:00
Konstantin Kondrashov dcf486359e feat(log): Optimize log tag init for bin logging 2025-09-15 15:59:52 +03:00
Marius Vikhammer b0b76f3792 fix(esp_timer): fixed potential buffer overflow with esp_timer_dump()
esp_timer_dump could overflow when dumping a large amount of timers

Closes https://github.com/espressif/esp-idf/issues/17008
2025-08-14 20:01:55 +08:00
wuzhenghui f861b7dd65 fix(esp_hw_support): config lact in critical 2025-06-13 20:38:46 +08:00
wuzhenghui 022614b1d3 fix(esp_hw_support): update systimer step immediately when XTAL changes on esp32s2 2025-05-22 13:58:54 +08:00
wuzhenghui 2931aa23b6 fix(esp_hw_support): update LACT clock prescale immediately when APB changes on esp32 2025-05-22 13:58:50 +08:00
Marius Vikhammer 55be8bdc0d feat(esp_timer): added kconfig option for placing IRAM code into flash 2025-03-18 15:23:43 +08:00
Marius Vikhammer 34c7d62855 refactor(hw_support): combine esp_hw_support rtc header to a single file 2024-12-30 10:09:34 +08:00
gaoxu b240defc75 feat(esp32h21): support esp_system, esp_timer and freertos (stage5) 2024-12-20 22:43:10 +08:00
wanckl 2f9456bf51 fix(esp_timer): fix isr safe when CONFIG_FREERTOS_USE_TICKLESS_IDLE and PM_ENABLE 2024-10-24 12:47:38 +08:00
Konstantin Kondrashov 3081a4ea49 feat(esp_timer): Updates systimer and esp_timer 2024-09-12 14:26:37 +08:00
Alexey Lapshin ed6e497c6f feat(build): add COMPILER_STATIC_ANALYZER option 2024-06-18 14:25:37 +08:00
Konstantin Kondrashov a800fcb47e fix(esp_timer): Fix Coverity issue - logically dead code in esp_timer_impl_early_init 2024-05-22 11:20:08 +03:00
wuzhenghui ad54af74d6 change(esp_hw_support/sleep): improve esp32c3 systimer stall bug workaround 2024-05-13 15:07:40 +08:00
wanlei a611e91b2f feat(esp32c61): new chip add system and esp_timer support 2024-03-21 11:31:15 +08:00
Konstantin Kondrashov 1253ab6e27 Merge branch 'feature/move_esp_timer_related_inits_into_component' into 'master'
feat(esp_timer): Move esp_timer-related init steps into the component

Closes IDF-8755

See merge request espressif/esp-idf!28664
2024-02-20 16:49:31 +08:00
Konstantin Kondrashov 49ba674fb5 feat(esp_timer): Move esp_timer-related init steps into the component 2024-02-19 19:21:40 +08:00
fl0wl0w 90d1dcfd76 feat(freertos): Introduced new Kconfig option CONFIG_FREERTOS_NUMBER_OF_CORES
This commit replaces the use of portNUM_PROCESSORS and configNUM_CORES
macros in all of ESP-IDF. These macros are needed to realize an SMP
scenario by fetching the number of active cores FreeRTOS is running on.
Instead, a new Kconfig option, CONFIG_FREERTOS_NUMBER_OF_CORES, has been
added as a proxy for the FreeRTOS config option, configNUMBER_OF_CORES.
This new commit is now used to realize an SMP scenario in various places
in ESP-IDF.

[Sudeep Mohanty: Added new Kconfig option CONFIG_FREERTOS_NUMBER_OF_CORES]

Signed-off-by: Sudeep Mohanty <sudeep.mohanty@espressif.com>
2024-02-09 09:11:28 +01:00
Marius Vikhammer 77dcb6d46e refactor(system): reformated esp_timer, linux and log comp with astyle 2024-02-04 14:50:54 +08:00
laokaiyao a48f4760d2 feat(esp32c5): add system related supports 2024-01-02 11:17:11 +08:00
morris e96491fb1f feat(systimer): support ETM on esp32p4 2023-12-07 18:46:24 +08:00
Ivan Grokhotkov 6046b396ac fix(esp_timer): avoid signed integer overflow in ESP_SYSTEM_INIT_FN
CONFIG_ESP_TIMER_ISR_AFFINITY can be equal to -1, whereas
ESP_SYSTEM_INIT_FN takes an uint16_t argument. To avoid overflow,
move the choice of init mask into source code and set the value
explicitly.
2023-11-27 10:20:51 +01:00
Ivan Grokhotkov 75c92c3a66 refactor(startup): implement registration of core init functions
Similar to how the secondary init functions were already registered
via ESP_SYSTEM_INIT_FN, do the same for the core init functions.
This MR doesn't actually move the init functions into respective
components yet. This has to be carefully done in follow-up MRs.
2023-11-27 10:20:51 +01:00
Konstantin Kondrashov cbdb799b6f feat(esp_timer): Support systimer for ESP32P4 2023-09-13 19:13:38 +08:00
morris 71cf16ec01 feat(gptimer): use RCC atomic block to enable/reset peripheral 2023-08-22 17:05:35 +08:00
Armando 211c3c0e05 feat(esp_timer): added esp_timer p4 base support 2023-07-25 05:59:10 +00:00
KonstantinKondrashov 5693e0188b refactor(esp_timer): Remove duplicate code and move it to a common file 2023-07-13 15:51:55 +08:00
Alan Fisher bfcad8d8a2 fix(esp_timer): Fix delay in ISR dispatch callbacks
Set the following alarm before calling the alarm handler.

Closes https://github.com/espressif/esp-idf/pull/11637
Closes https://github.com/espressif/esp-idf/issues/11636
2023-07-12 16:30:45 +08:00
Ivan Grokhotkov 500b5b2103 Merge branch 'contrib/github_pr_11215' into 'master'
improve thread safety in esp_timer (GitHub PR)

Closes IDFGH-9920

See merge request espressif/esp-idf!23295
2023-05-03 02:21:07 +08:00
laokaiyao bf2a7b2df6 esp32h4: removed esp32h4 related codes 2023-04-23 12:03:07 +00:00
Jens Gutermuth 3ba70490c9 improve thread safety in esp_timer
Inadequate locking in the esp_timer component allowed corruption
of the s_timers linked list:

1. timer_armed(timer) returns false
2. another task arms the timer and adds it to s_timers
3. the list is locked
4. the timer is inserted into s_timers again

The last step results in a loop in the s_timers list, which causes
an infinite loop when iterated. This change always locks the
list before checking if the timer is already armed avoiding
the data race.
2023-04-19 16:59:43 +02:00
KonstantinKondrashov 91fcced0fb esp_timer: Adds IRAM_ATTR for esp_timer_restart and esp_timer_is_active
Closes https://github.com/espressif/esp-idf/issues/10522
Closes https://github.com/espressif/esp-idf/issues/10859
2023-04-19 17:42:38 +08:00
KonstantinKondrashov 449e4bcae7 esp_timer: Adds AFFINITY options for task and ISR
These new settings allow you to balance the load on cores.
Closes: https://github.com/espressif/esp-idf/issues/10457
2023-03-02 20:08:02 +08:00
morris 6c1d98d556 systimer: assign counter and alarm in esp_hw_support 2023-01-10 17:05:49 +08:00
Cao Sen Miao 8cc9260f86 ESP32H2: Add system support for ESP32H2 2022-12-07 11:38:51 +08:00
morris 560ea9b754 systimer: support etm event 2022-11-23 15:32:34 +08:00
KonstantinKondrashov 54b06ecb62 esp_timer: Fix the stop alarm triggering when the timer list is empty
Related to ESP32-C6 chip only because this chip can power down the digital domain
during the light sleep. And after wakes up, systimer gets resumed,
and the alarm value < count value, so it leads the alarm fired immediately.
We get one unnecessary interrupt at light sleep exit time.

Other chips do not power down the digital domain related to systimer.
2022-11-17 14:32:16 +00:00
laokaiyao 8677216576 esp32h2: renaming esp32h2 to esp32h4 2022-11-08 17:05:33 +08:00
Omar Chebib c8614a0dbf esp_timer: add a function to restart timer
Timers, periodic or not, can now be restarted thanks to esp_timer_restart function.
This is done atomically, which can be used to feed a periodic timer, or simply change the period.
2022-10-18 04:42:27 +00:00
Omar Chebib 53c7dd4efc WDT: implement interrupt wdt and task wdt for ESP32-C2
ESP32-C2 has a single group timer, thus it will use it for the interrupt watchdog,
which is more critical than the task watchdog. The latter is implement in
software thanks to the `esp_timer`component.
2022-09-15 14:37:59 +08:00
wuzhenghui 308e4dcbfa esp32c6: add esp_timer support 2022-09-06 09:13:20 +00:00