views:

116

answers:

1

I am trying to compile a project to run on an ARM board that I have. To use the debugger, I have to put debugging symbols in the resulting .elf file.

I configured everything and ran my makefile, which produced the following results:

arm-elf-gcc -x assembler-with-cpp -c -mcpu=arm7tdmi-s -g -gdwarf-2 -Wa,-amhls=src/crt.lst   src/crt.S -o src/crt.o
arm-elf-gcc -c -mcpu=arm7tdmi-s -O0 -g -gdwarf-2 -mthumb-interwork -fomit-frame-pointer -Wall -Wstrict-prototypes -fverbose-asm -Wa,-ahlms=src/main.lst    -MD -MP -MF     .dep/main.o.d -I . -I./inc src/main.c -o src/main.o
arm-elf-gcc -c -mcpu=arm7tdmi-s -O0 -g -gdwarf-2 -mthumb-interwork -fomit-frame-pointer -Wall -Wstrict-prototypes -fverbose-asm -Wa,-ahlms=library/md5.lst    -MD -MP -MF .dep/md5.o.d -I . -I./inc library/md5.c -o library/md5.o
arm-elf-gcc -c -mcpu=arm7tdmi-s -O0 -g -gdwarf-2 -mthumb-interwork -fomit-frame-pointer -Wall -Wstrict-prototypes -fverbose-asm -Wa,-ahlms=library/bignum.lst    -MD -MP -MF .dep/bignum.o.d -I . -I./inc library/bignum.c -o library/bignum.o

arm-elf-gcc ./src/crt.o ./src/main.o ./library/md5.o ./library/bignum.o -mcpu=arm7tdmi-s -g -nostartfiles -T./prj/LPC2138_flash.ld -Wl,-Map=testFLASH.map,--cref,--no-warn-mismatch -nostdlib -L. -Wl,-static -ffunction-sections -Wl,--gc-sections -Wl,-s -fdata-sections  -lc -lg -lnosys -o testFLASH.elf

I have put in the -g flags, but when I try to find debugging symbols, I get only :

C:\Users\stkerr\Code\EclipseWorkspace\LibraryWork>objdump -g testFLASH.elf

testFLASH.elf:     file format elf32-little

This is further confirmed when I try to open the .elf file in my debugger, I get an error about the file not having debugging symbols.

Can anyone point to an error in my arm-elf-gcc calls or a flag that I am missing?

+1  A: 

After poking around a little more in the documentation, the -Wl,-s is the problem.

It strips all symbols from the resulting executable, including the debugging information.

samoz