The LEON 2 ELF Bareboard Example
**********************************

This tutorial shows how to build an interactive example and run it with
**GNATemulator**.

Compiling the example
=====================

The example comprises 3 small ada units:

  * hello.adb, the main subprogram.
  * uart.ads and uart.adb which perform I/O using the UART.

To build, simply invoke gprbuild in the example directory::

 gprbuild --target=leon-elf --RTS=ravenscar-sfp-leon

the option '--RTS=ravenscar-sfp-leon' selects the small foot print ravenscar
profile.

Running the example
===================

To launch the example just run::

  leon-elf-gnatemu hello

**GNATemulator** will automatically load the ELF file (:file:`hello`) and
start execution at the entry point.

Here is a quick run scenario::

    Menu:
    1) Hello
    2) Bye
    3) Quit
    You choice: 
    1
    hello
    Menu:
    1) Hello
    2) Bye
    3) Quit
    You choice: 
    2
    bye
    Menu:
    1) Hello
    2) Bye
    3) Quit
    You choice: 
    3
    qemu: fatal: Trap 0x80 while interrupts disabled, Error state

(The double trap which is an error is used to stop the simulator).


Redirecting the uart
====================

It is possible to redirect the UART to a TCP port::

  leon-elf-gnatemu --serial=tcp::1234,server hello

This will redirect UART1 to the TCP port 1234 of localhost.  With the 'server'
option, **GNATemulator** will wait for the TCP connection.
