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 is as follows:

  1. Modify the startup source.
  2. Build the startup library and board's startup with debug information.
  3. Rebuild the image and symbol file.
  4. Load the symbol file into the hardware debugger program.
  5. Transfer the image to the target (burn into flash, transfer over a serial connection).

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. Again, you can use the -gstabs+ debug option instead of -g. 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 -vv
}

The +keeplinked option makes mkifs generate a symbol file that represents the debug information positioned within the image filesystem by the specified offset.

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, the hardware debugger needs the source code listings found in the following directories: