Problem debugging with Eclipse+yagarto+J-LINK

gnello wrote on Tuesday, November 03, 2009:

Hi all,
I am trying to debug a freertos-demo like ARM7_AT91SAM7X256_Eclipse, using eclipse + yagarto + j-link.
I followed instructions found in yagarto-site to create a new eclipse project. Compiling work fine, but I have some problems to debug firmware.

The gdb script used is the same provided by yagarto. It is:

# This config file was tested with J-Link GDB Server v4.04
# Listening for commands on this PC’s tcp port 2331
target remote localhost:2331
# Enable flash download and flash breakpoints.
# Flash download and flash breakpoints are features of
# the J-Link software which require separate licenses
# from SEGGER.
# Select flash device
monitor flash device = AT91SAM7X512
# Enable FlashDL and FlashBPs
monitor flash download = 1
monitor flash breakpoints = 1
# Set gdb server to little endian
monitor endian little
# Set JTAG speed to 30 kHz
monitor speed 30
# Reset the chip to get to a known state.
monitor reset 8
monitor sleep 10
# Disable the watchdog and setup the PLL
# WDT_MR, disable watchdog
monitor writeu32 0xFFFFFD44 = 0x00008000
monitor writeu32 0xFFFFFC20 = 0x00000601
monitor sleep 10
monitor writeu32 0xFFFFFC2C = 0x00480a0e
monitor sleep 10
monitor writeu32 0xFFFFFC30 = 0x00000007
monitor sleep 10
monitor writeu32 0xFFFFFF60 = 0x00480100
monitor sleep 100
# Set JTAG speed in khz
monitor speed 12000
break main

It flashes correctly the microP, but it crashes at/after the branch instruction:

ldr lr, =main

in the boot.s file.
Some one can help me?

Thank you.

gnello wrote on Wednesday, November 04, 2009:

Hi all and good morning :slight_smile:
If someone have to give me any suggestion, thanks a lot, but for me is alse very useful to know if someone use the same confuguration used by me. It is:
COMPILER: GCC (Yagarto for win)
J-TAG: j-link Segger

Bye bye.

gunutox wrote on Thursday, November 05, 2009:

Looks like I have the same problem :frowning:

