2015/01/29

Debug U-Boot After Relocation

U-Boot will relocate itself during the startup. But the symbol data in u-boot was still based on the information before relocate.

This is how I debug U-Boot after relocation with ARM DS-5 debugger

1. Find out where U-Boot is relocated to
Add below to your board configuration header, like "include/configs/versatile.h" to enable the debug output.
#define DEBUG 1

2. When U-Boot starts to run, debug information will be printed out like below
...
relocation Offset is: 03fd0000
...
Now running in RAM - U-Boot at: 0bfd0000 
This indicates the relocation offset to original load address is 0x03fd0000

3. Load the symbol with
On ARM DS-5 debugger command window,
symbol-file
add-symbol-file "C:\svn\HRTK1041\bld\u-boot" 0x3fd0000
First command is to discard the current symbol table
Second command is to load the actually symbol data with offset.
Now, happy debugging.


Reference
http://www.denx.de/wiki/view/DULG/DebuggingUBoot

2015/01/19

Compile and Link ARM Bare Metal Program

An Example:
  arm-linux-gnueabi-as -g startup.s -o startup.o
  arm-linux-gnueabi-gcc -c -g test.c -o test.o
  arm-linux-gnueabi-ld -T test.ld test.o startup.o -o test.elf
  arm-linux-gnueabi-objcopy -O binary test.elf test.bin

Post Code on Blogger

Simplest way to post code to blogger for me: <pre style="background: #f0f0f0; border: 1px dashed #CCCCCC; color: black;overflow-x:...