Running RTEMS on a LEON2 from ROM
mike.looijmans at topic.nl
Wed Jul 26 11:10:04 UTC 2017
On 26-07-17 10:21, Jiri Gaisler wrote:
> On 07/26/2017 07:25 AM, Mike Looijmans wrote:
>>> how you do it with standalone sis:
>>> $ sparc-rtems4.12-sis -leon2 application.exe
>>>> hi 100
>> Doesn't get very far, there's apparently no (working) memory at
>> 0x40000000 in the simulator, it always reads back as "0", so any
>> access to RAM results in a crash in the simulator.
> Are you sure you are building sis and gdb from RSB head? sis in the
> regular gdb does not support leon2 yet.
> To advance things, you can send me your application binary and I can run
> it in the simulator and send you the traces. If you are on 64-bit ubuntu
> 16.04, I can also provide you with binaries for sis/gdb, or the whole RSB.
I built the current HEAD of the RSB, and ran using the simulator from that.
The result is the same.
Did some more digging. The problem appears to be that the simulator populates
the memory segments using the VMA values instead of the LMA values. So it
writes the data segment to RAM at 0x40000000, instead of in ROM, directly
following the text segment, as the boot code expects. I can see the data
segment contents there just after loading the elf.
When the code starts, it copies the data segment from ROM into RAM and that
will copy the empty ROM part onto the RAM, resulting in the all-zero data in
RAM that I see.
Can I load a binary image into sis? (so not an elf but a raw ROM image)
I'll try using objdump to concat the text and data into a single segment elf
for the simulator. Or maybe patch the VMA address to match the LMA.
Materiaalweg 4, NL-5681 RJ Best
Postbus 440, NL-5680 AK Best
Telefoon: +31 (0) 499 33 69 79
E-mail: mike.looijmans at topicproducts.com
Please consider the environment before printing this e-mail
More information about the users