Real-time programming RTEMS with C/POSIX

Frank Singhoff
Université of Brest, Lab-STICC UMR CNRS 6285








Exercise 1 : how to cross-compile, simulate and run on a GR740 board

In this lab, we will write RTEMS programs running either on a simulator or GR740 boards. Most of hardware and software components are GAISLER/Frontgrade material and are currently used in many space products.
Several documentations for those exercises are available here:
  1. Directory RTEMS-DOCS : contains a set of pdf files that are part of the RTEMS standard documentation (may help for the signature of each function you will need).
  2. Directory RTEMS-EXAMPLES : a set of RTEMS C/Ada examples.
  3. Directory GAISLER-DOCS : contaims various documents about RCC, grmon and tsim, which are the cross compilers, simulators and debuggers for Gaisler/Frontgrade products.




Setting up remote working space:

For these labs, we will:

To setup your working space:
  1. Connect to the pomelos.univ-brest.fr machine with ssh as follows:

    $ssh yourloginname@pomelos.univ-brest.fr

  2. We now mount your vador files in your pomelos.univ-brest.fr home directory.
  3. Finally, download and save in your home directory the following file and put it in a sub-directory called EXO1. These files should be seen on pomelos.univ-brest.fr from home-vador.

  4. Now you are ready to compile and run RTEMS programs.


To compile and run with the TSIM simulator :

  1. In exercise 1, we experiment the C cross-compiler for RTEMS. On Linux, we will generate programs that are able to run on SPARC/Leon processor architectures. To compile programs for Leon processors, we need a specific compiler. All RTEMS and GAISLER tools we need are installed in the /opt folder.
  2. To have these tools on your shell PATH, run the following command:
    source /opt/rtems.bash .
  3. Compile this first example of C program with the following command:
    make clean
    make

    assuming you are in the EXO1 directory.
  4. If everything is OK, you should find a file named init.exe.
  5. Launch the command file init.exe : what is the meaning of the displayed information?
  6. Can we directly launch the binary init.exe from your Unix Shell?
  7. Now, we will use a Leon processor simulator to run this program. This simulator is gracefully provided by the Gaisler Research company (See http://www.gaisler.com). To launch this simulator, call the following command from your Unix Shell:

    $tsim
    tsim>


  8. Now, load the binary into the memory of the simulator with the load command:

    tsim>load init.exe


  9. Then, finally, run the program with the run command :

    tsim> run
    resuming at 0x40000000
    Max priority for SCHED_FIFO = 254
    Min priority for SCHED_FIFO = 1
    ...
  10. Answer to these questions:


To compile and run with a GR740 board:

When a program has been tested on the simulateur, one would like to run it on a real Leon board. We have 6 GR740 boards availables for such a purpose and we see now how to run the program on such plateform.