Difference between revisions of "Technical topic: Test your Leon2/Leon3 applications with QEMU"

From TASTE
Jump to: navigation, search
(LEON2)
 
m (1 revision imported)
 
(No difference)

Latest revision as of 21:02, 4 August 2017

The TASTE VM includes two custom-compiled binaries of QEMU, which partly support the Leon2 and Leon3 processors. Time is not accurately emulated and runs too fast, so if you have periodic tasks they will not appear to run at the right pace. But it is a good way to quickly test your application's logic and verify it behaves as expected - since all your stdout that would normally go over the serial cable will appear in your screen (in C terms, `puts`, `printf`, etc).

To use these emulators, make sure you compile using the POHIC runtime (not POHIAda), and of course use the RTEMS POSIX platform in your Deployment view. You will also need to point the RTEMS_MAKEFILE_PATH_LEON to your desired target BSP:

  • Leon3 (e.g. GR712RC): export RTEMS_MAKEFILE_PATH_LEON=/opt/rtems-4.11/sparc-rtems4.11/leon3
  • Leon2 (e.g. AT697E): export RTEMS_MAKEFILE_PATH_LEON=/opt/rtems-4.11/sparc-rtems4.11/leon2

And then build as usual.

LEON3

For Leon3, there is a ready-made script for you:

   $ xterm -e taste-simulate-leon3 /path/to/your/binary

Spawning under an xterm will allow you to easily stop the emulator - which is not easy in a console, since it won't accept "Ctrl-C". You can also debug your binary under QEMU's GDB interface, using:

   $ xterm -e taste-simulate-leon3-gdb /path/to/your/binary

...and then, use sparc-rtems4.11-gdb to connect via 'tar extended-remote :9976' from another terminal:

   $ sparc-rtems4.11-gdb /path/to/your/binary
   (gdb) tar extended-remote :9976
   (gdb) b someFunction
   (gdb) c
   Continuing.
   ...
   Breakpoint 1, someFunction () at simple_c_function.c:26
   26              printf ("Hello, world...\n");

...etc.

LEON2

Similarly, after building, to spawn your leon2 binary under QEMU, use something like this:

   $ xterm -e taste-simulate-leon2 /path/to/your/binary

Note though that this one has been compiled without FPU support - so make sure you pass "-msoft-float" to your cross-compiler when building your binaries.

And if you want to debug over the GDB interface, use taste-simulate-leon2-gdb, as above.