I've been trying to get debugging working with the STLinkV2. I'm not able to step into code whatsoever, when I pause execution it appears t PC is at:
I don't believe the code is executing correctly because this program doesn't flash an LED:
#include "mdk/nrf.h" #include "system_nrf.h" #include "hal/nrf_gpio.h" int main(int argc, char *argv[]) { int pin = 6; nrf_gpio_pin_dir_set(pin, NRF_GPIO_PIN_DIR_OUTPUT); // while(true) { volatile int delay = 1000000; while(delay--); // nrf_gpio_pin_toggle(pin); } return 0; }
I'm using the following cfg script:
source [find interface/stlink.cfg] transport select hla_swd source [find target/nrf52.cfg]
The linker script regions are configured as follows:
MEMORY { FLASH (rx) : ORIGIN = 0x0, LENGTH = 0x30000 RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 0x6000 }
For completeness the log i'm getting with from openOCD is:
Open On-Chip Debugger 0.10.0 (2019-10-29) [https://github.com/sysprogs/openocd] Licensed under GNU GPL v2 libusb1 09e75e98b4d9ea7909e8837b7a3f00dda4589dc3 For bug reports, read http://openocd.org/doc/doxygen/bugs.html Info : The selected transport took over low-level target control. The results might differ compared to plain JTAG/SWD Info : Listening on port 6666 for tcl connections Info : Listening on port 4444 for telnet connections Info : clock speed 1000 kHz Info : STLINK V2J29S7 (API v2) VID:PID 0483:3748 Info : Target voltage: 3.216316 Info : nrf52.cpu: hardware has 6 breakpoints, 4 watchpoints Info : Listening on port 50000 for gdb connections Info : accepting 'gdb' connection on tcp/50000 Info : nRF52810-QFAA(build code: B0) 192kB Flash target halted due to debug-request, current mode: Thread xPSR: 0x01000000 pc: 0xfffffffe msp: 0xfffffffc target halted due to debug-request, current mode: Thread xPSR: 0x01000000 pc: 0xfffffffe msp: 0xfffffffc target halted due to debug-request, current mode: Thread xPSR: 0x01000000 pc: 0xfffffffe msp: 0xfffffffc Info : Flash write discontinued at 0x000082a0, next section at 0x000182a0 Warn : using fast async flash loader. This is currently supported Warn : only with ST-Link and CMSIS-DAP. If you have issues, add Warn : "set WORKAREASIZE 0" before sourcing nrf51.cfg/nrf52.cfg to disable it Warn : using fast async flash loader. This is currently supported Warn : only with ST-Link and CMSIS-DAP. If you have issues, add Warn : "set WORKAREASIZE 0" before sourcing nrf51.cfg/nrf52.cfg to disable it target halted due to debug-request, current mode: Thread xPSR: 0x01000000 pc: 0xfffffffe msp: 0xfffffffc target halted due to debug-request, current mode: Thread xPSR: 0x01000000 pc: 0xfffffffe msp: 0xfffffffc