2026-01-25 12:14 AM - edited 2026-01-25 3:02 AM
Hello everyone!
I am using stm32n6570-dk. My project has only FSBL and was generated using STM32CubeMX. I was able to run it in debug mode without issues. The code does not execute when flashed to external flash memory. I had to comment out "MX_ICACHE_Init();" for the code to run from external memory.
I thought there may be a configuration issue from my side. So I ran the "Starter project" provided by STM located at "STM32CubeN6\Projects\STM32N6570-DK\Templates_Board". This code also runs fine in debug mode. It does not work when flashed to external memory without commenting out "MX_ICACHE_Init();".
I expect the example code to work without modifications.
I figured out that the program does not reach the error handler and gets stuck in HAL_ICACHE_ConfigAssociativityMode(). This is when flashed to external memory.
if (HAL_ICACHE_ConfigAssociativityMode(ICACHE_1WAY) != HAL_OK)
{
Error_Handler();
}
Within HAL_ICACHE_ConfigAssociativityMode() it gets stuck in READ_BIT(ICACHE->CR, ICACHE_CR_EN)
In debug mode I tried executing
uint32_t HAL_ICACHE_IsEnabled(void)
{
return ((READ_BIT(ICACHE->CR, ICACHE_CR_EN) != 0U) ? 1UL : 0UL);
}
after which the program stops responding.
I tried
if (HAL_ICACHE_Invalidate() != HAL_OK)
{
Error_Handler();
}
inside MX_ICACHE_Init which does not help. This is when flashed to external memory.
The program does not reach the Error_Handler() and stops at HAL_ICACHE_Invalidate().
My plan is to first get the ICache working on the example code, then I can apply the same fix to my project.
Any help is appreciated. Thanks!