cancel
Showing results for 
Search instead for 
Did you mean: 

startup script for dual bank debugging

LThal
Associate II

I'm working with the STM32L152RE, which has dual flash banks. Each bank has a binary file image loaded. I'm trying to start the debugger in Bank 1 (0x08000000), have it stop at main() (or some specific address) and debug in assembly. I haven't been able to get the debugger to stop at a known address. I also notice it ends up in Bank 2, which may or may not be from my startup code. Any ideas on how to have the debugger connect, reset and stop? Thanks.

1 REPLY 1

Not super familiar with Atollic's method, I'd image OpenOCD might provide more examples.

Debugger scripts tend to directly poke hardware registers, by address, to configure the chip/board in a desired state. To flip banks you'd likely need to enable clocks for things like SYSCFG in the APBxENR type registers and then write into the SYSCFG registers them selves to do the mappings etc.

My limited familiarity with L15x parts is the banks don't actually swap, so you'd need to build/link the code for the specific address it was going to reside at. The content of the vector table being absolute addresses, and the processor pulling from whatever memory is mapped/shadowed at zero at reset.

ie pulls SP and PC content, and then off to the races. You could perhaps put a BKPT#0 or whatever in the front of the Reset_Handler to push control back to the debugger, and then set the desired PC from there.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..