Cannot load program with JLink + GDB + Eclipse

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

  • Cannot load program with JLink + GDB + Eclipse

    I have a AT91SAM9261 Eval Kit, and I am trying to load and debug a simple "getting-started" example. I am very close to getting it working, but it still does not seem to load correctly. Here is where I am:

    -I can compile code properly, load it through SAM-BA and run it without a problem.
    -I have GDB server running, and I set all of the appropriate executables in the debug configuration (e.g. arm-elf-gdb)
    -I am using the following gdb init file to initialize the processor and load the binary file:

    Source Code

    1. # Listening for commands on this PC's tcp port 2331
    2. target remote localhost:2331
    3. # Set gdb server to little endian
    4. monitor endian little
    5. # Set JTAG speed to adaptive
    6. monitor speed adaptive
    7. # Reset the chip to get to a known state.
    8. monitor reset 8
    9. monitor sleep 10
    10. #
    11. # Disable the watchdog and setup the PLL
    12. #
    13. # WDT_MR, disable watchdog
    14. monitor writeu32 0xFFFFFD44 = 0x00008000
    15. # CKGR_MOR
    16. monitor writeu32 0xFFFFFC20 = 0x00004001
    17. monitor sleep 10
    18. # CKGR_PLLAR
    19. monitor writeu32 0xFFFFFC28 = 0xBF092060
    20. monitor sleep 10
    21. # PMC_MCKR
    22. monitor writeu32 0xFFFFFC30 = 0x00000102
    23. monitor sleep 10
    24. # PMC_IER
    25. monitor writeu32 0xFFFFFC60 = 0x00480100
    26. # monitor writeu32 0xFFFFFC60 = 0x0
    27. monitor sleep 100
    28. # Set JTAG speed in khz
    29. monitor speed adaptive
    30. load
    31. break main
    32. continue
    Display All


    J-Link GDB server's log shows all the commands running successfully (as does eclipse), and then it says

    Source Code

    1. Connected to 127.0.0.1
    2. Reading all registers
    3. Read 4 bytes @ address 0x00000000 (Data = 0x00000000)
    4. Target endianess set to "little endian"
    5. Select adaptive clocking instead of fixed JTAG speed
    6. Resetting target (SAM7 soft reset)
    7. Sleep 10ms
    8. Writing 0x00008000 @ address 0xFFFFFD44
    9. Writing 0x00004001 @ address 0xFFFFFC20
    10. Sleep 10ms
    11. Writing 0xBF092060 @ address 0xFFFFFC28
    12. Sleep 10ms
    13. Writing 0x00000102 @ address 0xFFFFFC30
    14. Sleep 10ms
    15. Writing 0x00480100 @ address 0xFFFFFC60
    16. Sleep 100ms
    17. Select adaptive clocking instead of fixed JTAG speed
    18. Downloading 4080 bytes @ address 0x00300000
    19. Downloading 4080 bytes @ address 0x00300FF0
    20. Downloading 2628 bytes @ address 0x00301FE0
    21. Downloading 1256 bytes @ address 0x00302A24
    22. Writing register (PC = 0x00300070)
    23. Read 4 bytes @ address 0x00000000 (Data = 0xEA000004)
    24. Setting breakpoint @ address 0x00300678, Size = 4, BPHandle = 0x0001
    25. Starting target CPU...
    Display All


    At this point, it just hangs there, and Eclipse on the bottom right says 'Launching test (27%)', where test is the name of the debug session I created.

    Another piece of info is that every once in a while, when I try to run this, I get an gdb syntax error on line 11. If I restart Eclipse then it doesn't give me that error.

    Adit
  • Hi,

    Did you succeed in fixing this problem? I have had exactly the same issue, but I think (hope) I fixed it now.

    I use Segger J-Link (GDB v4.08k), on an AT91SAM7X256-EK board, also using Eclipse CDT (with Zylin's free CDT enhancer plugin), and am building using the Yagarto toolchain (ARM-ELF).

    I came across this post on another site, regarding GDB:

    actel.com/download/software/softconsole/sc22.aspx

    "3218: Attempting to load a program to SRAM at address 0x00000000 when hardware actually has flash memory at 0x00000000 causes SoftConsole to hang, displaying the message "Launching... (27%)". In this case, make sure that the linker script matches the RAM/flash memory map of the target platform."

    Then I made sure the following lines were at the top of my linker script :

    OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm", "elf32-littlearm")
    OUTPUT_ARCH(arm)
    ENTRY(reset_handler)

    I find that the problem recurs at unpredictable intervals, but it helps if I first run a debug session on a small, guaranteed-working program (e.g. Atmel's "Getting Started" example).

    Hope this helps somebody...

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

  • Eclipse hangs when launching a debugging session at 27%

    I also had eclipse hang when starting a debugging session on an Embedded Artists ea2468 board.

    I was downloading the application into RAM rather than ROM and had a mistake in the linker memory map, the ROM section (although not used) had been omitted and the SRAM section size was incorrect. Fixing these solved the problem.

    Command line GDB worked fine even with the linker map being incorrect, but eclipse would hang with the message on the Debug tab: Launching .... (27%)

    The advise to ensure the linker memory map was correct fixed the problem.

    Thanks!