Commit Graph

418 Commits

Author SHA1 Message Date
Aditya Patwardhan
a8cc5b94cb Merge branch 'bugfix/crypto_reset_on_exit_v5.1' into 'release/v5.1'
fix(esp_system): reset crypto peripherals before device restart (v5.1)

See merge request espressif/esp-idf!38478
2025-04-28 13:47:10 +08:00
Sudeep Mohanty
6401e1cb24 fix(panic_handler): Prevent race condition in panic handler
This commit updates all RTC WDT contexts to be local instead of global
to avoid race conditions when both cores enter the panic handler
simultaneously.
2025-04-23 12:54:19 +02:00
Mahavir Jain
93e0ccb2ec fix(esp_system): reset crypto peripherals before device restart
This change addresses a rare but critical issue observed on certain
ESP32-C3 and ESP32-S3 devices, where secure boot verification
intermittently fails due to improper cleanup of crypto peripherals
during a restart.

Background – Restart Behavior in IDF
------------------------------------
In ESP-IDF, when the device restarts (via `esp_restart()` or due to a
panic/exception), a partial peripheral reset is performed followed by a
CPU reset. However, until now, crypto-related peripherals were not
included in this selective reset sequence.

Problem Scenario
----------------
If a restart occurs while the application is in the middle of a bignum
operation (i.e., using the MPI/Bignum peripheral), the ROM code may
encounter an inconsistent peripheral state during the subsequent boot.
This leads to transient RSA-PSS secure boot verification failures.

Following such a failure, the ROM typically triggers a full-chip reset
via the watchdog timer (WDT). This full reset clears the crypto
peripheral state, allowing secure boot verification to succeed on the
next boot.

Risk with Aggressive Revocation
-------------------------------
If secure boot aggressive revocation is enabled (disabled by default in
IDF), this transient verification failure could mistakenly lead to
revocation of the secure boot digest.

If your product configuration has aggressive revocation enabled,
applying this fix is strongly recommended.

Frequency of Occurrence
-----------------------
The issue is rare and only occurs in corner cases involving
simultaneous use of the MPI peripheral and an immediate CPU reset.

Fix
---
This fix ensures that all crypto peripherals are explicitly reset prior
to any software-triggered restart (including panic scenarios),
guaranteeing a clean peripheral state for the next boot and preventing
incorrect secure boot behavior.
2025-04-16 20:42:14 +08:00
wuzhenghui
774548e0fe fix(esp_hw_support): fix unused OSC source deinit breaks XTAL32K configuration 2025-04-16 15:06:06 +08:00
wuzhenghui
c6731c0d53 fix(esp_hw_support): fix current leakage if ext32k slow clock source not exists 2025-04-16 15:05:57 +08:00
Marius Vikhammer
4aa92562ba Merge branch 'bug/xtensa_cpu1_sys_lockup_v5.1' into 'release/v5.1'
fix(panic_handler): Updated panic handler to use RTC WDT (v5.1)

See merge request espressif/esp-idf!37123
2025-03-12 10:00:36 +08:00
wuzhenghui
63c8fc4575 fix(esp_system): fix possible cache_error by another core accessing flash in esp_restart 2025-03-07 20:29:46 +08:00
Sudeep Mohanty
2bba3944c2 fix(panic_handler): Updated panic handler to use RTC WDT
This commit updates the following:
- Updates the panic handler to use only the RTC WDT to reset the system.
- Refactors some of the panic handler code.
- Updates Bluetooth files where in they now feed the WDTs instead of
  reconfiguring them.
- Removes some unnecessary configuration of WDTs from various files.
- Added a unit test to verify that the system does not lock up when the
  panic handler is stuck.
- Updates the memprot unit tests to work with the refactored panic
  handler.

Closes https://github.com/espressif/esp-idf/issues/15166
Closes https://github.com/espressif/esp-idf/issues/15018
Closes https://github.com/espressif/esp-idf/issues/10110
2025-03-06 09:10:09 +01:00
Laukik Hase
3fc637c9cc fix(esp_system): Skip populating and checking the image header for pure RAM apps 2025-02-14 16:24:40 +05:30
Aditya Patwardhan
17836ba0f3 fix(security): Fixed the force constant time ecc mode
A regression was added through !36587 in which
    the force constant time ecc mode was not added appropriately
    The option gave compile time errors when enabled.
