|
|
@@ -62,9 +62,19 @@ GDB_UPLOAD_ARGS ?= --batch
|
|
|
GDB_UPLOAD_CMDS += -ex "thread apply all monitor reset halt"
|
|
|
# $$pc is for $pc in gdb, but need to do this in makefile
|
|
|
# in command extra '\' is required
|
|
|
-GDB_UPLOAD_CMDS += -ex "thread apply all set \$$pc=_start"
|
|
|
+# please make sure the _start label is provided in your startup code
|
|
|
+# and is the entry of the startup of cpu
|
|
|
+GDB_UPLOAD_CMDS += -ex "thread apply all info reg pc"
|
|
|
GDB_UPLOAD_CMDS += -ex "thread 1"
|
|
|
GDB_UPLOAD_CMDS += -ex "load"
|
|
|
+# make sure pc is set to _start after load
|
|
|
+# when load program to flash, the cpu will do reset init
|
|
|
+# before flash erase and do reset halt after flash write end
|
|
|
+# so we need to manually set pc to _start
|
|
|
+# see https://openocd.org/doc/html/CPU-Configuration.html#Target-Events
|
|
|
+GDB_UPLOAD_CMDS += -ex "thread apply all set \$$pc=_start"
|
|
|
+GDB_UPLOAD_CMDS += -ex "thread apply all info reg pc"
|
|
|
+GDB_UPLOAD_CMDS += -ex "thread 1"
|
|
|
GDB_UPLOAD_CMDS += -ex "monitor resume"
|
|
|
GDB_UPLOAD_CMDS += -ex "quit"
|
|
|
|