mirror of
https://github.com/stnolting/neorv32.git
synced 2025-04-24 22:27:21 -04:00
[docs] rename minimal blink_led deo project
This commit is contained in:
parent
16dc221948
commit
c58c3955ed
8 changed files with 22 additions and 22 deletions
|
@ -137,7 +137,7 @@ The makefile is invoked by simply executing `make` in the console. For example:
|
||||||
|
|
||||||
[source,bash]
|
[source,bash]
|
||||||
----
|
----
|
||||||
neorv32/sw/example/blink_led$ make
|
neorv32/sw/example/demo_blink_led$ make
|
||||||
----
|
----
|
||||||
|
|
||||||
:sectnums:
|
:sectnums:
|
||||||
|
@ -191,7 +191,7 @@ makefile (`sw/common/common.mk`):
|
||||||
The makefile configuration variables can be overridden or extended directly when invoking the makefile. For
|
The makefile configuration variables can be overridden or extended directly when invoking the makefile. For
|
||||||
example `$ make MARCH=rv32ic clean_all exe` overrides the default `MARCH` variable definitions.
|
example `$ make MARCH=rv32ic clean_all exe` overrides the default `MARCH` variable definitions.
|
||||||
Permanent modifications/definitions can be made in the project-local makefile
|
Permanent modifications/definitions can be made in the project-local makefile
|
||||||
(e.g., `sw/example/blink_led/makefile`).
|
(e.g., `sw/example/demo_blink_led/makefile`).
|
||||||
|
|
||||||
.Default Makefile Configuration
|
.Default Makefile Configuration
|
||||||
[source,makefile]
|
[source,makefile]
|
||||||
|
|
|
@ -12,13 +12,13 @@ run custom programs on your FPGA setup without having a UART.
|
||||||
|
|
||||||
[start=1]
|
[start=1]
|
||||||
. Open a terminal console and navigate to one of the project's example programs. For instance, navigate to the
|
. Open a terminal console and navigate to one of the project's example programs. For instance, navigate to the
|
||||||
simple `sw/example_blink_led` example program. This program uses the NEORV32 GPIO module to display
|
simple `sw/example_demo_blink_led` example program. This program uses the NEORV32 GPIO module to display
|
||||||
an 8-bit counter on the lowest eight bit of the `gpio_o` output port.
|
an 8-bit counter on the lowest eight bit of the `gpio_o` output port.
|
||||||
. To compile the project and generate an executable simply execute:
|
. To compile the project and generate an executable simply execute:
|
||||||
|
|
||||||
[source,bash]
|
[source,bash]
|
||||||
----
|
----
|
||||||
neorv32/sw/example/blink_led$ make clean_all exe
|
neorv32/sw/example/demo_blink_led$ make clean_all exe
|
||||||
----
|
----
|
||||||
|
|
||||||
[start=3]
|
[start=3]
|
||||||
|
@ -30,7 +30,7 @@ the executable size:
|
||||||
|
|
||||||
[source,bash]
|
[source,bash]
|
||||||
----
|
----
|
||||||
neorv32/sw/example/blink_led$ make clean_all exe
|
neorv32/sw/example/demo_blink_led$ make clean_all exe
|
||||||
Memory utilization:
|
Memory utilization:
|
||||||
text data bss dec hex filename
|
text data bss dec hex filename
|
||||||
3176 0 120 3296 ce0 main.elf
|
3176 0 120 3296 ce0 main.elf
|
||||||
|
|
|
@ -97,17 +97,17 @@ the `misa` CSRs). The processor is halted and OpenOCD waits fot `gdb` to connect
|
||||||
[TIP]
|
[TIP]
|
||||||
The GNU debugger is part of the RISC-V GCC toolchain (see <<_software_toolchain_setup>>).
|
The GNU debugger is part of the RISC-V GCC toolchain (see <<_software_toolchain_setup>>).
|
||||||
|
|
||||||
This guide uses the simple "blink example" from `sw/example/blink_led` as simplified test application to
|
This guide uses the simple "blink example" from `sw/example/demo_blink_led` as simplified test application to
|
||||||
show the basics of in-system debugging.
|
show the basics of in-system debugging.
|
||||||
|
|
||||||
At first, the application needs to be compiled. We will use the minimal machine architecture configuration
|
At first, the application needs to be compiled. We will use the minimal machine architecture configuration
|
||||||
(`rv32i`) here to be independent of the actual processor/CPU configuration.
|
(`rv32i`) here to be independent of the actual processor/CPU configuration.
|
||||||
Navigate to `sw/example/blink_led` and compile the application:
|
Navigate to `sw/example/demo_blink_led` and compile the application:
|
||||||
|
|
||||||
.Compile the test application
|
.Compile the test application
|
||||||
[source, bash]
|
[source, bash]
|
||||||
--------------------------
|
--------------------------
|
||||||
.../neorv32/sw/example/blink_led$ make MARCH=rv32i USER_FLAGS+=-g clean_all all
|
.../neorv32/sw/example/demo_blink_led$ make MARCH=rv32i USER_FLAGS+=-g clean_all all
|
||||||
--------------------------
|
--------------------------
|
||||||
|
|
||||||
.Adding debug symbols to the executable
|
.Adding debug symbols to the executable
|
||||||
|
@ -119,12 +119,12 @@ to the generated ELF file. This is optional but will provide more sophisticated
|
||||||
This will generate an ELF file `main.elf` that contains all the symbols required for debugging.
|
This will generate an ELF file `main.elf` that contains all the symbols required for debugging.
|
||||||
Furthermore, an assembly listing file `main.asm` is generated that we will use to define breakpoints.
|
Furthermore, an assembly listing file `main.asm` is generated that we will use to define breakpoints.
|
||||||
|
|
||||||
Open another terminal in `sw/example/blink_led` and start `gdb`.
|
Open another terminal in `sw/example/demo_blink_led` and start `gdb`.
|
||||||
|
|
||||||
.Starting GDB (on Linux (Ubuntu on Windows))
|
.Starting GDB (on Linux (Ubuntu on Windows))
|
||||||
[source, bash]
|
[source, bash]
|
||||||
--------------------------
|
--------------------------
|
||||||
.../neorv32/sw/example/blink_led$ riscv32-unknown-elf-gdb
|
.../neorv32/sw/example/demo_blink_led$ riscv32-unknown-elf-gdb
|
||||||
GNU gdb (GDB) 10.1
|
GNU gdb (GDB) 10.1
|
||||||
Copyright (C) 2020 Free Software Foundation, Inc.
|
Copyright (C) 2020 Free Software Foundation, Inc.
|
||||||
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
|
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
|
||||||
|
@ -144,7 +144,7 @@ Type "apropos word" to search for commands related to "word".
|
||||||
--------------------------
|
--------------------------
|
||||||
|
|
||||||
Now connect to OpenOCD using the default port 3333 on your machine.
|
Now connect to OpenOCD using the default port 3333 on your machine.
|
||||||
We will use the previously generated ELF file `main.elf` from the `blink_led` example.
|
We will use the previously generated ELF file `main.elf` from the `demo_blink_led` example.
|
||||||
Finally, upload the program to the processor and start debugging.
|
Finally, upload the program to the processor and start debugging.
|
||||||
|
|
||||||
[NOTE]
|
[NOTE]
|
||||||
|
@ -173,12 +173,12 @@ Transfer rate: 43 KB/sec, 2132 bytes/write.
|
||||||
--------------------------
|
--------------------------
|
||||||
<1> Connect to OpenOCD
|
<1> Connect to OpenOCD
|
||||||
<2> The CPU was still executing code from the bootloader ROM - but that does not matter here
|
<2> The CPU was still executing code from the bootloader ROM - but that does not matter here
|
||||||
<3> Select `mail.elf` from the `blink_led` example
|
<3> Select `mail.elf` from the `demo_blink_led` example
|
||||||
<4> Upload the executable
|
<4> Upload the executable
|
||||||
|
|
||||||
After the upload, GDB will make the processor jump to the beginning of the uploaded executable
|
After the upload, GDB will make the processor jump to the beginning of the uploaded executable
|
||||||
(by default, this is the beginning of the instruction memory at `0x00000000`) skipping the bootloader
|
(by default, this is the beginning of the instruction memory at `0x00000000`) skipping the bootloader
|
||||||
and halting the CPU right before executing the `blink_led` application.
|
and halting the CPU right before executing the `demo_blink_led` application.
|
||||||
|
|
||||||
[IMPORTANT]
|
[IMPORTANT]
|
||||||
After gdb has connected to the CPU, it is recommended to disable the CPU's global interrupt flag
|
After gdb has connected to the CPU, it is recommended to disable the CPU's global interrupt flag
|
||||||
|
@ -193,15 +193,15 @@ interrupt flag can be cleared using the following gdb command:
|
||||||
|
|
||||||
The following steps are just a small showcase that illustrate a simple debugging scheme.
|
The following steps are just a small showcase that illustrate a simple debugging scheme.
|
||||||
|
|
||||||
While compiling `blink_led`, an assembly listing file `main.asm` was generated.
|
While compiling `demo_blink_led`, an assembly listing file `main.asm` was generated.
|
||||||
Open this file with a text editor to check out what the CPU is going to do when resumed.
|
Open this file with a text editor to check out what the CPU is going to do when resumed.
|
||||||
|
|
||||||
The `blink_led` example implements a simple counter on the 8 lowest GPIO output ports. The program uses
|
The `demo_blink_led` example implements a simple counter on the 8 lowest GPIO output ports. The program uses
|
||||||
"busy wait" to have a visible delay between increments. This waiting is done by calling the `neorv32_cpu_delay_ms`
|
"busy wait" to have a visible delay between increments. This waiting is done by calling the `neorv32_cpu_delay_ms`
|
||||||
function. We will add a _breakpoint_ right at the end of this wait function so we can step through the iterations
|
function. We will add a _breakpoint_ right at the end of this wait function so we can step through the iterations
|
||||||
of the counter.
|
of the counter.
|
||||||
|
|
||||||
.Cut-out from `main.asm` generated from the `blink_led` example
|
.Cut-out from `main.asm` generated from the `demo_blink_led` example
|
||||||
[source, assembly]
|
[source, assembly]
|
||||||
--------------------------
|
--------------------------
|
||||||
00000688 <__neorv32_cpu_delay_ms_end>:
|
00000688 <__neorv32_cpu_delay_ms_end>:
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
Whenever you enable/disable a RISC-V CPU extensions via the according `CPU_EXTENSION_RISCV_x` generic, you need to
|
Whenever you enable/disable a RISC-V CPU extensions via the according `CPU_EXTENSION_RISCV_x` generic, you need to
|
||||||
adapt the toolchain configuration so the compiler can actually generate according code for it.
|
adapt the toolchain configuration so the compiler can actually generate according code for it.
|
||||||
|
|
||||||
To do so, open the makefile of your project (for example `sw/example/blink_led/makefile`) and scroll to the
|
To do so, open the makefile of your project (for example `sw/example/demo_blink_led/makefile`) and scroll to the
|
||||||
"USER CONFIGURATION" section right at the beginning of the file. You need to modify the `MARCH` variable and eventually
|
"USER CONFIGURATION" section right at the beginning of the file. You need to modify the `MARCH` variable and eventually
|
||||||
the `MABI` variable according to your CPU hardware configuration.
|
the `MABI` variable according to your CPU hardware configuration.
|
||||||
|
|
||||||
|
|
|
@ -46,7 +46,7 @@ Using the IMEM as ROM:
|
||||||
|
|
||||||
[source,bash]
|
[source,bash]
|
||||||
----
|
----
|
||||||
neorv32/sw/example/blink_led$ make clean_all install
|
neorv32/sw/example/demo_blink_led$ make clean_all install
|
||||||
Memory utilization:
|
Memory utilization:
|
||||||
text data bss dec hex filename
|
text data bss dec hex filename
|
||||||
3176 0 120 3296 ce0 main.elf
|
3176 0 120 3296 ce0 main.elf
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
[start=1]
|
[start=1]
|
||||||
. The easiest way of creating a _new_ software application project is to copy an _existing_ one. This will keep all
|
. The easiest way of creating a _new_ software application project is to copy an _existing_ one. This will keep all
|
||||||
file dependencies. For example you can copy `sw/example/blink_led` to `sw/example/flux_capacitor`.
|
file dependencies. For example you can copy `sw/example/demo_blink_led` to `sw/example/flux_capacitor`.
|
||||||
. If you want to place you application somewhere outside `sw/example` you need to adapt the application's makefile.
|
. If you want to place you application somewhere outside `sw/example` you need to adapt the application's makefile.
|
||||||
In the makefile you will find a variable that keeps the relative or absolute path to the NEORV32 repository home
|
In the makefile you will find a variable that keeps the relative or absolute path to the NEORV32 repository home
|
||||||
folder. Just modify this variable according to your new project's home location:
|
folder. Just modify this variable according to your new project's home location:
|
||||||
|
|
|
@ -105,7 +105,7 @@ _USER_FLAGS_ variable (do not forget the `-D` suffix flag):
|
||||||
|
|
||||||
[source, bash]
|
[source, bash]
|
||||||
----
|
----
|
||||||
sw/example/blink_led$ make USER_FLAGS+=-DUART0_SIM_MODE clean_all all
|
sw/example/demo_blink_led$ make USER_FLAGS+=-DUART0_SIM_MODE clean_all all
|
||||||
----
|
----
|
||||||
|
|
||||||
The provided define will change the default UART0/UART1 setup function in order to set the simulation
|
The provided define will change the default UART0/UART1 setup function in order to set the simulation
|
||||||
|
@ -139,7 +139,7 @@ faster / direct-to-console UART output.
|
||||||
|
|
||||||
[source, bash]
|
[source, bash]
|
||||||
----
|
----
|
||||||
sw/example/blink_led$ make USER_FLAGS+=-DUART0_SIM_MODE clean_all sim
|
sw/example/demo_blink_led$ make USER_FLAGS+=-DUART0_SIM_MODE clean_all sim
|
||||||
[...]
|
[...]
|
||||||
Blinking LED demo program
|
Blinking LED demo program
|
||||||
----
|
----
|
||||||
|
|
|
@ -88,7 +88,7 @@ execute the following command:
|
||||||
|
|
||||||
[source,bash]
|
[source,bash]
|
||||||
----
|
----
|
||||||
neorv32/sw/example/blink_led$ make check
|
neorv32/sw/example/demo_blink_led$ make check
|
||||||
----
|
----
|
||||||
|
|
||||||
This will test all the tools required for generating NEORV32 executables.
|
This will test all the tools required for generating NEORV32 executables.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue