Line 49... |
Line 49... |
[source,c]
|
[source,c]
|
----
|
----
|
#include
|
#include
|
----
|
----
|
|
|
|
[TIP]
|
|
A CMSIS-SVD-compatible **System View Description (SVD)** file including all peripherals is available in `sw/svd`.
|
|
|
Together with the makefile, this will automatically include all the processor's header files located in
|
Together with the makefile, this will automatically include all the processor's header files located in
|
`sw/lib/include` into your application. The actual source files of the core libraries are located in
|
`sw/lib/include` into your application. The actual source files of the core libraries are located in
|
`sw/lib/source` and are automatically included into the source list of your software project. The following
|
`sw/lib/source` and are automatically included into the source list of your software project. The following
|
files are currently part of the NEORV32 core library:
|
files are currently part of the NEORV32 core library:
|
|
|
Line 63... |
Line 66... |
| - | `neorv32.h` | main NEORV32 definitions and library file
|
| - | `neorv32.h` | main NEORV32 definitions and library file
|
| `neorv32_cfs.c` | `neorv32_cfs.h` | HW driver (stub)footnote:[This driver file only represents a stub, since the real CFS drivers are defined by the actual CFS implementation.] functions for the custom functions subsystem
|
| `neorv32_cfs.c` | `neorv32_cfs.h` | HW driver (stub)footnote:[This driver file only represents a stub, since the real CFS drivers are defined by the actual CFS implementation.] functions for the custom functions subsystem
|
| `neorv32_cpu.c` | `neorv32_cpu.h` | HW driver functions for the NEORV32 **CPU**
|
| `neorv32_cpu.c` | `neorv32_cpu.h` | HW driver functions for the NEORV32 **CPU**
|
| `neorv32_gpio.c` | `neorv32_gpio.h` | HW driver functions for the **GPIO**
|
| `neorv32_gpio.c` | `neorv32_gpio.h` | HW driver functions for the **GPIO**
|
| `neorv32_gptmr.c` | `neorv32_gptmr.h` | HW driver functions for the **GPTRM**
|
| `neorv32_gptmr.c` | `neorv32_gptmr.h` | HW driver functions for the **GPTRM**
|
| - | `neorv32_intrinsics.h` | macros for custom intrinsics/instructions
|
| - | `neorv32_intrinsics.h` | macros for (custom) intrinsics/instructions
|
| - | `neorv32_legacy.h` | legacy back-compatibility layer
|
|
| `neorv32_mtime.c` | `neorv32_mtime.h` | HW driver functions for the **MTIME**
|
| `neorv32_mtime.c` | `neorv32_mtime.h` | HW driver functions for the **MTIME**
|
| `neorv32_neoled.c` | `neorv32_neoled.h` | HW driver functions for the **NEOLED**
|
| `neorv32_neoled.c` | `neorv32_neoled.h` | HW driver functions for the **NEOLED**
|
| `neorv32_pwm.c` | `neorv32_pwm.h` | HW driver functions for the **PWM**
|
| `neorv32_pwm.c` | `neorv32_pwm.h` | HW driver functions for the **PWM**
|
| `neorv32_rte.c` | `neorv32_rte.h` | NEORV32 **runtime environment** and helpers
|
| `neorv32_rte.c` | `neorv32_rte.h` | NEORV32 **runtime environment** and helpers
|
| `neorv32_slink.c` | `neorv32_slink.h` | HW driver functions for the **SLINK**
|
| `neorv32_slink.c` | `neorv32_slink.h` | HW driver functions for the **SLINK**
|
Line 117... |
Line 119... |
Just executing `make` (or executing `make help`) will show the help menu listing all available targets.
|
Just executing `make` (or executing `make help`) will show the help menu listing all available targets.
|
|
|
[source,makefile]
|
[source,makefile]
|
----
|
----
|
$ make
|
$ make
|
<<< NEORV32 Application Makefile >>>
|
<<< NEORV32 SW Application Makefile >>>
|
Make sure to add the bin folder of RISC-V GCC to your PATH variable.
|
Make sure to add the bin folder of RISC-V GCC to your PATH variable.
|
Targets:
|
|
|
== Targets ==
|
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
|
Line 134... |
Line 137... |
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
|
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!)
|
|
|
|
== Variables ==
|
|
USER_FLAGS - Custom toolchain flags [append only], default ""
|
|
EFFORT - Optimization level, default "-Os"
|
|
MARCH - Machine architecture, default "rv32i"
|
|
MABI - Machine binary interface, default "ilp32"
|
|
APP_INC - C include folder(s) [append only], default "-I ."
|
|
ASM_INC - ASM include folder(s) [append only], default "-I ."
|
|
RISCV_PREFIX - Toolchain prefix, default "riscv32-unknown-elf-"
|
|
NEORV32_HOME - NEORV32 home folder, default "../../.."
|
----
|
----
|
|
|
|
|
:sectnums:
|
:sectnums:
|
==== Configuration
|
==== Configuration
|
Line 504... |
Line 517... |
corresponding operation:
|
corresponding operation:
|
|
|
* `h`: Show the help text (again)
|
* `h`: Show the help text (again)
|
* `r`: Restart the bootloader and the auto-boot sequence
|
* `r`: Restart the bootloader and the auto-boot sequence
|
* `u`: Upload new program executable (`neorv32_exe.bin`) via UART into the instruction memory
|
* `u`: Upload new program executable (`neorv32_exe.bin`) via UART into the instruction memory
|
* `s`: Store executable to SPI flash at `spi_csn_o(0)`
|
* `s`: Store executable to SPI flash at `spi_csn_o(0)` (little-endian byte order)
|
* `l`: Load executable from SPI flash at `spi_csn_o(0)`
|
* `l`: Load executable from SPI flash at `spi_csn_o(0)` (little-endian byte order)
|
* `e`: Start the application, which is currently stored in the instruction memory (IMEM)
|
* `e`: Start the application, which is currently stored in the instruction memory (IMEM)
|
|
|
A new executable can be uploaded via UART by executing the `u` command. After that, the executable can be directly
|
A new executable can be uploaded via UART by executing the `u` command. After that, the executable can be directly
|
executed via the `e` command. To store the recently uploaded executable to an attached SPI flash press `s`. To
|
executed via the `e` command. To store the recently uploaded executable to an attached SPI flash press `s`. To
|
directly load an executable from the SPI flash press `l`. The bootloader and the auto-boot sequence can be
|
directly load an executable from the SPI flash press `l`. The bootloader and the auto-boot sequence can be
|