pikapython/bsp/pico-dev/MDK/mdk/debug_with_cmsis-dap_in_ram.ini
2022-02-07 14:55:27 +08:00

37 lines
1.0 KiB
INI

FUNC void debug_from_ram(void)
{
//extern unsigned int Image$$ARM_LIB_STACK$$ZI$$Limit;
printf("Entry Point: %08x\r\n", Reset_Handler);
printf("Main Stack Pointer: %08x\r\n", Image$$ARM_LIB_STACK$$ZI$$Limit);
/*
typedef struct {
unsigned int ctrl;
unsigned int load;
unsigned int reason;
unsigned int scratch[8];
unsigned int tick;
} watchdog_hw_t;
#define watchdog_hw ((watchdog_hw_t *const)0x40058000)
*/
_WWORD(0x4005801C ,0xb007c0d3); //! scratch 4
_WWORD(0x40058020 ,-0xb007c0d3 ^ (Reset_Handler | 0x01)); //! scratch 5
_WWORD(0x40058024 ,Image$$ARM_LIB_STACK$$ZI$$Limit); //! scratch 6
_WWORD(0x40058028 ,Reset_Handler | 0x01); //! scratch 7
exec("RESET");
//exec("BS main");
//exec("G, Reset_Handler");
exec("G, main");
}
DEFINE BUTTON "Reset Pico", "debug_from_ram()"
debug_from_ram();