Sunday, February 22, 2015

[HOWTO] 4- Run RTEMS on or1ksim

At this point, you must be enthusiastic enough to see your effort building the toolchain, simulator and RTEMS [1] [2] [3] coming into action, I mean you can now see RTEMS executing literally!


or1ksim simulator needs a script file describing the system architecture, peripherals and CPU version and configurations. RTEMS or1ksim BSP is shipped with such a file that you can see at its source directory.

$ vim $HOME/development/rtems/src/rtems/c/src/lib/libbsp/or1k/or1ksim/sim.cfg
RTEMS sim.cfg
What concerns us about this file is that it sets the UART baud rate and how the output should appear and some debugging options (in case you want to debug).

Run

Now you can run RTEMS hello.exe sample (resulted from your previously built RTEMS) by typing this command:

$  or1k-elf-sim -f $HOME/development/rtems/src/rtems/c/src/lib/libbsp/or1k/or1ksim/sim.cfg $HOME/development/rtems/build/or1k-rtems4.11/c/or1ksim/testsuites/samples/hello/hello.exe

RTEMS hello.exe running on or1ksim
Congratulation! you made it!

Debug

If you want to debug using GDB, you can edit the sim.cfg file to enable debugging, just open it and set enabled option part of the debug section to 1.


As you may have already guessed, you then have to start or1ksim server which will listen to GDB clients on port 50001. Now you do it.

GDB/or1ksim Debugging

References