mirror of
https://github.com/apache/nuttx.git
synced 2026-10-08 06:45:19 +00:00
A bootloader may hand over with the ICACHE enabled, and nothing waits for the invalidate that runs when the ICACHE is disabled. The driver also polled BUSYF without a bound, so a stuck flag would hang the boot, and it ignored an invalidate that never finished. - stm32_enable_icache(): on first use, disable and invalidate the ICACHE before the associativity and region registers are written (they are only writable while EN=0), and wait for any pending invalidate before enabling it (RM0481 8.4.5). - stm32_disable_icache(): wait for the invalidate that EN=0 starts and clear BSYENDF and ERRF. - Bound every BUSYF wait with STM32_ICACHE_BUSY_TIMEOUT. RM0481 gives no invalidate duration, so the value is a margin, not a measured limit. - stm32_enable_icache() now returns OK or -ETIMEDOUT instead of void. On a timeout the ICACHE is left disabled: with BUSYF stuck it would not cache anything anyway (RM0481 8.4.5). Existing callers ignore the result and keep working. - __start: when CONFIG_STM32_ICACHE is not set, disable an ICACHE left on by a bootloader, so reads of the OTP and UID cannot fault. On an STM32H563 with the ICACHE left enabled this way, a 16-bit read of the UID raised a precise bus fault and up_progmem_write() failed its read-back check with -EIO. Assisted-by: Claude:claude-sonnet-5-5 Signed-off-by: Ricardo Maurizio Paul <ricardopaul@geotab.com> |
||
|---|---|---|
| .. | ||
| include | ||
| src | ||
| CMakeLists.txt | ||
| Kconfig | ||