Jlink GDBServer

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

  • Jlink GDBServer

    Hi,
    I have bought a new Jlink with a plan to use this for debugging with my cosesourcery g++ lite toolchain. I beleive Jlink supports GDB server. However, when I opened the gdb from my toolchain, it can't connect to my Jlink. I have used .gdbinit template given by Jlink.
    Does the JLink support gdb server by default. Do I Need to do anythign for it to respond on localhost. I have attached when i manually run gdb and the .gdbinit file.

    C Source Code

    1. #
    2. # J-LINK GDB SERVER initialization
    3. #
    4. # This connects to a GDB
    5. Server listening
    6. # for commands on localhost at tcp port 2331
    7. target
    8. remote localhost:2331
    9. # Set JTAG speed to 30 kHz
    10. monitor speed 30
    11. # Set gdb server to little endian
    12. monitor endian little
    13. # Reset the chip to get to a known state.
    14. monitor reset
    15. #
    16. # CPU core initialization (to be done by user)
    17. #
    18. # Set the
    19. processor mode
    20. monitor reg cpsr = 0xd3
    21. # Set auto JTAG speed
    22. monitor speed auto
    23. # Setup GDB FOR FASTER DOWNLOADS
    24. set remote memory-write-packet-size
    25. 1024
    26. set remote memory-write-packet-size fixed
    27. # Load the program executable called "image.elf"
    28. # load image.elf
    29. break main
    30. continue
    Display All

    Thanks
    Samartsarath2003
  • Hi Samartsarath2003,

    It seems that no target reference voltage is measured on pin 1 of the JTAG/SWD connector on J-Link.
    Could you please check your target connection?
    Without measuring any target reference voltage on this pin, GDBServer will not connect to the target and will not open the listener port for GDB to connect to the GDBServer.


    Best regards
    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.
  • Hi Alex,
    Sorry I thought I can check the GDB connection with out the device. Now I have made the interface to device (LPC1765). When I run the GDBServer via JTAG I can see the Jlink attempts to communicate on TCP/IP port, but immediately the connection is lost, reset released. After a sec it retries and goes through the same cycle. I have attached screenshot of the GDB server.
    Now this looks like jlink setup/connection issue. I have run Jlink Commander and I can see core (cortex-M3) detected when I try to halt, but its not halted. Please also find the attached Jlink Commander screenshot.
    Can you see anything wrong with my setup...
    Thanks
    Images
    • Jlink GDBServerJTAGoutput.jpg

      282.48 kB, 895×948, viewed 961 times
    • JlinkCommanderOutput.jpg

      140.53 kB, 679×582, viewed 956 times
  • Hi,

    After a sec it retries and goes through the same cycle. I have attached screenshot of the GDB server.

    This is on our ToDo list, since periodic retry makes no sense here. Instead we will add a button to allow manual
    reconnect if something in the target setup was wrong etc., so not the whole GDBServer needs to be restarted.

    Indeed it looks like there is a generic connection problem with the device...
    Are you using an eval board or custom hardware?
    If custom hardware: Could you try again with an eval board?
    Is there any application in the flash of the LPC1765?
    Does this application make use of low power modes? If yes: NXP recommends to NOT use Deep Sleep and Power-down modes during debug since this causes problems when a debugger tries to connect to the device.


    Best regards
    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.
  • Hi Alex,
    Many Thanks: I have sorted out the connection issues. Now I the server communicates with Jlink and on Debug, Jlink program the flash, but I can't debug.

    It says No source available for "g_pfnVectors() at 0x0"

    The following is the commands I used to setup

    Source Code

    1. pwd
    2. target remote localhost:2331
    3. monitor interface JTAG
    4. monitor endian
    5. little
    6. monitor speed 1000
    7. monitor flash device = LPC1765
    8. monitor flash
    9. download = 1
    10. monitor flash breakpoints = 1
    11. monitor reset
    12. # program:
    13. Load elf file.
    14. monitor reg r13 = 0x00000000
    15. monitor reg pc =0x00000004
    Display All


    Can you see anything wrong with ym setup. Also Do you have any sample cortex-m3 gdbinit setup files. The software works fine as I used program serially and my Toolchain setup was Codesourcery g++ lite, Eclipse Helios with LPC1765.
    EDIT:
    Ome thing I noticed, is during the programming before debug, only .text and .data sections are only copied. The .bss sections was not copied. During my initialisation (RESET Handler) I copy this bss data from flash to RAM before calling main(). How does the program work if this global data is not programmed into flash :?: Can this be a reason for my problem :?:

    Thanks

    The post was edited 2 times, last by smartsarath2003 ().