Bare Metal programming on Leon processors

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 bare metal 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 GAISLER-DOCS : contaims user guide of the bare metal cross-compiler, simulators and debuggers for Gaisler/Frontgrade products.




Setting up remote working space:

For these labs, we will:

We will use the POMELOS platform to do this labs. 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 your first bare metal program.


To compile and run with the TSIM simulator :

  1. In exercise 1, we experiment the C cross-compiler. 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 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/bm.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 and run it with the following commands:

    tsim> load init.exe 
    tsim> run
    

    You may get the following result



  9. 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 platform.