The example from the yagarto ( works with no problems (RAM and ROM)

The FreeRTOS demo ARM7_AT91SAM7X256_Eclipse makes trouble. Eclipse stops launching at 27%.
Eclipse Console:

    Loading section startup, size 0x44 lma 0x100000
    Loading section prog, size 0xe580 lma 0x100048
    Loading section .data, size 0x868 lma 0x10e5c8
    Loading section .eh_frame, size 0xa50 lma 0x20ad6c
    Start address 0x106a00, load size 63612
    Transfer rate: 27 KB/sec, 3534 bytes/write.
    break main
    Breakpoint 2 at 0x10074c: file main.c, line 168.

J-Link Console:

    Downloading 2640 bytes @ address 0x0020AD6C
    Writing register (PC = 0x00106A00)
    Setting breakpoint @ address 0x0010076E, Size = 2, BPHandle = 0x0001
    Setting breakpoint @ address 0x0010074C, Size = 2, BPHandle = 0x0002
    Starting target CPU…

If I try to debug with Insight I get the same error.

My Hardware:

- AT91SAM7X256-EK
- SAM-ICE (Segger JTAG)

My Software:

- Eclipse CDT
- Zylin Embedded CDT debug plugin
- yagarto-bu-2.19.1 (2009-10-18)
- FreeRTOS 6.0.0

Unfortunately I have no idea what’s going wrong.

gnello wrote on Thursday, November 05, 2009:

Exactly !!! I have the same symptoms you describe!

rtel wrote on Thursday, November 05, 2009:

Its a bit specific to the debug interface.  Have you asked Zylin support?

Can you telnet into the debug interface, like you can with OpenOCD?


gunutox wrote on Thursday, November 05, 2009:

Hm, don’t believe it’s a Zylin problem. If I debug with Insight the problem is the same. So Eclipse or Zylin can’t be the fault location.

I’m not sure. But I believe the Segger JTAG has no telnet interface.

Something else: I build the project without errors or warnings. But if I try to flash the device with J-Flash ARM (Segger) or SAM-BA (Atmel) both programmers tell me, the program doesn’t fit in the flash.

rtel wrote on Thursday, November 05, 2009:

All eclipse is doing is running a series of command line commands, and displaying the results in the IDE.  It should be possible to run these commands from the command line yourself - outside of the IDE.  That might provide you with better feedback.

I have seen Eclipse hang indefinitely at certain percentages before.  From memory it was something to do with the path setup, in that there was something it could not find - but I would not like to tell you that was what the problem was in case it takes you off in the wrong direction.

If you have a project that works, and one that doesn’t work I can only really suggest that you compare the compiler and linker options to see if the project that does work is adding something in that is assisting Eclipse.

I would also say that I have not used the Zylin tools in many years, have they been updated recently (within a year or two)?  Also the Eclipse and CDT distributions on the Yagarto site used to be very, very, out of date.  I have not looked recently so maybe this is no longer the case, but recent versions of Eclipse have their own cross debugging features rendering the Zylin plug-in obsolete.  My information is probably out of date though!


gnello wrote on Thursday, November 05, 2009:

I can give some information, if it is useful to someone …
First problem is related to the crash at ‘27%’. The problem is that master clock and pll fall in fault due to the previous initialization given by j-link during flashing. Comparing source code of freertos-demo and yagarto-demo, I substitude the pll initialization

       pPMC->PMC_PLLR = ((AT91C_CKGR_DIV & 5) |
                         (AT91C_CKGR_PLLCOUNT & (28<<8)) |
                         (AT91C_CKGR_MUL & (25<<16)));


#define BOARD_PLLCOUNT  (16 << 8)
#define BOARD_MUL       (AT91C_CKGR_MUL & (72 << 16))
#define BOARD_DIV       (AT91C_CKGR_DIV & 14)

   /* Initialize PLL at 96MHz (96.109) and USB clock to 48MHz */

The second problem (the actual for me) is at the line

ldr lr, =main

in the boot.s file. At this jump, debugger crash … I don’t know why and I havo no more ideas  :frowning:

Bye bye

gunutox wrote on Friday, November 06, 2009:

Good morning!

After I have adjusted the PLL configuration, the demo works! Debugging with Eclipse is also possible.

Thank you all for the support!

gnello wrote on Friday, November 06, 2009:

Ok, perfect, I am very happy for you :slight_smile: , but I am sad for me :frowning:

I have the same problems too. One way to solve my problem could be to compare my project with yours. Could you send me by e-mail? So, if I find my problem then I can post solution for everyone.

Bye bye.

gunutox wrote on Friday, November 06, 2009:

Please tell me your mail address and I will send you my project.


rtel wrote on Friday, November 06, 2009:

Posting mail addresses is fine - but please obfuscate them so robots can’t pick them up.  For example, write (at) instead of using the @ symbol, and  instead of ’ . '.  Thanks.


gnello wrote on Friday, November 06, 2009:

Following hints of our dear Richard :slight_smile:
here it is my address:

paolo.desii AT

Thank you,

bye bye

lnties wrote on Thursday, April 26, 2012:

Hiii….I am trying to debug a FreeRTOS example for uIP stack  on AT91SAM7X-EK board.I am using Eclipse indigo,Ygarto tool and J-link debugger. I am able to compile my code without any errors but when i am debugging it ,launching process stops in between saying “Internal error occured during launching” .
I am nt able to solve this problem…may be sm settings are not proper for debugging…i am not able to fix it…I have changed the PLL initialization as suggested…den also same error is popping up…
If anybody could provide me any salution……?

Thanks and regards

davedoors wrote on Monday, April 30, 2012:

This is a set up you have put together yourself, and there are too many variables to be able to offer any helpful advice without being there. This is not a freeRTOS question, but a tools set up question.