[SOLVED] Help with using J-Link EDU Mini with RP2040

This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

  • [SOLVED] Help with using J-Link EDU Mini with RP2040

    Hello, When I try to debug the RP2040, I get the output below, then the program doesn't stop at the first breakpoint right after main() and just goes off into nowhere. I'm not sure if my command line options are correct. I am able to connect to the target using the JLinkGDBserver GUI, so I know that the J-Link is working. I would eventually like to debug a dual core application, but am stuck just trying to start debugging at all.

    I'm using CLion in Windows, and here's the output ( I hid my serial no )..

    "C:\Program Files\SEGGER\JLink_V784d\JLinkGDBServerCL.exe" -select USB=xxxxxxxxxx -device RP2040_M0_0 -endian little -if SWD -speed 4000 -LocalhostOnly -nologtofile -port 2331 -SWOPort 2332 -TelnetPort 2333
    SEGGER J-Link GDB Server V7.84d Command Line Version

    JLinkARM.dll V7.84d (DLL compiled Jan 25 2023 15:56:28)

    Command line: -select USB=xxxxxxxxxx -device RP2040_M0_0 -endian little -if SWD -
    speed 4000 -LocalhostOnly -nologtofile -port 2331 -SWOPort 2332 -TelnetPort 2333

    -----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: localhost only
    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: RP2040_M0_0
    Target device parameters: none
    Target interface: SWD
    Target interface speed: 4000kHz
    Target endian: little

    Connecting to J-Link...
    J-Link is connected.
    Firmware: J-Link EDU Mini V1 compiled Jan 23 2023 11:00:33
    Hardware: V1.00
    S/N: xxxxxxxxxx
    Feature(s): FlashBP, GDB
    Checking target voltage...
    Target voltage: 3.27 V
    Listening on TCP/IP port 2331
    Connecting to target...
    Connected to target
    Waiting for GDB connection...Connected to 0000:0000:0000:0000:0000:0000:0000:000
    1
    Reading common registers: R0, R1, R2, R3, R4, R5, R6, R7, R8, R9, R10, R11, R12,
    SP, LR, PC, XPSR
    Reading 64 bytes @ address 0x10001300
    Read 4 bytes @ address 0x100013D8 (Data = 0x20000C00)
    Read 2 bytes @ address 0x10001348 (Data = 0x4B23)
    Read 4 bytes @ address 0x100013D8 (Data = 0x20000C00)
    Read 2 bytes @ address 0x100013AC (Data = 0x4B0D)
    Reading 64 bytes @ address 0x10000680
    Read 2 bytes @ address 0x100006F8 (Data = 0x2019)
    Read 4 bytes @ address 0x100006F8 (Data = 0xF0042019)
    Received monitor command: reset
    Resetting target
    Resetting target
    Downloading 256 bytes @ address 0x10000000
    Downloading 16080 bytes @ address 0x10000100
    Downloading 16032 bytes @ address 0x10003FD0
    Downloading 11064 bytes @ address 0x10007E70
    Downloading 11728 bytes @ address 0x1000A9A8
    Downloading 32 bytes @ address 0x1000D778
    Downloading 3340 bytes @ address 0x1000D798
    Writing register (PC = 0x100001e8)
    Reading 64 bytes @ address 0x10001300
    Read 4 bytes @ address 0x100013D8 (Data = 0x20000C00)
    Read 2 bytes @ address 0x10001348 (Data = 0x4B23)
    Read 4 bytes @ address 0x100013D8 (Data = 0x20000C00)
    Read 2 bytes @ address 0x100013AC (Data = 0x4B0D)
    Reading 64 bytes @ address 0x10000680
    Read 2 bytes @ address 0x100006F8 (Data = 0x2019)
    Debugger connected to tcp:localhost:2331
    Setting breakpoint @ address 0x100006F8, Kind = 2, Type = THUMB, BPHandle = 0x00
    01
    Setting breakpoint @ address 0x10001348, Kind = 2, Type = THUMB, BPHandle = 0x00
    02
    Setting breakpoint @ address 0x100013AC, Kind = 2, Type = THUMB, BPHandle = 0x00
    03
    Starting target CPU...

    The post was edited 1 time, last by ronter ().

  • Hi,

    Without knowing your application, it is hard to say what is going on here.
    All I can say is that GDB sets the PC to the application and then sets 3 breakpoints in QSPI flash.
    After starting the core, it looks like no breakpoint none of these breakpoints is hit.

    Note that setting the PC only may result in incorrect behavior because for Cortex-M based devices the core fetches PC + stackpointer from flash, after reset.
    As there is only a reset *before* you download the application but *not afterwards*, the core has fetched PC + SP from what was in flash *before the download*.
    I recommend to either set both, PC + SP and not only PC or add an additional reset after the application download.

    A missing reset after the download may also cause other effects because the ROM bootloader of the RP2040 did not fully boot on the 1st reset.
    This is because there was potentially no valid application in flash on the 1st reset so that the ROM BTL aborted the boot and left the chip in a half-way initialized state.

    See here:
    wiki.segger.com/Raspberry_Pi_RP2040


    BR
    Alex
    Please read the forum rules before posting.

    Keep in mind, this is *not* a support forum.
    Our engineers will try to answer your questions between their projects if possible but this can be delayed by longer periods of time.
    Should you be entitled to support you can contact us via our support system: segger.com/ticket/

    Or you can contact us via e-mail.