Skip to content

Commit

Permalink
Merge pull request #338 from akaeba/divide_neorv32_application_image
Browse files Browse the repository at this point in the history
[rtl] split executable images into package and body
  • Loading branch information
stnolting authored Jun 7, 2022
2 parents 6a412d6 + bbd27a8 commit d5e9b48
Show file tree
Hide file tree
Showing 5 changed files with 52 additions and 37 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ mimpid = 0x01040312 => 01.04.03.12 => Version 01.04.03.12 => v1.4.3.12

| Date (*dd.mm.yyyy*) | Version | Comment |
|:----------:|:-------:|:--------|
| 06.06.2022 | 1.7.2.4 | split executable images into package and body; [#338](https://github.com/stnolting/neorv32/pull/338) |
| 04.06.2022 | 1.7.2.3 | :bug: fixed bug in **SPI** and **XIP** modules: phase offset between SPI clock and SPI data; [#336](https://github.com/stnolting/neorv32/pull/336) |
| 03.06.2022 | 1.7.2.2 | :sparkles: (finally) added a **dedicated hardware reset** to all IO/peripheral devices; [#334](https://github.com/stnolting/neorv32/pull/334) |
| 02.06.2022 | 1.7.2.1 | :sparkles: add **watchdog** pause flag to stop watchdog timeout counter when CPU is in sleep mode; [#331](https://github.com/stnolting/neorv32/pull/331) |
Expand Down
9 changes: 2 additions & 7 deletions rtl/core/neorv32_application_image.vhd
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,8 @@
-- MARCH: default
-- Built: 03.06.2022 06:03:44

library ieee;
use ieee.std_logic_1164.all;

library neorv32;
use neorv32.neorv32_package.all;

package neorv32_application_image is
-- prototype defined in 'neorv32_package.vhd'
package body neorv32_application_image is

constant application_init_image : mem32_t := (
00000000 => x"30005073",
Expand Down
9 changes: 2 additions & 7 deletions rtl/core/neorv32_bootloader_image.vhd
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,8 @@
-- MARCH: default
-- Built: 03.06.2022 06:02:56

library ieee;
use ieee.std_logic_1164.all;

library neorv32;
use neorv32.neorv32_package.all;

package neorv32_bootloader_image is
-- prototype defined in 'neorv32_package.vhd'
package body neorv32_bootloader_image is

constant bootloader_init_image : mem32_t := (
00000000 => x"30005073",
Expand Down
34 changes: 33 additions & 1 deletion rtl/core/neorv32_package.vhd
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ package neorv32_package is
-- Architecture Constants (do not modify!) ------------------------------------------------
-- -------------------------------------------------------------------------------------------
constant data_width_c : natural := 32; -- native data path width - do not change!
constant hw_version_c : std_ulogic_vector(31 downto 0) := x"01070203"; -- NEORV32 version - no touchy!
constant hw_version_c : std_ulogic_vector(31 downto 0) := x"01070204"; -- NEORV32 version - no touchy!
constant archid_c : natural := 19; -- official NEORV32 architecture ID - hands off!

-- Check if we're inside the Matrix -------------------------------------------------------
Expand Down Expand Up @@ -2521,3 +2521,35 @@ package body neorv32_package is


end neorv32_package;


-- Prototype Definition: bootloader_init_image --------------------------------------------
-- -------------------------------------------------------------------------------------------
-- > memory content in 'neorv32_bootloader_image.vhd', auto-generated by 'image_gen'
-- > used by 'neorv32_boot_rom.vhd'
-- > enables body-only recompile in case of firmware change
library ieee;
use ieee.std_logic_1164.all;

library neorv32;
use neorv32.neorv32_package.all;

package neorv32_bootloader_image is
constant bootloader_init_image : mem32_t;
end neorv32_bootloader_image;


-- Prototype Definition: neorv32_application_image ----------------------------------------
-- -------------------------------------------------------------------------------------------
-- > memory content in 'neorv32_application_image.vhd', auto-generated by 'image_gen'
-- > used by 'mem/neorv32_imem.*.vhd'
-- > enables body-only recompile in case of firmware change
library ieee;
use ieee.std_logic_1164.all;

library neorv32;
use neorv32.neorv32_package.all;

package neorv32_application_image is
constant application_init_image : mem32_t;
end neorv32_application_image;
36 changes: 14 additions & 22 deletions sw/image_gen/image_gen.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,9 @@ int main(int argc, char *argv[]) {
"Three arguments are required.\n"
"1st: Option\n"
" -app_bin : Generate application executable binary (binary file, little-endian, with header) \n"
" -app_hex : Generate application raw executable (hex file, no header)\n"
" -app_img : Generate application raw executable memory image (vhdl file, no header)\n"
" -bld_img : Generate bootloader raw executable memory image (vdhl file, no header)\n"
" -app_hex : Generate application raw executable (ASCII hex file, no header)\n"
" -app_img : Generate application raw executable memory image (vhdl package body file, no header)\n"
" -bld_img : Generate bootloader raw executable memory image (vhdl package body file, no header)\n"
"2nd: Input file (raw binary image)\n"
"3rd: Output file\n"
"4th: Project folder (optional)\n");
Expand Down Expand Up @@ -208,24 +208,20 @@ int main(int argc, char *argv[]) {


// ------------------------------------------------------------
// Generate APPLICATION's executable memory init file (no header!)
// Generate APPLICATION's executable memory initialization file (no header!)
// => VHDL package body
// ------------------------------------------------------------
if (option == 2) {

// header
sprintf(tmp_string, "-- The NEORV32 RISC-V Processor, https://github.com/stnolting/neorv32\n"
"-- Auto-generated memory init file (for APPLICATION) from source file <%s/%s>\n"
"-- Auto-generated memory initialization file (for APPLICATION) from source file <%s/%s>\n"
"-- Size: %lu bytes\n"
"-- MARCH: %s\n"
"-- Built: %s\n"
"\n"
"library ieee;\n"
"use ieee.std_logic_1164.all;\n"
"\n"
"library neorv32;\n"
"use neorv32.neorv32_package.all;\n"
"\n"
"package neorv32_application_image is\n"
"-- prototype defined in 'neorv32_package.vhd'\n"
"package body neorv32_application_image is\n"
"\n"
" constant application_init_image : mem32_t := (\n", argv[4], argv[2], raw_exe_size, string_march, compile_time);
fputs(tmp_string, output);
Expand Down Expand Up @@ -283,24 +279,20 @@ int main(int argc, char *argv[]) {


// ------------------------------------------------------------
// Generate BOOTLOADER's executable memory init file (no header!)
// Generate BOOTLOADER's executable memory initialization file (no header!)
// => VHDL package body
// ------------------------------------------------------------
if (option == 3) {

// header
sprintf(tmp_string, "-- The NEORV32 RISC-V Processor, https://github.com/stnolting/neorv32\n"
"-- Auto-generated memory init file (for BOOTLOADER) from source file <%s/%s>\n"
"-- Auto-generated memory initialization file (for BOOTLOADER) from source file <%s/%s>\n"
"-- Size: %lu bytes\n"
"-- MARCH: %s\n"
"-- Built: %s\n"
"\n"
"library ieee;\n"
"use ieee.std_logic_1164.all;\n"
"\n"
"library neorv32;\n"
"use neorv32.neorv32_package.all;\n"
"\n"
"package neorv32_bootloader_image is\n"
"-- prototype defined in 'neorv32_package.vhd'\n"
"package body neorv32_bootloader_image is\n"
"\n"
" constant bootloader_init_image : mem32_t := (\n", argv[4], argv[2], raw_exe_size, string_march, compile_time);
fputs(tmp_string, output);
Expand Down Expand Up @@ -358,7 +350,7 @@ int main(int argc, char *argv[]) {


// ------------------------------------------------------------
// Generate APPLICATION's executable hex file (no header!!!)
// Generate APPLICATION's executable ASCII hex file (no header!!!)
// ------------------------------------------------------------
if (option == 4) {

Expand Down

0 comments on commit d5e9b48

Please sign in to comment.