1 |
69 |
zero_gravi |
<<<
|
2 |
|
|
:sectnums:
|
3 |
|
|
== Installing an Executable Directly Into Memory
|
4 |
|
|
|
5 |
|
|
If you do not want to use the bootloader (or the on-chip debugger) for executable upload or if your setup does not provide
|
6 |
|
|
a serial interface for that, you can also directly install an application into embedded memory.
|
7 |
|
|
|
8 |
|
|
This concept uses the "Direct Boot" scenario that implements the processor-internal IMEM as ROM, which is
|
9 |
|
|
pre-initialized with the application's executable during synthesis. Hence, it provides _non-volatile_ storage of the
|
10 |
|
|
executable inside the processor. This storage cannot be altered during runtime and any source code modification of
|
11 |
|
|
the application requires to re-program the FPGA via the bitstream.
|
12 |
|
|
|
13 |
|
|
[TIP]
|
14 |
|
|
See datasheet section https://stnolting.github.io/neorv32/#_direct_boot[Direct Boot] for more information.
|
15 |
|
|
|
16 |
|
|
|
17 |
|
|
Using the IMEM as ROM:
|
18 |
|
|
|
19 |
|
|
* for this boot concept the bootloader is no longer required
|
20 |
|
|
* this concept only works for the internal IMEM (but can be extended to work with external memories coupled via the processor's bus interface)
|
21 |
|
|
* make sure that the memory components (like block RAM) the IMEM is mapped to support an initialization via the bitstream
|
22 |
|
|
|
23 |
|
|
[start=1]
|
24 |
|
|
. At first, make sure your processor setup actually implements the internal IMEM: the `MEM_INT_IMEM_EN` generics has to be set to `true`:
|
25 |
|
|
|
26 |
|
|
.Processor top entity configuration - enable internal IMEM
|
27 |
|
|
[source,vhdl]
|
28 |
|
|
----
|
29 |
|
|
-- Internal Instruction memory --
|
30 |
|
|
MEM_INT_IMEM_EN => true, -- implement processor-internal instruction memory
|
31 |
|
|
----
|
32 |
|
|
|
33 |
|
|
[start=2]
|
34 |
|
|
. For this setup we do not want the bootloader to be implemented at all. Disable implementation of the bootloader by setting the
|
35 |
|
|
`INT_BOOTLOADER_EN` generic to `false`. This will also modify the processor-internal IMEM so it is initialized with the executable during synthesis.
|
36 |
|
|
|
37 |
|
|
.Processor top entity configuration - disable internal bootloader
|
38 |
|
|
[source,vhdl]
|
39 |
|
|
----
|
40 |
|
|
-- General --
|
41 |
|
|
INT_BOOTLOADER_EN => false, -- boot configuration: false = boot from int/ext (I)MEM
|
42 |
|
|
----
|
43 |
|
|
|
44 |
|
|
[start=3]
|
45 |
|
|
. To generate an "initialization image" for the IMEM that contains the actual application, run the `install` target when compiling your application:
|
46 |
|
|
|
47 |
|
|
[source,bash]
|
48 |
|
|
----
|
49 |
|
|
neorv32/sw/example/blink_led$ make clean_all install
|
50 |
|
|
Memory utilization:
|
51 |
|
|
text data bss dec hex filename
|
52 |
|
|
3176 0 120 3296 ce0 main.elf
|
53 |
|
|
Compiling ../../../sw/image_gen/image_gen
|
54 |
|
|
Installing application image to ../../../rtl/core/neorv32_application_image.vhd
|
55 |
|
|
----
|
56 |
|
|
|
57 |
|
|
[start=4]
|
58 |
|
|
. The `install` target has compiled all the application sources but instead of creating an executable (`neorv32_exe.bit`) that can be uploaded via the
|
59 |
|
|
bootloader, it has created a VHDL memory initialization image `core/neorv32_application_image.vhd`.
|
60 |
|
|
. This VHDL file is automatically copied to the core's rtl folder (`rtl/core`) so it will be included for the next synthesis.
|
61 |
|
|
. Perform a new synthesis. The IMEM will be build as pre-initialized ROM (inferring embedded memories if possible).
|
62 |
|
|
. Upload your bitstream. Your application code now resides unchangeable in the processor's IMEM and is directly executed after reset.
|
63 |
|
|
|
64 |
|
|
|
65 |
|
|
The synthesis tool / simulator will print asserts to inform about the (IMEM) memory / boot configuration:
|
66 |
|
|
|
67 |
|
|
[source]
|
68 |
|
|
----
|
69 |
|
|
NEORV32 PROCESSOR CONFIG NOTE: Boot configuration: Direct boot from memory (processor-internal IMEM).
|
70 |
|
|
NEORV32 PROCESSOR CONFIG NOTE: Implementing processor-internal IMEM as ROM (3176 bytes), pre-initialized with application.
|
71 |
|
|
----
|