Generating startup debug symbols

To generate symbol information for startup, you must recompile both the startup library and the board's startup with debug information.

The general procedure for this is as follows:

  1. Build the startup library and board's startup with debug information. (Ensure any modifications you require are complete before you build.)
  2. Rebuild the image and symbol file.
  3. Load the symbol file into the hardware debugger program.
  4. Transfer the image to the target (for example, write into flash memory using a flash writer or JTAG, transfer over a serial or network connection, or load from an SD card or other removable media).

To build the startup library with debug information:

# cd bsp_working_dir/src/hardware/startup/lib/target/a.be
# make clean
# make CCOPTS=-g 
# cp libstartup.a bsp_working_dir/board_name/install/processor/lib
# make install

The above steps recompile the startup library (libstartup.a) with DWARF debug information and copy this library to the install directory, assuming that the BSP is configured to look for this library first in this directory. The make install is optional, and copies libstartup.a to /processor/usr/lib.

To build the board's startup with debugging information:

# cd bsp_working_dir/board_name/src/hardware/startup/boards/board_name/target/be
# make clean
# make CCOPTS=-g
# make install 

The above steps generate the file startup-board_name with symbol and debug information. The make install is necessary, and copies startup-board_name into the install directory, bsp_working_dir/board_name/install/processor/boot/sys.

Note: You can't load the startup-board_name ELF file into the hardware debugger to obtain the debug symbols, because the mkifs utility adds an offset to the addresses defined in the symbols according to the offset specified in the build file.

Modify the build file to include the +keeplinked attribute for startup:

# cd bsp_working_dir/board_name/images

Modify the startup line of your buildfile to look like:

[image=0x10000]
[virtual=processor,binary +compress] .bootstrap = {
        [+keeplinked] startup-board_name -vvv -D8250
    PATH=/proc/boot procnto-smp-instr -vv
}

The +keeplinked option instructs mkifs to generate a symbol file that represents the debug information, positioned by the specified offset in the image filesystem.

To rebuild the image to generate the symbol file:

# cd bsp_working_dir/board_name/images
# make clean

Then, if you're using one of the provided .build files:

# make all

otherwise:

# mkifs -v -r ../install myfile.build image

These commands create the symbol file, startup-board_name.sym. You can use the objdump utility to view the ELF information.

To view the symbol information contained in the startup-board_name.sym file:

# objdump -t startup-board_name.sym | less

You can now import the startup-board_name.sym file into a hardware debugger to provide the symbol information required for debugging startup. In addition to the startup-board_name.sym file, the hardware debugger needs the source code listings found in the following directories: