GR712RC-QSG
November 2018, Version 1.0
16 www.cobham.com/gaisler
sparc-gaisler-elf-gcc -O2 -g hello.c -o hello.elf
All GCC options are described in the gcc manual, but some useful options are reported below:
Table 4.2. BCC's GCC compiler relevant options
-g generate debugging information - must be used for debugging with gdb
-msoft-float emulate floating-point - must be used if no FPU exists in the system
-O2 optimize for speed
-Os optimize for size
-qsvt use the single-vector trap model
-mflat enable flat register window model. The compiler will not emit SAVE and RESTORE
instructions.
It is recommended to use the options
-qbsp=gr712rc -mcpu=leon3 -mfix-gr712rc
with GR712RC. For more details on, see [RD-10].
4.2.3. Running and debugging with GRMON
Once your application is compiled, connect to your GR712RC-BOARD with GRMON. The following log shows
how to load and run an application. Note that the console output is redirected to GRMON by the use of the -u
command line switch, so that the application standard output is forwarded to the GRMON console.
[andrea@localhost Desktop]$ grmon -ftdi -u
GRMON2 LEON debug monitor v2.0.42 professional version
Copyright (C) 2013 Aeroflex Gaisler - All rights reserved.
For latest updates, go to http://www.gaisler.com/
Comments or bug-reports to support@gaisler.com
Parsing -ftdi
Parsing -u
[...]
grmon2> load hello.elf
40000000 .text 23.6kB / 23.6kB [===============>] 100%
40005E70 .data 2.7kB / 2.7kB [===============>] 100%
Total size: 26.29kB (803.58kbit/s)
Entry point 0x40000000
Image /home/andrea/Desktop/hello.elf loaded
grmon2> run
Hello world!
CPU 0: Program exited normally.
CPU 1: Power down mode
To debug the compiled program you can insert breakpoints, step and continue execution directly from the GRMON
console. Compilation symbols are loaded automatically by GRMON once you load the application. An example
is provided below.
grmon2> load hello.elf
40000000 .text 23.6kB / 23.6kB [===============>] 100%
40005E70 .data 2.7kB / 2.7kB [===============>] 100%
Total size: 26.29kB (806.59kbit/s)
Entry point 0x40000000
Image /home/andrea/Desktop/hello.elf loaded
grmon2> bp main
Software breakpoint 1 at <main>
grmon2> run
CPU 0: breakpoint 1 hit
0x40001928: b0102000 mov 0, %i0 <main+4>
CPU 1: Power down mode
grmon2> step