How to debug assembly sources with gdb and Eclipse ?

Hello everybody,

I built my first ARM board based on AT91SAM7XC256.

I’m using Eclipse CDT with Zylin update, WinARM tool chain, OpenOCD and Amontec JTAGkey, usb version.

The first project I tried was SAM7X256Test from Yagarto web site.

JTAG connections is working fine, OpenOCD found the chip, and I can debug the code in ram and in rom mode. Everything is perfect so far …

The problem is I can’t debug in assembly sources.

It works perfectly when debugging C sources.

I modify the entry point defined in linker script to ResetHandler label defined in asm start-up file sam7x256_ram.ld and also the first breakpoint to stop in debug mode also to ResetHandler.

After these changes, when I start debugging I can stop the code at ResetHandler address but it doesn’t point to asm source file, I can only see the disassembly window.

I believe the debugger can’t link correctly the elf file to asm crt.s file.

I tried to modify the compiler and linker options but no success.

Can some one give some hints or point me to a tutorial that describe that ?

If it’s not possible to use Eclipse to debug correctly asm sources what other options I have ?

I must use assembly because of speed constraints. The target project is an acquisitions board …

Thanks,

Atlas

Finally, I found how to debug assembly sources.

Tested with Eclipse CDT, Zylin plugin and OpenOCD

You have to decorated your code like in following example.

Also don’t forget to set the debugging flags .

.global YourFunctionName

.func YourFunctionName
YourFunctionName:

    /* assembly code here */

.endfunc

So, you don’t have to buy sophisticated stuff to do that…

PS.

I forgot to mention that you can to switch from assembly to C sources with no problem :slight_smile: