I'm trying to debug the led_toggle demo program on a SAM D21 Xplained Pro board. I was able to flash the program and run it just fine - the LED is toggling. Next, I built openocd and tried to attach to the board. Seems successful.
$ openocd -f ./openocd.cfg
Open On-Chip Debugger 0.10.0-dev-00117-ga652a4e (2015-11-21-13:20)
Licensed under GNU GPL v2
For bug reports, read
Info : only one transport option; autoselect 'swd'
adapter speed: 400 kHz
cortex_m reset_config sysresetreq
Info : CMSIS-DAP: SWD Supported
Info : CMSIS-DAP: Interface Initialised (SWD)
Info : CMSIS-DAP: FW Version = 02.01.0157
Info : SWCLK/TCK = 1 SWDIO/TMS = 1 TDI = 1 TDO = 1 nTRST = 0 nRESET = 1
Info : CMSIS-DAP: Interface ready
Info : clock speed 400 kHz
Info : SWD IDCODE 0x0bc11477
Info : at91samd21j18.cpu: hardware has 4 breakpoints, 2 watchpoints
Info : accepting 'gdb' connection on tcp/3333
Info : SAMD MCU: SAMD21J18A (256KB Flash, 32KB RAM)
Then I tried to connect with gdb. I can set breakpoints, but I have not found a way to be able to halt, reset, or restart the program. Can anyone please give me some pointers on how to control a program that is already running from flash?
$ /opt/arm-cortex-gnu-toolchain-linux_x86_64/bin/arm-none-eabi-gdb led_toggle_flash.elf
GNU gdb (GNU Tools for ARM Embedded Processors) 220.127.116.1150604-cvs
Copyright (C) 2014 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "--host=x86_64-linux-gnu --target=arm-none-eabi".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
Find the GDB manual and other documentation resources online at:
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from led_toggle_flash.elf...done.
(gdb) monitor halt reset
"monitor" command not supported by this target.
You can't do that when your target is `exec'