Run bare-metal program on Spike with non-default memory map

HI, I tried to load a bare-metal program into Spike, with my own memory map, the command line I used is:

spike -m0x0:0x20000,0x100000:0x20000,0x10000000:0x80000, \
0x10080000:0x40000,0x40000000:0x20000,0x50000000:0x580000 \
 -d   <my_elf_file>

And the entry point of my elf is 0x50000000.
But after Spike was launched, I checked PC, it was not 0x50000000, but 0x1000

I then tried using --pc=0x50000000 to force PC to 0x50000000, but it made no difference at all.

I checked the content starting from 0x50000000 after Spike was launched. The content was my program, so it was loaded correctly into the memory. But PC was not set as the elf indicated.
What might be wrong with my steps running Spike? Thanks.

-Oscar

It’s interesting that it seems that Spike embedded some code silently at 0x1000. And it always runs from there:
image

After a few instructions, it jumps to the entry point of my elf: 0x50000000.

What if my elf overwrites 0x1000 memory area?

See here for some info on what Spike is doing with regard to code at 0x1000:

Thank you, Tommy. The information there is very helpful for me.