I am currently working with some µC systems and I'd like to go deeper into detail to understand what is going on beneath. I am currently working with a Motorola Coldfire and an ARM 9. For both I am using the GCC toolchain as a cross compiler!
ELF files contain more information than needed to get the application run! A BIN file would be enough though! I know the ELF format keeps some extra information. it concatenates symbols and their addresses in memory, right? Are the extra information for the software debugger (e.g. GDB) only or are some of theses information transfered to the target device as well? So if there is a breakpoint hit, the on-chip debugger tells the host the regarding address and the software debugger can show me the relevant code section instead of the boring memory address only? Can I debug using a BIN file only (Ok this would be stupid, but basically?)?
Some enlightenment regarding this topic is appreciated!
thynk you
You are right that ELF files contain extra information, such as symbols used for debugging. Typically in a µC environment, you will use the BIN file to execute on the processor (usually loaded into flash) and then you would pass the ELF file to GDB for debugging. When running the cross-compiled GDB on your development PC, it will use the ELF file for reference (so it knows code line numbers, variable names, etc.) but it will communicate with the on-chip debugger to read memory locations, set breakpoints, etc. To get GDB to communicate with the on-chip debugger, you use the target remote
command in GDB, passing it whatever parameter is necessary (often a serial port of network address & port).