OpenCores
URL https://opencores.org/ocsvn/neorv32/neorv32/trunk

Subversion Repositories neorv32

[/] [neorv32/] [trunk/] [docs/] [userguide/] [application_program_compilation.adoc] - Blame information for rev 71

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 71 zero_gravi
[NOTE]
43
Make sure the size of the `text` segment (3176 bytes here) does not overflow the size of the processor's
44
IMEM (if used at all) - otherwise there will be an error during synthesis or during bootloader upload.
45
 
46 69 zero_gravi
[start=5]
47
. That's it. The `exe` target has created the actual executable `neorv32_exe.bin` in the current folder
48
that is ready to be uploaded to the processor.
49
 
50
[TIP]
51
The compilation process will also create a `main.asm` assembly listing file in the current folder, which
52
shows the actual assembly code of the application.

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.