[SOLVED] JLinkExe vs gdb to flash

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

  • [SOLVED] JLinkExe vs gdb to flash

    I am working on various RP2040 boards. These have an QPSI flash to hold the code. I am also trying to load some data into another part of flash, and am running into some difficulties.

    If I use JLinkExe, connect, and use the LoadFile command, it seems to be able to load the image.

    If I convert the image to elf, and use a gdb command "load image.elf 0x10200000", it does seem to load. However, reads within the debugger seem to return just zeros. I was able to get the flash data to appear by actually power-cycling the target. "monitor reset" did not seem sufficient.

    The gdb command "restore" fails to load the image at all. This works on other targets I've debugged (NXP LPC55S69 with the JLink firmware in the debug MCU).

    Any ideas what might be happening here, and what is the best way to reliably load this image? It'd be nice if I could do it just from my gdb script.

    Thanks,
    David
  • Usually, you do not have to provide address information for the "load" command, as ELF files contain address information.
    The correct sequence in GDB is this done:
    load ...
    monitor reset
    flush registers

    The "flush registers" is needed because "monitor reset" changes the registers behind the back of GDB (e.g. the PC is changed).
    However, GDB does not expect such things to happen.
    Also, as monitor commands are GDB server specific, GDB does not know what a monitor command causes to happen on the target device.


    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.