2008-11-25 05:59:05     Makefile

Document created by Aaronwu Employee on Aug 8, 2013
Version 1Show Document
  • View in full screen mode

2008-11-25 05:59:05     Makefile

ivan ucles (GERMANY)

Message: 65783   




i want to debug an application called loop.c. I read in another thread that i should compile with the flag


-Wl,-elf2flt -g to get the loop.gdb file. I'm not getting it. I only get the executable and loop.o after compiling.


What is wrong in my Makefile?


EXEC = loop

OBJS = loop.o


all: $(EXEC)


#Options for compilation

LDFLAGS += -Wl,-elf2flt -g


$(EXEC): $(OBJS)

$(CC) $(LDFLAGS) -o $@ $(OBJS) $(LDLIBS)











2008-11-25 23:17:12     Re: Makefile


Message: 65809   


What if you do not use Makefile and invoke the bfin-uclinux-gcc directly?




2008-11-26 02:19:32     Re: Makefile

Mike Frysinger (UNITED STATES)

Message: 65816   


in order for -g to actually be useful, it needs to be in CFLAGS.  simply using it in LDFLAGS is useless.


that said, the generation of the .gdb when creating a FLAT is independent of any -g flag.  if you get a FLAT binary, you'll get the related .gdb file.  there is no mechanism to turn this off, so if you are getting a FLAT but not the .gdb, you probably have some other system deleting the file on you.




2008-11-26 07:13:15     Re: Makefile

ivan ucles (GERMANY)

Message: 65845   


I just configured eclipse as it is explained in the web page. so i don't know what could be deleting that file.


This is what i get in the log file during compiling:


make[3]: Entering directory `/home/ivan/uClinux-dist-2008R1.5-RC3/user/loop'

make[3]: warning: -jN forced in submake: disabling jobserver mode.

bfin-linux-uclibc-gcc -pipe -Wall -g -O2 -mcpu=bf537-0.2 -DEMBED -D__uClinux__ -I/home/ivan/uClinux-dist-2008R1.5-RC3 -mcpu=bf537-0.2 -c -o loop.o loop.c





2008-11-26 08:03:05     Re: Makefile

ivan ucles (GERMANY)

Message: 65850   


If, as Yi Li suggested, i just do


bfin-uclinux-gcc -elf2flt loop.c -o loop


i get the .gdb file.


What i still don't understand is how to do it from the makefile.


It seems that when i do make i'm using another compiler 'bfin-linux-uclib-gcc'. But i'm using the original makefile from


uclinux.  The only makefile i wrote, was the one in the folder of my program loop.


Maybe I didn't install the correct toolchain files? I installed these 3:








Thanks for your help. I'm quite confused and the webpage where all this stuff was explained


is not working today...(http://docs.blackfin.uclinux.org)




2008-11-26 21:31:17     Re: Makefile

Mike Frysinger (UNITED STATES)

Message: 65868   


are you sure that's the entire output ?  what exactly do you see if you run:

make user/loop_clean

make user/loop_only




2008-11-26 22:03:49     Re: Makefile


Message: 65875   


I think you are building uclinux-dist as FDPIC (not FLAT) (see "Blackfin build options --> Binary format"). So your application is using bfin-linux-uclibc-gcc. If you want to use bfin-uclinux-gcc, please select FLAT.






2008-11-27 12:23:53     Re: Makefile

ivan ucles (GERMANY)

Message: 65921   


Thanks! I had skipped "Blackfin build options --> Binary format" in my configuration, and


it was set by default to FDPIC. I changed it to FLAT and i get the .gdb when compiling with make.






2008-11-27 12:27:41     Re: Makefile

Jim Donelson (UNITED STATES)

Message: 65922   


Ok, when smbmount did not build I was told to use FPIC.


I do not understand under what conditions FLAT and FPIC shold be used.


Please explain.






2008-11-27 21:16:48     Re: Makefile

Mike Frysinger (UNITED STATES)

Message: 65934   


ivan wanted FLAT.  the conditions for picking between the formats is up to you and what you want to do.  if you want to know about the differences in formats, review the wiki:





2008-11-28 00:38:46     Re: Makefile

Jim Donelson (UNITED STATES)

Message: 65938   




The point is this - if you need to also build say samba for example, and you want gdb files, you have a problem,because  samba will not build. I guess the question really is, must it be all or nothing for all appications, or could you build apps as FLAT and some apps as FDPIC.


And, since FDPIC is elf, coundn't you include the debug information?






2008-11-28 01:39:19     Re: Makefile

Mike Frysinger (UNITED STATES)

Message: 65941   


FDPIC ELFs already include all debugging information you need in order to debug.  only FLAT files split into two files.


there is no limitation in mixing of binary formats between applications.  no app cares how any other was compiled.




2008-11-28 07:19:38     Re: Makefile

Bernd Schmidt (GERMANY)

Message: 65958   


I'm not sure Ivan wanted flat - he said he wanted a .gdb file.  With FD-PIC, you don't need it, because you can load the actual executable into the debugger.




2008-11-28 16:01:57     Re: Makefile

Jim Donelson (UNITED STATES)

Message: 65991   


What if you are remote deugging? If the local debugger  "sees" the executable locally, will it load the debug info?


Also, in this case could you concievably strip the debug info from the remote executable, but keep it locally and then debug it?






2008-11-28 16:10:10     Re: Makefile

Mike Frysinger (UNITED STATES)

Message: 65992   


the remote debugger needs no debug information.  it merely moves data from the real debugger running on your development machine and the target hardware.  all information must be on your development system.


it is trivial to split debugging information out of an FDPIC ELF binary, but there isnt much point.  you make a copy for the target and strip it and keep the original one with debugging information.