cancel
Showing results for 
Search instead for 
Did you mean: 

Why does disabling the data cache in the ExtMem_Boot example corrupt the stack on the STM32F7?

DOsbo
Senior

Hi All,

I'm having trouble understanding a caching problem with the STM32F7. In the ExtMem_Boot example the code calls SCB_DisableDCache() just prior to jumping to the application stored on the external QSPIFlash . However it never returns from that disable function. When I step through it using the openocd/ST-Link debugger I can see it starting the Clean and Invalidate loop. However, after the first (inner) iteration, the stack suddenly becomes corrupt. The corruption includes the local variables controlling the loop (and hence never exiting it).

Here's the strange thing. If I step through the function using a Segger J-Link debugger it works ok. It completes the set/way loop and exits correctly. However, if I step over the function the corruption happens.

I could just not use the cache, but I would like to know why I'm having this trouble in the bootstrap.

I would prefer our customers didn't need to connect a J-Link and step through the code to boot up the device, so any help would be appreciated. 🙂

Cheers

David

0 REPLIES 0