Running RTEMS on a LEON2 from ROM
Mike Looijmans
mike.looijmans at topic.nl
Tue Jul 25 09:53:37 UTC 2017
Has anyone ever succeeded in running an RTEMS program from ROM on a LEON2
platform?
I've so far only succeeded in running RTEMS applications by loading them into
RAM using the grmon2 debugger.
I'm setting up RTEMS to run on an FPGA platform, with a LEON2 softcore.
The system has several megabytes of ROM and just 1 MB of RAM. So I want the
code to run from ROM and only have my precious data in the RAM.
I setup the BSP linker script to generate to run (.text) at address 0, and
have the .data segment at 0x40000000 where the RAM starts.
There was already code in leon2 start.S to accommodate for this, which copies
the data segment from ROM into RAM.
I also had to add a few lines of LEON2 register initialization code, since
that appears to be something the LEON2 BSPs do not do by themselves, they seem
to rely on the debugger or emulator to do that, or on the bootloader (like
mkprom2 creates maybe).
So on boot I set the stack pointer to 0x40100000 (end of RAM), and the memory
config and UART registers are setup properly for the hardware. This was enough
to run a "helloworld" bare metal application (without RTEMS) that just outputs
1234... on the serial console.
I'm now trying to run an RTEMS application this way, but somewhere during
RTEMS initialization it crashes on invalid memory access and stops running.
Attempts to debug with grmon2 so far don't help a lot, I can step and run the
program, but setting a breakpoint for example doesn't actually work (maybe the
debugger attempts to modify the ROM code to insert a breakpoint?) Breaking the
program only shows "Inside trap/irq" and no backtrace at that point.
Kind regards,
Mike Looijmans
System Expert
TOPIC Products
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
Website: www.topicproducts.com
Please consider the environment before printing this e-mail
More information about the users
mailing list