Debugging an STM32L152RE with Sleep causes exception in Code, but , running code after removing the emulator and power cycling functions correctly
I have a strange problem, I have ported the MBED-OS blinkly program to the IDE (this was a relatively painless process) , which sends the device to sleep between flashes. When I download and run the program with the emulator (I have tried blink, stink V2 and V3) it gets a hard memory fault. If I however power cycle the board removing the emulator. It works correctly.
I have enabled the debug core of the ST device
HAL_EnableDBGStandbyMode() ; // Enable Debugger in Standby Mode
HAL_EnableDBGSleepMode() ; // Enable Debugger in Sleep Mode
HAL_EnableDBGStopMode(); // Enable Debugger in Stop Mode
If I build exactly the same code on GNU Arm Eclipse it functions with the debugger.
However I need to be able to debug Mbed projects in STM32cubeide as it is a requirement of my customer that I develop using this platform (it is a great platform )
Note that if I disable the sleep function in the code, it all works perfectly with the debugger.
Has anybody seen a problem like this or has a suggestion what I can do get the emulator to function I would be extremely grateful.
Thanks in advance for any help provided
David