0

I am currently using CodeViser Jtag debugger connecting to a FPGA for debugging firmware for an Armv8 processor. From within the CodeViser GUI client (called CVD64 on windows) I can set break points at absolute addresses.

One thing I noticed that, when I set a break point at some functions in u-boot, I use the address as shown in u-boot.map, which reflects the initial loading address of u-boot. In my case, the u-boot text section is initially loaded to 0x20408000.

When the break point I set hits, the actual address the PC stops is not what I specified from GUI, but another address, which is the relocated one (i.e., after u-boot relocation).

For example, I set break point from GUI at 0x20413040, and CVD64 stops at 0x207ae040, the offset is 0x39b000. This offset is exactly the same as u-boot itself printed to serial port:

Relocation Offset is: 0039b000
Relocating to 207a3000, new gd at 2075edf0, sp at 2075ede0

This is nice. I am just wondering how CVD64 knows the relocate offset and automatically place HLT instruction in relocated address?

Thanks!

bruin
  • 979
  • 1
  • 10
  • 30
  • Do you set the breakpoint before relocation? Breakpoints can either be managed by special hardware registers of a CPU or by adding a breakpoint instruction in the code. In the latter case this instruction may be relocated as well. – Xypron Sep 07 '21 at 23:26
  • @Xypron I set the breakpoint before the program run, so it's before the relocation. So it's possible that the HLT instruction has already been inserted before relocation, and a relocation simply also copied the HLT instructions. – bruin Sep 08 '21 at 00:55

0 Answers0