URL
https://opencores.org/ocsvn/neorv32/neorv32/trunk
[/] [neorv32/] [trunk/] [docs/] [userguide/] [application_program_compilation.adoc] - Blame information for rev 69
Go to most recent revision |
Details |
Compare with Previous |
View Log
Line No. |
Rev |
Author |
Line |
1 |
69 |
zero_gravi |
<<<
|
2 |
|
|
:sectnums:
|
3 |
|
|
== Application Program Compilation
|
4 |
|
|
|
5 |
|
|
This guide shows how to compile an example C-code application into a NEORV32 executable that
|
6 |
|
|
can be uploaded via the bootloader or the on-chip debugger.
|
7 |
|
|
|
8 |
|
|
[IMPORTANT]
|
9 |
|
|
If your FPGA board does not provide such an interface - don't worry!
|
10 |
|
|
Section <<_installing_an_executable_directly_into_memory>> shows how to
|
11 |
|
|
run custom programs on your FPGA setup without having a UART.
|
12 |
|
|
|
13 |
|
|
[start=1]
|
14 |
|
|
. Open a terminal console and navigate to one of the project's example programs. For instance, navigate to the
|
15 |
|
|
simple `sw/example_blink_led` example program. This program uses the NEORV32 GPIO module to display
|
16 |
|
|
an 8-bit counter on the lowest eight bit of the `gpio_o` output port.
|
17 |
|
|
. To compile the project and generate an executable simply execute:
|
18 |
|
|
|
19 |
|
|
[source,bash]
|
20 |
|
|
----
|
21 |
|
|
neorv32/sw/example/blink_led$ make clean_all exe
|
22 |
|
|
----
|
23 |
|
|
|
24 |
|
|
[start=3]
|
25 |
|
|
. We are using the `clean_all` target to make sure everything is re-build.
|
26 |
|
|
. This will compile and link the application sources together with all the included libraries. At the end,
|
27 |
|
|
your application is transformed into an ELF file (`main.elf`). The _NEORV32 image generator_ (in `sw/image_gen`)
|
28 |
|
|
takes this file and creates a final executable. The makefile will show the resulting memory utilization and
|
29 |
|
|
the executable size:
|
30 |
|
|
|
31 |
|
|
[source,bash]
|
32 |
|
|
----
|
33 |
|
|
neorv32/sw/example/blink_led$ make clean_all exe
|
34 |
|
|
Memory utilization:
|
35 |
|
|
text data bss dec hex filename
|
36 |
|
|
3176 0 120 3296 ce0 main.elf
|
37 |
|
|
Compiling ../../../sw/image_gen/image_gen
|
38 |
|
|
Executable (neorv32_exe.bin) size in bytes:
|
39 |
|
|
3188
|
40 |
|
|
----
|
41 |
|
|
|
42 |
|
|
[start=5]
|
43 |
|
|
. That's it. The `exe` target has created the actual executable `neorv32_exe.bin` in the current folder
|
44 |
|
|
that is ready to be uploaded to the processor.
|
45 |
|
|
|
46 |
|
|
[TIP]
|
47 |
|
|
The compilation process will also create a `main.asm` assembly listing file in the current folder, which
|
48 |
|
|
shows the actual assembly code of the application.
|
© copyright 1999-2025
OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.