This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Breakpoints not being hit

I'm compiling a custom application using the CMake scripts in the nRF mesh SDK. When I debug the application, even though the debugger is working – I can pause execution – breakpoints are not being hit. I wondered if it is perhaps because the breakpoints are not being set for the correct memory location, but I'm not sure how I could check that.

In addition, when I place a breakpoint, execution is immediately paused (SIGTRAP, but not where I placed the breakpoint), it would be good to know how to prevent this.

Here is the output from JLinkGDBServer when a breakpoint is set on the first line of main():

/usr/local/bin/JLinkGDBServer -device nrf52 -strict -timeout 0 -nogui -if swd -speed 1000 -endian little
SEGGER J-Link GDB Server V6.44h Command Line Version

JLinkARM.dll V6.44h (DLL compiled May  3 2019 17:40:32)

Command line: -device nrf52 -strict -timeout 0 -nogui -if swd -speed 1000 -endian little
-----GDB Server start settings-----
GDBInit file:                  none
GDB Server Listening port:     2331
SWO raw output listening port: 2332
Terminal I/O port:             2333
Accept remote connection:      yes
Generate logfile:              off
Verify download:               off
Init regs on start:            off
Silent mode:                   off
Single run mode:               off
Target connection timeout:     0 ms
------J-Link related settings------
J-Link Host interface:         USB
J-Link script:                 none
J-Link settings file:          none
------Target related settings------
Target device:                 nrf52
Target interface:              SWD
Target interface speed:        1000kHz
Target endian:                 little

Connecting to J-Link...
J-Link is connected.
Error during pretty printers setup: Undefined info command: "pretty-printer".  Try "help info".

Some features and performance optimizations will not be available.

Firmware: J-Link OB-SAM3U128-V2-NordicSemi compiled Jan  7 2019 14:07:15
Hardware: V1.00
S/N: 682644303
Checking target voltage...
Target voltage: 3.30 V
Listening on TCP/IP port 2331
Connecting to target...Connected to target
Waiting for GDB connection...Connected to 127.0.0.1
Reading all registers
Reading 64 bytes @ address 0x00027A80
Read 4 bytes @ address 0x00027BA8 (Data = 0x20004998)
Read 2 bytes @ address 0x00027B8A (Data = 0x4669)
Reading 64 bytes @ address 0x000262C0
Read 4 bytes @ address 0x000262F0 (Data = 0x00045E5C)
Read 2 bytes @ address 0x000262DA (Data = 0x4B05)
Read 4 bytes @ address 0x00029AC2 (Data = 0x3007F89D)
Read 4 bytes @ address 0x00029EA8 (Data = 0xE8BDB004)
Debugger connected to tcp:localhost:2331
Setting breakpoint @ address 0x000262DA, Size = 2, BPHandle = 0x0001
Setting breakpoint @ address 0x00027B8A, Size = 2, BPHandle = 0x0002
Starting target CPU...

Also related, the breakpoint in main is hit when another problem occurs: devzone.nordicsemi.com/.../sigtrap-on-sd_softdevice_enable

I'm wondering if breakpoints are not being hit because they are not being offset by the softdevice length? In the output above a breakpoint is set at 0x000262DA, but the flash start is 0x00026000 and the soft device hex is >400kb.

Parents Reply Children
  • Are there any instructions for using Ozone with Nordic nRF52832?

  • Thanks, I'm having difficulty connecting though.

    File.NewProjectWizard();
    Project.SetDevice ("nRF52832_xxAA");
    Project.SetHostIF ("USB", "");
    Project.SetTargetIF ("JTAG");
    Project.SetTIFSpeed ("1 MHz");
    Project.AddSvdFile ("$(InstallDir)/Config/CPU/Cortex-M4F.svd");
    File path resolved: "$(InstallDir)/Config/CPU/Cortex-M4F.svd" was found at "/Applications/SEGGER/Ozone/Ozone.app/Contents/MacOS/Config/CPU/Cortex-M4F.svd"
    File.Open ("/Users/nick/Documents/Repos/AirTurnFirmwareV2/cmake-build-debug-arm-none-eabi/src/AirTurnFirmwareProject_BT200.elf");
    File.Open: completed in 400 ms
    Debug.Start();
    Device "NRF52832_XXAA" selected.
    TotalIRLen = ?, IRPrint = 0x..000000000000000000000000
    TotalIRLen = ?, IRPrint = 0x..000000000000000000000000
    TotalIRLen = ?, IRPrint = 0x..000000000000000000000000
    TotalIRLen = ?, IRPrint = 0x..000000000000000000000000
    TotalIRLen = ?, IRPrint = 0x..000000000000000000000000
    TotalIRLen = ?, IRPrint = 0x..000000000000000000000000
    TotalIRLen = ?, IRPrint = 0x..000000000000000000000000
    TotalIRLen = ?, IRPrint = 0x..000000000000000000000000
    Connection failed

    I know it recognises the connected nrf52DK as it displays the license warning with the JLink serial number, and I can connect with JLinkExe.

    Edit: Ahh, I was using JTAG instead of SWD.

  • I'm wondering if breakpoints are not being hit because they are not being offset by the softdevice length? In the output above a breakpoint is set at 0x000262DA, but the flash start is 0x00026000 and the soft device hex is >400kb.

     no offset is needed as the breakpoint is set at an absolute address and the debugger is not working with offsets here.  If you look at the .map file, you can see the absolute address space the functions and data are occupying. 

     

    nrbrook said:
    Here's what I get in Ozone when it occurs

    It seems to be a hardfault which is handled inside the softdevice. I am not sure why the hardfault has not been forwarded to the application. Have you happened to play with the bootloader or the vector table set functions?

Related