2025-02-10 21:19:38 +05:30
Aditya Patwardhan
09ded7787f fix(hal): Make the ECDSA countermeasure dynamically applicable
This commit makes the ECDSA countermeasure dynamically applicable
    across different revisions of the ESP32H2 SoC.
2025-01-24 09:13:24 +05:30
Mahavir Jain
58e5f48368 feat(ecc): enable ECC constant time mode for ESP32-H2 ECO5 2025-01-23 22:10:21 +05:30
laokaiyao
39279e589d refactor(lpperi): improve compatibility solution 2025-01-15 17:16:19 +08:00
laokaiyao
dce7c47e72 refactor(lpperi): compatible refactor for H2 ECO5 2025-01-15 11:49:42 +08:00
Song Ruo Jing
9026c0905e fix(clk): add an inevitable kconfig option to be selected to use rc32k 2024-12-25 20:08:56 +08:00
Armando
218947014c fix(cache): fixed cache hal ctx not initialised in app issue 2024-12-20 10:35:11 +08:00
wuzhenghui
88e3e21a9f fix(esp_system): deselect all modem modules clk source selection before clk init 2024-11-15 11:05:21 +08:00
Jiang Jiang Jian
3a24b91c8e Merge branch 'fix/fix_ota_slowclock_switching_v5.1' into 'release/v5.1'
fix(esp_hw_support): fix rtc slow clock missing after the OTA app changes the slow clock source (v5.1)

See merge request espressif/esp-idf!34471
2024-11-12 19:26:09 +08:00
Laukik Hase
8dee18faae fix(esp_system): Correct address used to fetch application image header 2024-11-04 14:12:25 +05:30
wuzhenghui
b6076491ee fix(esp_hw_support): disable unused clock sources after rtc clock switching complete 2024-10-28 19:59:15 +08:00
Jiang Jiang Jian
a13ab34101 Merge branch 'refactor/rtc_init_before_mspi_tuning_v5.1' into 'release/v5.1'
fix(startup): move rtc initialization before MSPI timing tuning to improve stability (v5.1)

See merge request espressif/esp-idf!32555
2024-09-21 15:01:16 +08:00
Xiao Xufeng
7d4d6ae5fd fix(MMU): fixed mmap deadlock when using multicore app with unicore bootloader
Closes https://github.com/espressif/esp-idf/issues/11617
2024-09-18 19:31:33 +08:00
Xiao Xufeng
dbed93dce8 fix(startup): move rtc initialization before MSPI timing tuning to improve stability 2024-09-18 19:30:22 +08:00
wuzhenghui
563683f471 change(esp_system): trigger digital system reset in brownout isr 2024-06-24 12:07:30 +08:00
morris
d7c75b92d1 Merge branch 'bugfix/check_c3_efuse_error_on_ram_app_condition_v5.1' into 'release/v5.1'
bugfix(cpu_start): check c3 efuse error log on ram app condition (v5.1)

See merge request espressif/esp-idf!31046
2024-05-27 15:43:21 +08:00
Armando
bb51330aa6 bugfix(cpu_start): check c3 efuse error log on ram app condition
Prior to this commit, esp_efuse_check_errors() is only called when it's
2nd stage btld app.

This commit moves this error check so under all conditions (including
ram app, pure ram app) will check this efuse error
2024-05-23 15:56:08 +08:00
Marius Vikhammer
39074c031e fix(brownout): fixed brownout isr crashing if cache disabled
If a brownout ISR was triggered while cache was disabled the system would panic.

This was due to a print accessing a string stored in flash
2024-05-22 10:19:10 +08:00
wuzhenghui
6e1659c233 fix(esp_system): increase 26Mhz esp32c2 slow clock calibration timeout watchdog threshold 2024-04-30 11:47:18 +08:00
liuning
cb0fd9010b fix(clk): clear all lpclk source at clk init 2024-03-15 10:49:18 +08:00
Jiang Jiang Jian
ffd34ba04a Merge branch 'bugfix/bod_threshold_v5.1' into 'release/v5.1'
fix(bod): Fix BOD threshold value on ESP32H2(backport v5.1)

