Skip to content

Commit 518aad2

Browse files
committed
debugging: Run firmware without bootloader
When debugging firmware it is easier to skip the bootloader altogether and go straight to firmware code. Since VTOR is reset on core reset we need to manually set the PC and SP registers. Issuing a reset will simply try to boot from address 0 again.
1 parent d1ebf2c commit 518aad2

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

scripts/jlink.gdb

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,13 @@ load
77
# Reset the CPU
88
monitor reset
99

10+
# Set VTOR (Vector Table Offset Register) to where the firmware is located
11+
set *(uint32_t*)0xE000ED08=0x10000
12+
# Set stack pointer to initial stack pointer according to exception table.
13+
set $sp = *(uint32_t*)0x10000
14+
# Set the program counter to the reset handler (second item in exception table)
15+
set $pc = *(uint32_t*)0x10004
16+
1017
#break Reset_Handler
1118
#break HardFault_Handler
1219
#break NMI_Handler

0 commit comments

Comments
 (0)