mirror of
https://github.com/stnolting/neorv32.git
synced 2025-04-23 21:57:33 -04:00
[bootloader] remove XIP
This commit is contained in:
parent
4cf5a32060
commit
80e491c6d1
3 changed files with 135 additions and 222 deletions
|
@ -1,7 +1,7 @@
|
|||
-- The NEORV32 RISC-V Processor - github.com/stnolting/neorv32
|
||||
-- Auto-generated memory initialization image (for internal BOOTROM)
|
||||
-- Source: bootloader/build/main.bin
|
||||
-- Built: 01.02.2025 15:16:28
|
||||
-- Built: 01.02.2025 19:30:34
|
||||
|
||||
library ieee;
|
||||
use ieee.std_logic_1164.all;
|
||||
|
@ -11,7 +11,7 @@ use neorv32.neorv32_package.all;
|
|||
|
||||
package neorv32_bootloader_image is
|
||||
|
||||
constant bootloader_init_size_c : natural := 4040; -- bytes
|
||||
constant bootloader_init_size_c : natural := 3844; -- bytes
|
||||
constant bootloader_init_image_c : mem32_t := (
|
||||
x"f14020f3",
|
||||
x"80200217",
|
||||
|
@ -27,7 +27,7 @@ x"0fc30313",
|
|||
x"30531073",
|
||||
x"30401073",
|
||||
x"00001397",
|
||||
x"f9438393",
|
||||
x"ed038393",
|
||||
x"80200417",
|
||||
x"fc440413",
|
||||
x"80200497",
|
||||
|
@ -110,7 +110,7 @@ x"ffe017b7",
|
|||
x"00112823",
|
||||
x"00812623",
|
||||
x"00912423",
|
||||
x"a3078793",
|
||||
x"9a478793",
|
||||
x"30579073",
|
||||
x"fffe07b7",
|
||||
x"0087a783",
|
||||
|
@ -120,35 +120,7 @@ x"fff807b7",
|
|||
x"0007a023",
|
||||
x"01100713",
|
||||
x"00e7a023",
|
||||
x"fffe07b7",
|
||||
x"0087a783",
|
||||
x"2007f793",
|
||||
x"06078263",
|
||||
x"ffef07b7",
|
||||
x"0007a023",
|
||||
x"0007a423",
|
||||
x"00006737",
|
||||
x"0007a623",
|
||||
x"20570713",
|
||||
x"00e7a023",
|
||||
x"0007a423",
|
||||
x"0007a623",
|
||||
x"0007a703",
|
||||
x"00171693",
|
||||
x"fe06cce3",
|
||||
x"0007a703",
|
||||
x"002006b7",
|
||||
x"00d76733",
|
||||
x"00e7a023",
|
||||
x"0007a703",
|
||||
x"ffffe6b7",
|
||||
x"43f68693",
|
||||
x"00d77733",
|
||||
x"000016b7",
|
||||
x"60068693",
|
||||
x"00d76733",
|
||||
x"00e7a023",
|
||||
x"470000ef",
|
||||
x"454000ef",
|
||||
x"00050863",
|
||||
x"fffc07b7",
|
||||
x"00100713",
|
||||
|
@ -193,56 +165,56 @@ x"30479073",
|
|||
x"00800793",
|
||||
x"3007a073",
|
||||
x"ffe01537",
|
||||
x"db050513",
|
||||
x"6b4000ef",
|
||||
x"d1450513",
|
||||
x"698000ef",
|
||||
x"f1302573",
|
||||
x"648000ef",
|
||||
x"62c000ef",
|
||||
x"ffe01537",
|
||||
x"de850513",
|
||||
x"6a0000ef",
|
||||
x"d4c50513",
|
||||
x"684000ef",
|
||||
x"fffe0437",
|
||||
x"00042503",
|
||||
x"630000ef",
|
||||
x"614000ef",
|
||||
x"ffe01537",
|
||||
x"df050513",
|
||||
x"688000ef",
|
||||
x"d5450513",
|
||||
x"66c000ef",
|
||||
x"30102573",
|
||||
x"61c000ef",
|
||||
x"600000ef",
|
||||
x"ffe01537",
|
||||
x"df850513",
|
||||
x"674000ef",
|
||||
x"d5c50513",
|
||||
x"658000ef",
|
||||
x"fc002573",
|
||||
x"608000ef",
|
||||
x"5ec000ef",
|
||||
x"ffe01537",
|
||||
x"e0050513",
|
||||
x"660000ef",
|
||||
x"d6450513",
|
||||
x"644000ef",
|
||||
x"00842503",
|
||||
x"00100493",
|
||||
x"5f0000ef",
|
||||
x"5d4000ef",
|
||||
x"ffe01537",
|
||||
x"e0850513",
|
||||
x"648000ef",
|
||||
x"d6c50513",
|
||||
x"62c000ef",
|
||||
x"00444503",
|
||||
x"00a49533",
|
||||
x"ffc57513",
|
||||
x"5d4000ef",
|
||||
x"5b8000ef",
|
||||
x"ffe01537",
|
||||
x"e1050513",
|
||||
x"62c000ef",
|
||||
x"d7450513",
|
||||
x"610000ef",
|
||||
x"00544783",
|
||||
x"00f49533",
|
||||
x"ffc57513",
|
||||
x"5b8000ef",
|
||||
x"59c000ef",
|
||||
x"ffe014b7",
|
||||
x"dac48513",
|
||||
x"610000ef",
|
||||
x"d1048513",
|
||||
x"5f4000ef",
|
||||
x"00842783",
|
||||
x"00f79713",
|
||||
x"06075063",
|
||||
x"ffe01537",
|
||||
x"e1850513",
|
||||
x"5f8000ef",
|
||||
x"2e0000ef",
|
||||
x"d7c50513",
|
||||
x"5dc000ef",
|
||||
x"2c4000ef",
|
||||
x"00042703",
|
||||
x"00271413",
|
||||
x"00e40433",
|
||||
|
@ -260,14 +232,14 @@ x"00f69613",
|
|||
x"0a065463",
|
||||
x"ffe01537",
|
||||
x"00472783",
|
||||
x"e4450513",
|
||||
x"5a8000ef",
|
||||
x"da850513",
|
||||
x"58c000ef",
|
||||
x"ffe017b7",
|
||||
x"e5078513",
|
||||
x"59c000ef",
|
||||
x"db478513",
|
||||
x"580000ef",
|
||||
x"ffe01537",
|
||||
x"ed050513",
|
||||
x"590000ef",
|
||||
x"e1850513",
|
||||
x"574000ef",
|
||||
x"fff507b7",
|
||||
x"0007a703",
|
||||
x"00f71693",
|
||||
|
@ -275,15 +247,15 @@ x"fe06dce3",
|
|||
x"0047a403",
|
||||
x"0ff47413",
|
||||
x"00040513",
|
||||
x"4f4000ef",
|
||||
x"dac48513",
|
||||
x"568000ef",
|
||||
x"4d8000ef",
|
||||
x"d1048513",
|
||||
x"54c000ef",
|
||||
x"f9b40413",
|
||||
x"0ff47413",
|
||||
x"01300793",
|
||||
x"2287e863",
|
||||
x"01000793",
|
||||
x"2087ee63",
|
||||
x"ffe017b7",
|
||||
x"f4c78793",
|
||||
x"e9478793",
|
||||
x"00241413",
|
||||
x"00f40433",
|
||||
x"00042783",
|
||||
|
@ -300,41 +272,40 @@ x"df5ff06f",
|
|||
x"0017d793",
|
||||
x"ff5ff06f",
|
||||
x"00f12023",
|
||||
x"1f8000ef",
|
||||
x"1dc000ef",
|
||||
x"00012783",
|
||||
x"f285e8e3",
|
||||
x"00b41463",
|
||||
x"f2f564e3",
|
||||
x"00100513",
|
||||
x"6f4000ef",
|
||||
x"dac48513",
|
||||
x"4ec000ef",
|
||||
x"00000513",
|
||||
x"035000ef",
|
||||
x"6d8000ef",
|
||||
x"d1048513",
|
||||
x"4d0000ef",
|
||||
x"01d000ef",
|
||||
x"ffe002b7",
|
||||
x"00028067",
|
||||
x"00000513",
|
||||
x"6d4000ef",
|
||||
x"f39ff06f",
|
||||
x"6bc000ef",
|
||||
x"f3dff06f",
|
||||
x"800007b7",
|
||||
x"0047a403",
|
||||
x"00041863",
|
||||
x"ffe01537",
|
||||
x"ed850513",
|
||||
x"f1dff06f",
|
||||
x"e2050513",
|
||||
x"f21ff06f",
|
||||
x"ffe01537",
|
||||
x"ef450513",
|
||||
x"4ac000ef",
|
||||
x"e3c50513",
|
||||
x"494000ef",
|
||||
x"00040513",
|
||||
x"440000ef",
|
||||
x"428000ef",
|
||||
x"ffe01537",
|
||||
x"efc50513",
|
||||
x"498000ef",
|
||||
x"e4450513",
|
||||
x"480000ef",
|
||||
x"00400537",
|
||||
x"42c000ef",
|
||||
x"414000ef",
|
||||
x"ffe01537",
|
||||
x"f1450513",
|
||||
x"484000ef",
|
||||
x"e5c50513",
|
||||
x"46c000ef",
|
||||
x"fff507b7",
|
||||
x"0007a703",
|
||||
x"00f71693",
|
||||
|
@ -342,17 +313,17 @@ x"fe06dce3",
|
|||
x"0047a503",
|
||||
x"0ff57513",
|
||||
x"00a12023",
|
||||
x"3e8000ef",
|
||||
x"3d0000ef",
|
||||
x"00012503",
|
||||
x"07900793",
|
||||
x"ecf510e3",
|
||||
x"2f8000ef",
|
||||
x"ecf512e3",
|
||||
x"2e0000ef",
|
||||
x"00050663",
|
||||
x"00300513",
|
||||
x"498000ef",
|
||||
x"480000ef",
|
||||
x"ffe01537",
|
||||
x"f2050513",
|
||||
x"43c000ef",
|
||||
x"e6850513",
|
||||
x"424000ef",
|
||||
x"01045793",
|
||||
x"00178793",
|
||||
x"00400737",
|
||||
|
@ -360,48 +331,48 @@ x"00e12023",
|
|||
x"fff78793",
|
||||
x"fff00713",
|
||||
x"08e79063",
|
||||
x"00000793",
|
||||
x"00000713",
|
||||
x"0007a583",
|
||||
x"00000793",
|
||||
x"00078693",
|
||||
x"0006a583",
|
||||
x"00400537",
|
||||
x"00c50513",
|
||||
x"00b70733",
|
||||
x"00a78533",
|
||||
x"00e12223",
|
||||
x"00f12023",
|
||||
x"2f0000ef",
|
||||
x"00012783",
|
||||
x"00412703",
|
||||
x"00478793",
|
||||
x"fc87eae3",
|
||||
x"00f12223",
|
||||
x"00e12023",
|
||||
x"2d0000ef",
|
||||
x"00412783",
|
||||
x"00012703",
|
||||
x"fc87e8e3",
|
||||
x"4788d5b7",
|
||||
x"afe58593",
|
||||
x"00400537",
|
||||
x"00e12023",
|
||||
x"2cc000ef",
|
||||
x"2b4000ef",
|
||||
x"00400537",
|
||||
x"00040593",
|
||||
x"00450513",
|
||||
x"2bc000ef",
|
||||
x"2a4000ef",
|
||||
x"00012703",
|
||||
x"00400537",
|
||||
x"00850513",
|
||||
x"40e005b3",
|
||||
x"2a8000ef",
|
||||
x"290000ef",
|
||||
x"ffe01537",
|
||||
x"d9450513",
|
||||
x"e09ff06f",
|
||||
x"cf850513",
|
||||
x"e0dff06f",
|
||||
x"00f12223",
|
||||
x"1ec000ef",
|
||||
x"124000ef",
|
||||
x"1d4000ef",
|
||||
x"10c000ef",
|
||||
x"0d800513",
|
||||
x"0c4000ef",
|
||||
x"0ac000ef",
|
||||
x"00012503",
|
||||
x"0d8000ef",
|
||||
x"09c000ef",
|
||||
x"0c0000ef",
|
||||
x"084000ef",
|
||||
x"00412783",
|
||||
x"00f12223",
|
||||
x"1e8000ef",
|
||||
x"1d0000ef",
|
||||
x"00157513",
|
||||
x"00412783",
|
||||
x"fe0518e3",
|
||||
|
@ -413,19 +384,13 @@ x"00100513",
|
|||
x"e81ff06f",
|
||||
x"800007b7",
|
||||
x"0047a783",
|
||||
x"e60790e3",
|
||||
x"e60792e3",
|
||||
x"ffe01537",
|
||||
x"f3050513",
|
||||
x"da1ff06f",
|
||||
x"fffe07b7",
|
||||
x"0087a783",
|
||||
x"2007f793",
|
||||
x"00079863",
|
||||
x"e7850513",
|
||||
x"da5ff06f",
|
||||
x"ffe01537",
|
||||
x"f4050513",
|
||||
x"d85ff06f",
|
||||
x"00100513",
|
||||
x"e35ff06f",
|
||||
x"e8850513",
|
||||
x"d99ff06f",
|
||||
x"fff4c7b7",
|
||||
x"ffc7a583",
|
||||
x"ff87a503",
|
||||
|
@ -611,7 +576,7 @@ x"01c00493",
|
|||
x"00945733",
|
||||
x"ffe017b7",
|
||||
x"00f77713",
|
||||
x"f9c78793",
|
||||
x"ed878793",
|
||||
x"00e787b3",
|
||||
x"0007c503",
|
||||
x"ffc48493",
|
||||
|
@ -647,13 +612,13 @@ x"ff810113",
|
|||
x"00812023",
|
||||
x"00050413",
|
||||
x"ffe01537",
|
||||
x"d3c50513",
|
||||
x"ca050513",
|
||||
x"00112223",
|
||||
x"f99ff0ef",
|
||||
x"00241793",
|
||||
x"ffe01537",
|
||||
x"008787b3",
|
||||
x"fac50513",
|
||||
x"ee850513",
|
||||
x"00f50533",
|
||||
x"f81ff0ef",
|
||||
x"00800793",
|
||||
|
@ -733,7 +698,7 @@ x"0087a783",
|
|||
x"00e79713",
|
||||
x"04075263",
|
||||
x"ffe01537",
|
||||
x"d4450513",
|
||||
x"ca850513",
|
||||
x"e45ff0ef",
|
||||
x"00048513",
|
||||
x"dd9ff0ef",
|
||||
|
@ -746,7 +711,7 @@ x"da9ff0ef",
|
|||
x"34302573",
|
||||
x"db9ff0ef",
|
||||
x"ffe01537",
|
||||
x"dac50513",
|
||||
x"d1050513",
|
||||
x"e11ff0ef",
|
||||
x"00440413",
|
||||
x"34141073",
|
||||
|
@ -761,7 +726,7 @@ x"00a12023",
|
|||
x"00f72023",
|
||||
x"02f50a63",
|
||||
x"ffe01537",
|
||||
x"d5050513",
|
||||
x"cb450513",
|
||||
x"dd5ff0ef",
|
||||
x"00000413",
|
||||
x"00012503",
|
||||
|
@ -773,12 +738,12 @@ x"04f50a63",
|
|||
x"00000513",
|
||||
x"0380006f",
|
||||
x"ffe01537",
|
||||
x"d7050513",
|
||||
x"cd450513",
|
||||
x"da5ff0ef",
|
||||
x"00400537",
|
||||
x"d39ff0ef",
|
||||
x"ffe01537",
|
||||
x"d8c50513",
|
||||
x"cf050513",
|
||||
x"d91ff0ef",
|
||||
x"fffe07b7",
|
||||
x"0087a783",
|
||||
|
@ -808,7 +773,7 @@ x"00e40433",
|
|||
x"00200513",
|
||||
x"fa0416e3",
|
||||
x"ffe01537",
|
||||
x"d9450513",
|
||||
x"cf850513",
|
||||
x"d19ff0ef",
|
||||
x"800007b7",
|
||||
x"0097a223",
|
||||
|
@ -835,31 +800,27 @@ x"00412703",
|
|||
x"00a40433",
|
||||
x"00478793",
|
||||
x"f81ff06f",
|
||||
x"ff810113",
|
||||
x"00112223",
|
||||
x"00812023",
|
||||
x"ffc10113",
|
||||
x"00112023",
|
||||
x"00800793",
|
||||
x"3007b073",
|
||||
x"00a03533",
|
||||
x"40a00533",
|
||||
x"e0400437",
|
||||
x"00a47433",
|
||||
x"ffe01537",
|
||||
x"d9850513",
|
||||
x"cfc50513",
|
||||
x"c99ff0ef",
|
||||
x"00000513",
|
||||
x"c2dff0ef",
|
||||
x"ffe01537",
|
||||
x"d0c50513",
|
||||
x"c85ff0ef",
|
||||
x"00040513",
|
||||
x"c19ff0ef",
|
||||
x"ffe01537",
|
||||
x"da850513",
|
||||
x"c71ff0ef",
|
||||
x"971ff0ef",
|
||||
x"985ff0ef",
|
||||
x"00050663",
|
||||
x"fffc07b7",
|
||||
x"0007a223",
|
||||
x"fff50737",
|
||||
x"00072783",
|
||||
x"fe07cee3",
|
||||
x"000400e7",
|
||||
x"00000793",
|
||||
x"000780e7",
|
||||
x"52450a07",
|
||||
x"00005f52",
|
||||
x"5252450a",
|
||||
|
@ -951,16 +912,9 @@ x"2064616f",
|
|||
x"6d6f7266",
|
||||
x"616c6620",
|
||||
x"200a6873",
|
||||
x"42203a78",
|
||||
x"20746f6f",
|
||||
x"6d6f7266",
|
||||
x"616c6620",
|
||||
x"28206873",
|
||||
x"29504958",
|
||||
x"3a65200a",
|
||||
x"65784520",
|
||||
x"65747563",
|
||||
x"00000000",
|
||||
x"45203a65",
|
||||
x"75636578",
|
||||
x"00006574",
|
||||
x"444d430a",
|
||||
x"00203e3a",
|
||||
x"65206f4e",
|
||||
|
@ -992,26 +946,23 @@ x"00002e65",
|
|||
x"61766e49",
|
||||
x"2064696c",
|
||||
x"00444d43",
|
||||
x"ffe00638",
|
||||
x"ffe00660",
|
||||
x"ffe00660",
|
||||
x"ffe003e4",
|
||||
x"ffe00660",
|
||||
x"ffe00660",
|
||||
x"ffe00660",
|
||||
x"ffe00630",
|
||||
x"ffe00660",
|
||||
x"ffe00660",
|
||||
x"ffe00660",
|
||||
x"ffe00660",
|
||||
x"ffe00660",
|
||||
x"ffe004a8",
|
||||
x"ffe004bc",
|
||||
x"ffe00660",
|
||||
x"ffe004b0",
|
||||
x"ffe00660",
|
||||
x"ffe00660",
|
||||
x"ffe00650",
|
||||
x"ffe005c4",
|
||||
x"ffe005dc",
|
||||
x"ffe005dc",
|
||||
x"ffe00374",
|
||||
x"ffe005dc",
|
||||
x"ffe005dc",
|
||||
x"ffe005dc",
|
||||
x"ffe005bc",
|
||||
x"ffe005dc",
|
||||
x"ffe005dc",
|
||||
x"ffe005dc",
|
||||
x"ffe005dc",
|
||||
x"ffe005dc",
|
||||
x"ffe00434",
|
||||
x"ffe00448",
|
||||
x"ffe005dc",
|
||||
x"ffe0043c",
|
||||
x"33323130",
|
||||
x"37363534",
|
||||
x"62613938",
|
||||
|
|
|
@ -97,13 +97,6 @@
|
|||
#define SPI_BOOT_BASE_ADDR 0x00400000UL
|
||||
#endif
|
||||
|
||||
/* -------- XIP configuration -------- */
|
||||
|
||||
/** Enable XIP boot options */
|
||||
#ifndef XIP_EN
|
||||
#define XIP_EN 1
|
||||
#endif
|
||||
|
||||
/* -------- TWI configuration -------- */
|
||||
|
||||
/** Enable TWI for copying to RAM */
|
||||
|
@ -249,7 +242,7 @@ volatile uint32_t getting_exe;
|
|||
**************************************************************************/
|
||||
void __attribute__((interrupt("machine"),aligned(4))) bootloader_trap_handler(void);
|
||||
void print_help(void);
|
||||
void start_app(int boot_xip);
|
||||
void start_app(void);
|
||||
void get_exe(int src);
|
||||
void save_exe(void);
|
||||
uint32_t get_exe_word(int src, uint32_t addr);
|
||||
|
@ -290,14 +283,6 @@ int main(void) {
|
|||
}
|
||||
#endif
|
||||
|
||||
#if (XIP_EN != 0)
|
||||
// setup XIP: clock divider 0, clock mode 0
|
||||
if (neorv32_xip_available()) {
|
||||
neorv32_xip_setup(SPI_FLASH_CLK_PRSC, 0, 0, 0, SPI_FLASH_CMD_READ);
|
||||
neorv32_xip_start(SPI_FLASH_ADDR_BYTES);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if (STATUS_LED_EN != 0)
|
||||
// activate status LED, clear all others
|
||||
if (neorv32_gpio_available()) {
|
||||
|
@ -376,7 +361,7 @@ int main(void) {
|
|||
get_exe(EXE_STREAM_TWI); // try booting from twi
|
||||
#endif
|
||||
PRINT_TEXT("\n");
|
||||
start_app(0);
|
||||
start_app();
|
||||
while(1);
|
||||
}
|
||||
|
||||
|
@ -431,19 +416,9 @@ int main(void) {
|
|||
PRINT_TEXT("No executable.");
|
||||
}
|
||||
else {
|
||||
start_app(0); // run app from IMEM
|
||||
start_app(); // run app from IMEM
|
||||
}
|
||||
}
|
||||
#if (XIP_EN != 0)
|
||||
else if (c == 'x') { // boot from SPI flash via XIP
|
||||
if (neorv32_xip_available()) { // XIP module really implemented?
|
||||
start_app(1);
|
||||
}
|
||||
else {
|
||||
PRINT_TEXT("Invalid CMD");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
else { // unknown command
|
||||
PRINT_TEXT("Invalid CMD");
|
||||
}
|
||||
|
@ -469,9 +444,6 @@ void print_help(void) {
|
|||
#endif
|
||||
#if (TWI_EN != 0)
|
||||
" t: Load from TWI Device\n"
|
||||
#endif
|
||||
#if (XIP_EN != 0)
|
||||
" x: Boot from flash (XIP)\n"
|
||||
#endif
|
||||
" e: Execute");
|
||||
}
|
||||
|
@ -479,21 +451,13 @@ void print_help(void) {
|
|||
|
||||
/**********************************************************************//**
|
||||
* Start application program.
|
||||
*
|
||||
* @param boot_xip Set to boot via XIP.
|
||||
**************************************************************************/
|
||||
void start_app(int boot_xip) {
|
||||
void start_app(void) {
|
||||
|
||||
// deactivate global IRQs
|
||||
neorv32_cpu_csr_clr(CSR_MSTATUS, 1 << CSR_MSTATUS_MIE);
|
||||
|
||||
register uint32_t app_base = (uint32_t)EXE_BASE_ADDR; // default = start at beginning of IMEM
|
||||
#if (XIP_EN != 0)
|
||||
if (boot_xip) {
|
||||
app_base = (uint32_t)(XIP_MEM_BASE_ADDRESS + SPI_BOOT_BASE_ADDR); // start from XIP mapped address
|
||||
}
|
||||
#endif
|
||||
|
||||
PRINT_TEXT("Booting from ");
|
||||
PRINT_XNUM(app_base);
|
||||
PRINT_TEXT("...\n\n");
|
||||
|
|
|
@ -37,8 +37,6 @@ USER_FLAGS += \
|
|||
#USER_FLAGS += -DSPI_FLASH_CLK_PRSC=CLK_PRSC_8
|
||||
#USER_FLAGS += -DSPI_BOOT_BASE_ADDR=0x00400000UL
|
||||
|
||||
#USER_FLAGS += -DXIP_EN=1
|
||||
|
||||
#USER_FLAGS += -DTWI_EN=1
|
||||
#USER_FLAGS += -DTWI_CLK_PRSC=CLK_PRSC_64
|
||||
#USER_FLAGS += -DTWI_CLK_DIV=3
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue