[Libre-soc-bugs] [Bug 1073] Microwatt verilator sim - setting up chroot and documentation

bugzilla-daemon at libre-soc.org bugzilla-daemon at libre-soc.org
Fri Apr 28 22:14:28 BST 2023


https://bugs.libre-soc.org/show_bug.cgi?id=1073

--- Comment #9 from Andrey Miroshnikov <andrey at technepisteme.xyz> ---
(In reply to Luke Kenneth Casson Leighton from comment #8)
> ok you've misunderstood: the *executable binary* you have compiled with
> an incorrect offset.  check the linker script.


https://git.libre-soc.org/?p=microwatt.git;a=blob;f=hello_world/powerpc.lds;h=96bc6b9b16120335e73f6e90c29b3573d2c55e59;hb=refs/heads/verilator_trace

I'm assuming "_start = .;" is the entry point, and the address is equal to the
first available (0x0).

Using objdump, viewed the regions of the elf file before changing anything.
objdump -x hello_world.elf <- shows all headers
objdump -h hello_world.elf <- shows section headers

-h shows the section list (only first three shown):
Sections:
Idx Name          Size      VMA               LMA               File off  Algn
  0 .head         00000f84  0000000000000000  0000000000000000  00010000  2**0
                  CONTENTS, ALLOC, LOAD, READONLY, CODE
  1 .sfpr         00000014  0000000000001000  0000000000001000  00011000  2**2
                  CONTENTS, ALLOC, LOAD, READONLY, CODE
  2 .text.startup.main 00000070  0000000000001014  0000000000001014  00011014 
2**2
                  CONTENTS, ALLOC, LOAD, READONLY, CODE

-x showed the symbol table, and the main code seems to be where
.text.startup.main is:
0000000000000000 l    d  .head  0000000000000000 .head
0000000000001000 l    d  .sfpr  0000000000000000 .sfpr
0000000000001014 l    d  .text.startup.main     0000000000000000
.text.startup.main
...
0000000000000000 g       .head  0000000000000000 _start
0000000000001014 g     F .text.startup.main     0000000000000070 0x60 main

which is why I tried setting the _start to 0x1014.

Tried changing _start to:
- 0x1000 (where .text section begins)
- 0xff00_1000 (my guess what the SoC level address would be)
- 0x1014
- 0xff00_1014

The last one I tried (_start = 0xff001014;) changed the bram.dump slightly,
however as before (and what I didn't show from previous bram.dump, sorry) is
that the PC is stuck at 0x800:
pc         ff000000 insn ffffffff msr 8000000000000001
pc         ff000004 insn ffffffff msr 8000000000000001
pc         ff000008 insn ffffffff msr 8000000000000001
                          rd @ 00000100 di         48000000 sel ff ...H....
                          rd @ 00000101 di                0 sel ff ........
                          rd @ 00000102 di                0 sel ff ........
                          rd @ 00000103 di                0 sel ff ........
pc              800 insn 48000000 msr 8000000000000001
                          rd @ 00000104 di                0 sel ff ........
                          rd @ 00000105 di                0 sel ff ........
                          rd @ 00000106 di                0 sel ff ........
pc              800 insn 48000000 msr 8000000000000001
                          rd @ 00000107 di                0 sel ff ........
pc              800 insn 48000000 msr 8000000000000001

I'm not really sure how the PC goes back from ff00_0008 to 0x800.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


More information about the libre-soc-bugs mailing list