See merge request espressif/esp-idf!28624
2024-02-27 19:58:51 +08:00
Marius Vikhammer
d9a6158700 fix(system): update reset reasons for C6 and H2 2024-02-22 12:36:09 +08:00
Cao Sen Miao
bba56bc016 fix(bod): Fix BOD threshold value on ESP32H2 2024-01-23 10:13:33 +08:00
Xiao Xufeng
a055fcbda4 fix(rtc): fixed bbpll not calibrated from bootloader issue 2024-01-05 10:19:20 +08:00
morris
1b78d57496 Merge branch 'bugfix/bod_reset_c6_h2_v5.1' into 'release/v5.1'
fix(bod): Reset brownout in configuration to avoid RF cannot be enabled again(backport v5.1)

See merge request espressif/esp-idf!27723
2023-12-14 11:05:55 +08:00
wuzhenghui
4a7d9dd387 fix(esp_hw_support): re-initialize icg map in modem_clock_module_enable 2023-12-08 14:22:36 +08:00
Cao Sen Miao
9dd90e2d9b fix(bod): Reset brownout in configuration to avoid RF cannot be enabled again 2023-12-07 10:33:58 +08:00
Ivan Grokhotkov
6ec4937cec esp_system: usb_console support for ESP32-S3
Closes https://github.com/espressif/esp-idf/issues/8879
Closes https://github.com/espressif/esp-idf/issues/8738
2023-11-21 17:33:30 +01:00
Ivan Grokhotkov
6d1f573945 esp_rom: implement usb deinit functions added in S3 ROM for S2
This cleans up usb_console.c and prepares it for S3 support.
2023-11-21 17:33:29 +01:00
Ivan Grokhotkov
228dbe103f esp_rom: add USB_OTG "port" number for S2 and S3 2023-11-21 17:33:29 +01:00
wuzhenghui
b31a07bc67 fix(esp_system): increase esp32h2 slow clock calibration timeout watchdog threshold 2023-11-03 19:03:48 +08:00
Shen Weilong
ea06b047c2 feat(bt): Frees BLE memory when no longer in use
It will free libble.a & libbt all txt, data and bss segment memory.
          This memory is combined into one large memory and put into the heap
          pool.
2023-10-19 14:52:29 +08:00
Lou Tianhao
8aaa256aa9 Power Management: support RC32K or Crystal32K powered down 2023-07-11 14:52:35 +08:00
Lou Tianhao
356fa3ab4b Power Management: support DFS and PMU feature for esp32h2 2023-07-11 12:02:39 +08:00
laokaiyao
e90a2d50c4 adc_cali: supported channel compensation of adc calibration on esp32c6 2023-07-05 12:48:11 +08:00
Paul Guyot
ee7554c1c4 esp_system: Fix a race-condition in esp_ipc_isr (in QEMU env)
The race condition is very unlikely on real hardware but can be observed with
qemu under heavy load.
Also add missing `memw` instructions which are generated by the C compiler but
absent in the assembly code.

Signed-off-by: Paul Guyot <pguyot@kallisys.net>
Signed-off-by: KonstantinKondrashov <konstantin@espressif.com>

Merges https://github.com/espressif/esp-idf/pull/11447
Closes https://github.com/espressif/esp-idf/issues/11433
2023-06-13 08:10:00 +00:00
Jakob Hasse
a6cbf68991 compiler: replaced noreturn by __noreturn__ in header files
* noreturn may be replaced by third-party macros,
  rendering it ineffective

* Closes https://github.com/espressif/esp-idf/issues/11339
2023-05-18 12:49:40 +08:00
Marius Vikhammer
e0b91b748e esp-system: fixed int WDT reset reason being reported as task WDT on C2 2023-05-16 05:22:07 +00:00
morris
236d601e98 mcpwm: reset peripheral in restart, panic and halt
mcpwm is commonly used in power eletronic area, when restart happens,
make sure the mcpwm generator is not working.

closes https://github.com/espressif/esp-idf/issues/11324
2023-05-09 18:30:46 +08:00
laokaiyao
954a6a2cff esp32h4: removed esp32h4 related codes 2023-04-26 18:53:12 +08:00
laokaiyao
cae47ce37e esp32h4: removed esp32h4 related files 2023-04-26 18:53:12 +08:00