OpenOCD debugging not working on boards with new flash protector

Hi all!
I have several pca10056 boards, some of which are quite old with a serial number < 1000000000. There are boards with higher serial numbers that come with factory-installed flash memory protection. On these new boards, debugging through openocd does not work. When connecting, openocd displays the error message "Error: No J-Link device found." This does not depend on whether I specify the serial number in the config or not. Here is an example of my config:

telnet_port 50002
gdb_port 50000

adapter driver jlink
adapter serial 1050232322
adapter speed 5000
transport select swd

command to start openocd:

openocd -f jlink_test_cfg.cfg 

If I change the adapter serial to 683681827, everything works. As a result, debugging only works on 3 old boards, it doesn't work on a bunch of new boards, I tried on all of them :). I remember for sure that it used to work for me, maybe the issue is with the firmware for J-Link. I also tried using an older version of OpenOCD (0.10.0), but the problem remained the same.

I'm currently using Openocd 0.12.0.
Version jlink SEGGER J-Link Commander V7.92c (Compiled Aug 30 2023 14:58:04).

Is it possible to try old firmware for JLink? If anyone has a similar problem, how did you solve it? I am using OpenOCD because I am unable to attach to the already running board using the J-Link GDB server in VSCode.

Parents
  • Do the J-link devices show up in dmesg or in "lsusb" at all?

    The J-Link GDB server can attach to running code with the "-noir -nohalt" command line parameters.

  • I got to the point where I started using openocd. Here is the command to start the server.

    JLinkGDBServer -singlerun -nogui -if swd -port 50000 -swoport 50001 -telnetport 50002 -device nrf52840_xxaa -select usb=1050232322 -rtos GDBServer/RTOSPlugin_FreeRTOS.so -speed 1000 -noir -nohalt
    Everything works, everything starts, but there is one important problem. FreeRTOS streams are not readable.
    Manual requests for thread or stack information:

    info threads
      Id   Target Id         Frame 
      2    Remote target     0x00025f40 in ?? ()
    
    The current thread <Thread ID 
    1> has terminated.  See `help thread'.
    {"output":"","token":37,"outOfBandRecord":[],"resultRecords":{"resultClass":"done","results":[]}}

    bt
    The current thread has terminated
    The current thread has terminated (from interpreter-exec console "bt")


    I can only get this information if I continue executing the code and immediately pause it. Then everything starts to work, but this is not what is needed.
    [New Thread 537086184]
    [New Thread 537084752]
    [New Thread 537088640]
    [New Thread 537097944]
    [New Thread 537095784]
    [New Thread 537091976]
    [New Thread 537069128]
    [New Thread 537078200]
    
    Thread 
    3 received signal SIGTRAP, Trace/breakpoint trap.
    [Switching to Thread 537086184]
    0x0006f3c0 in nrfx_coredep_delay_us::delay_machine_code ()


    I don't have enough understanding of the debugging process to do anything with this.

  • Which application are you running on the board? Is it a BLE based application using the softdevice? If so, then you cannot pause and run the application.

    You might have to use Monitor mode debugging to be able to do that 

Reply Children
Related