Line 122... |
Line 122... |
help - show this text
|
help - show this text
|
check - check toolchain
|
check - check toolchain
|
info - show makefile/toolchain configuration
|
info - show makefile/toolchain configuration
|
exe - compile and generate executable for upload via bootloader
|
exe - compile and generate executable for upload via bootloader
|
hex - compile and generate executable raw file
|
hex - compile and generate executable raw file
|
|
image - compile and generate VHDL IMEM boot image (for application) in local folder
|
install - compile, generate and install VHDL IMEM boot image (for application)
|
install - compile, generate and install VHDL IMEM boot image (for application)
|
sim - in-console simulation using the default testbench and GHDL
|
sim - in-console simulation using default/simple testbench and GHDL
|
all - exe + hex + install
|
all - exe + hex + install
|
elf_info - show ELF layout info
|
elf_info - show ELF layout info
|
clean - clean up project
|
clean - clean up project
|
clean_all - clean up project, core libraries and image generator
|
clean_all - clean up project, core libraries and image generator
|
|
bl_image - compile and generate VHDL BOOTROM boot image (for bootloader only!) in local folder
|
bootloader - compile, generate and install VHDL BOOTROM boot image (for bootloader only!)
|
bootloader - compile, generate and install VHDL BOOTROM boot image (for bootloader only!)
|
----
|
----
|
|
|
|
|
:sectnums:
|
:sectnums:
|
Line 140... |
Line 142... |
The compilation flow is configured via variables right at the beginning of the **central**
|
The compilation flow is configured via variables right at the beginning of the **central**
|
makefile (`sw/common/common.mk`):
|
makefile (`sw/common/common.mk`):
|
|
|
[TIP]
|
[TIP]
|
The makefile configuration variables can be (re-)defined directly when invoking the makefile. For
|
The makefile configuration variables can be (re-)defined directly when invoking the makefile. For
|
example via `$ make MARCH=-march=rv32ic clean_all exe`. You can also make project-specific definitions
|
example via `$ make MARCH=rv32ic clean_all exe`. You can also make project-specific definitions
|
of all variables inside the project's actual makefile (e.g., `sw/example/blink_led/makefile`).
|
of all variables inside the project's actual makefile (e.g., `sw/example/blink_led/makefile`).
|
|
|
[source,makefile]
|
[source,makefile]
|
----
|
----
|
# *****************************************************************************
|
# *****************************************************************************
|
Line 160... |
Line 162... |
# Optimization
|
# Optimization
|
EFFORT ?= -Os
|
EFFORT ?= -Os
|
# Compiler toolchain
|
# Compiler toolchain
|
RISCV_PREFIX ?= riscv32-unknown-elf-
|
RISCV_PREFIX ?= riscv32-unknown-elf-
|
# CPU architecture and ABI
|
# CPU architecture and ABI
|
MARCH ?= -march=rv32i
|
MARCH ?= rv32i
|
MABI ?= -mabi=ilp32
|
MABI ?= ilp32
|
# User flags for additional configuration (will be added to compiler flags)
|
# User flags for additional configuration (will be added to compiler flags)
|
USER_FLAGS ?=
|
USER_FLAGS ?=
|
# Relative or absolute path to the NEORV32 home folder
|
# Relative or absolute path to the NEORV32 home folder
|
NEORV32_HOME ?= ../../..
|
NEORV32_HOME ?= ../../..
|
# *****************************************************************************
|
# *****************************************************************************
|
Line 177... |
Line 179... |
| _APP_SRC_ | The source files of the application (`*.c`, `*.cpp`, `*.S` and `*.s` files are allowed; file of these types in the project folder are automatically added via wildcards). Additional files can be added; separated by white spaces
|
| _APP_SRC_ | The source files of the application (`*.c`, `*.cpp`, `*.S` and `*.s` files are allowed; file of these types in the project folder are automatically added via wildcards). Additional files can be added; separated by white spaces
|
| _APP_INC_ | Include file folders; separated by white spaces; must be defined with `-I` prefix
|
| _APP_INC_ | Include file folders; separated by white spaces; must be defined with `-I` prefix
|
| _ASM_INC_ | Include file folders that are used only for the assembly source files (`*.S`/`*.s`).
|
| _ASM_INC_ | Include file folders that are used only for the assembly source files (`*.S`/`*.s`).
|
| _EFFORT_ | Optimization level, optimize for size (`-Os`) is default; legal values: `-O0`, `-O1`, `-O2`, `-O3`, `-Os`
|
| _EFFORT_ | Optimization level, optimize for size (`-Os`) is default; legal values: `-O0`, `-O1`, `-O2`, `-O3`, `-Os`
|
| _RISCV_PREFIX_ | The toolchain prefix to be used; follows the naming convention "architecture-vendor-output-"
|
| _RISCV_PREFIX_ | The toolchain prefix to be used; follows the naming convention "architecture-vendor-output-"
|
| _MARCH_ | The targetd RISC-V architecture/ISA. Only `rv32` is supported by the NEORV32. Enable compiler support of optional CPU extension by adding the according extension letter (e.g. `rv32im` for _M_ CPU extension). See https://stnolting.github.io/neorv32/ug/#_enabling_risc_v_cpu_extensions[User Guide: Enabling RISC-V CPU Extensions] for more information.
|
| _MARCH_ | The targeted RISC-V architecture/ISA. Only `rv32` is supported by the NEORV32. Enable compiler support of optional CPU extension by adding the according extension letter (e.g. `rv32im` for _M_ CPU extension). See https://stnolting.github.io/neorv32/ug/#_enabling_risc_v_cpu_extensions[User Guide: Enabling RISC-V CPU Extensions] for more information.
|
| _MABI_ | The default 32-bit integer ABI.
|
| _MABI_ | The default 32-bit integer ABI.
|
| _USER_FLAGS_ | Additional flags that will be forwarded to the compiler tools
|
| _USER_FLAGS_ | Additional flags that will be forwarded to the compiler tools
|
| _NEORV32_HOME_ | Relative or absolute path to the NEORV32 project home folder. Adapt this if the makefile/project is not in the project's `sw/example folder`.
|
| _NEORV32_HOME_ | Relative or absolute path to the NEORV32 project home folder. Adapt this if the makefile/project is not in the project's `sw/example folder`.
|
| _COM_PORT_ | Default serial port for executable upload to bootloader.
|
| _COM_PORT_ | Default serial port for executable upload to bootloader.
|
|=======================
|
|=======================
|
Line 372... |
Line 374... |
.After-main handler - example
|
.After-main handler - example
|
[source,c]
|
[source,c]
|
----
|
----
|
int __neorv32_crt0_after_main(int32_t return_code) {
|
int __neorv32_crt0_after_main(int32_t return_code) {
|
|
|
neorv32_uart_printf("Main returned with code: %i\n", return_code);
|
neorv32_uart0_printf("Main returned with code: %i\n", return_code);
|
return 0;
|
return 0;
|
}
|
}
|
----
|
----
|
|
|
|
|