[bootloader] add fence instructions

This commit is contained in:
stnolting 2025-02-01 15:18:02 +01:00
parent 620369e077
commit 507c219625
2 changed files with 89 additions and 82 deletions

View file

@ -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: 15.01.2025 21:12:00
-- Built: 01.02.2025 15:16:28
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 := 4028; -- bytes
constant bootloader_init_size_c : natural := 4040; -- bytes
constant bootloader_init_image_c : mem32_t := (
x"f14020f3",
x"80200217",
@ -23,11 +23,11 @@ x"000022b7",
x"80028293",
x"30029073",
x"00000317",
x"0f830313",
x"0fc30313",
x"30531073",
x"30401073",
x"00001397",
x"f8838393",
x"f9438393",
x"80200417",
x"fc440413",
x"80200497",
@ -36,8 +36,7 @@ x"80200517",
x"fb450513",
x"80200597",
x"fb458593",
x"00000617",
x"10060613",
x"00000613",
x"00000693",
x"00000713",
x"00000793",
@ -47,7 +46,7 @@ x"01878793",
x"30579073",
x"30446073",
x"30046073",
x"08c0006f",
x"0940006f",
x"fff40737",
x"00072223",
x"bc1026f3",
@ -58,7 +57,7 @@ x"30200073",
x"bc102173",
x"bc102673",
x"bc171073",
x"0300006f",
x"0380006f",
x"00838e63",
x"00945c63",
x"0003a783",
@ -70,6 +69,8 @@ x"00b55863",
x"00052023",
x"00450513",
x"ff5ff06f",
x"00000617",
x"08060613",
x"0ff0000f",
x"0000100f",
x"30029073",
@ -109,7 +110,7 @@ x"ffe017b7",
x"00112823",
x"00812623",
x"00912423",
x"a2c78793",
x"a3078793",
x"30579073",
x"fffe07b7",
x"0087a783",
@ -192,54 +193,54 @@ x"30479073",
x"00800793",
x"3007a073",
x"ffe01537",
x"da450513",
x"db050513",
x"6b4000ef",
x"f1302573",
x"648000ef",
x"ffe01537",
x"ddc50513",
x"de850513",
x"6a0000ef",
x"fffe0437",
x"00042503",
x"630000ef",
x"ffe01537",
x"de450513",
x"df050513",
x"688000ef",
x"30102573",
x"61c000ef",
x"ffe01537",
x"dec50513",
x"df850513",
x"674000ef",
x"fc002573",
x"608000ef",
x"ffe01537",
x"df450513",
x"e0050513",
x"660000ef",
x"00842503",
x"00100493",
x"5f0000ef",
x"ffe01537",
x"dfc50513",
x"e0850513",
x"648000ef",
x"00444503",
x"00a49533",
x"ffc57513",
x"5d4000ef",
x"ffe01537",
x"e0450513",
x"e1050513",
x"62c000ef",
x"00544783",
x"00f49533",
x"ffc57513",
x"5b8000ef",
x"ffe014b7",
x"da048513",
x"dac48513",
x"610000ef",
x"00842783",
x"00f79713",
x"06075063",
x"ffe01537",
x"e0c50513",
x"e1850513",
x"5f8000ef",
x"2e0000ef",
x"00042703",
@ -259,13 +260,13 @@ x"00f69613",
x"0a065463",
x"ffe01537",
x"00472783",
x"e3850513",
x"e4450513",
x"5a8000ef",
x"ffe017b7",
x"e4478513",
x"e5078513",
x"59c000ef",
x"ffe01537",
x"ec450513",
x"ed050513",
x"590000ef",
x"fff507b7",
x"0007a703",
@ -275,14 +276,14 @@ x"0047a403",
x"0ff47413",
x"00040513",
x"4f4000ef",
x"da048513",
x"dac48513",
x"568000ef",
x"f9b40413",
x"0ff47413",
x"01300793",
x"2287e863",
x"ffe017b7",
x"f4078793",
x"f4c78793",
x"00241413",
x"00f40433",
x"00042783",
@ -306,10 +307,10 @@ x"00b41463",
x"f2f564e3",
x"00100513",
x"6f4000ef",
x"da048513",
x"dac48513",
x"4ec000ef",
x"00000513",
x"02d000ef",
x"035000ef",
x"ffe002b7",
x"00028067",
x"00000513",
@ -319,20 +320,20 @@ x"800007b7",
x"0047a403",
x"00041863",
x"ffe01537",
x"ecc50513",
x"ed850513",
x"f1dff06f",
x"ffe01537",
x"ee850513",
x"ef450513",
x"4ac000ef",
x"00040513",
x"440000ef",
x"ffe01537",
x"ef050513",
x"efc50513",
x"498000ef",
x"00400537",
x"42c000ef",
x"ffe01537",
x"f0850513",
x"f1450513",
x"484000ef",
x"fff507b7",
x"0007a703",
@ -350,7 +351,7 @@ x"00050663",
x"00300513",
x"498000ef",
x"ffe01537",
x"f1450513",
x"f2050513",
x"43c000ef",
x"01045793",
x"00178793",
@ -388,7 +389,7 @@ x"00850513",
x"40e005b3",
x"2a8000ef",
x"ffe01537",
x"d8850513",
x"d9450513",
x"e09ff06f",
x"00f12223",
x"1ec000ef",
@ -414,14 +415,14 @@ x"800007b7",
x"0047a783",
x"e60790e3",
x"ffe01537",
x"f2450513",
x"f3050513",
x"da1ff06f",
x"fffe07b7",
x"0087a783",
x"2007f793",
x"00079863",
x"ffe01537",
x"f3450513",
x"f4050513",
x"d85ff06f",
x"00100513",
x"e35ff06f",
@ -610,7 +611,7 @@ x"01c00493",
x"00945733",
x"ffe017b7",
x"00f77713",
x"f9078793",
x"f9c78793",
x"00e787b3",
x"0007c503",
x"ffc48493",
@ -646,13 +647,13 @@ x"ff810113",
x"00812023",
x"00050413",
x"ffe01537",
x"d3050513",
x"d3c50513",
x"00112223",
x"f99ff0ef",
x"00241793",
x"ffe01537",
x"008787b3",
x"fa050513",
x"fac50513",
x"00f50533",
x"f81ff0ef",
x"00800793",
@ -732,7 +733,7 @@ x"0087a783",
x"00e79713",
x"04075263",
x"ffe01537",
x"d3850513",
x"d4450513",
x"e45ff0ef",
x"00048513",
x"dd9ff0ef",
@ -745,7 +746,7 @@ x"da9ff0ef",
x"34302573",
x"db9ff0ef",
x"ffe01537",
x"da050513",
x"dac50513",
x"e11ff0ef",
x"00440413",
x"34141073",
@ -760,7 +761,7 @@ x"00a12023",
x"00f72023",
x"02f50a63",
x"ffe01537",
x"d4450513",
x"d5050513",
x"dd5ff0ef",
x"00000413",
x"00012503",
@ -772,12 +773,12 @@ x"04f50a63",
x"00000513",
x"0380006f",
x"ffe01537",
x"d6450513",
x"d7050513",
x"da5ff0ef",
x"00400537",
x"d39ff0ef",
x"ffe01537",
x"d8050513",
x"d8c50513",
x"d91ff0ef",
x"fffe07b7",
x"0087a783",
@ -802,17 +803,19 @@ x"ffc4f693",
x"00000793",
x"00000413",
x"00f605b3",
x"04d79063",
x"04d79463",
x"00e40433",
x"00200513",
x"fa0416e3",
x"ffe01537",
x"d8850513",
x"d9450513",
x"d19ff0ef",
x"01c12083",
x"01812403",
x"800007b7",
x"0097a223",
x"0ff0000f",
x"0000100f",
x"01c12083",
x"01812403",
x"800007b7",
x"0007a023",
x"01412483",
@ -823,7 +826,7 @@ x"00d12823",
x"00f12623",
x"00c12423",
x"00e12223",
x"a89ff0ef",
x"a81ff0ef",
x"00c12783",
x"01012683",
x"00812603",
@ -831,7 +834,7 @@ x"00a7a023",
x"00412703",
x"00a40433",
x"00478793",
x"f89ff06f",
x"f81ff06f",
x"ff810113",
x"00112223",
x"00812023",
@ -842,14 +845,14 @@ x"40a00533",
x"e0400437",
x"00a47433",
x"ffe01537",
x"d8c50513",
x"c8dff0ef",
x"d9850513",
x"c85ff0ef",
x"00040513",
x"c21ff0ef",
x"c19ff0ef",
x"ffe01537",
x"d9c50513",
x"c79ff0ef",
x"979ff0ef",
x"da850513",
x"c71ff0ef",
x"971ff0ef",
x"00050663",
x"fffc07b7",
x"0007a223",
@ -894,9 +897,9 @@ x"6f6c746f",
x"72656461",
x"0a3e3e20",
x"444c420a",
x"4a203a56",
x"31206e61",
x"30322035",
x"46203a56",
x"20206265",
x"30322031",
x"480a3532",
x"203a5657",
x"00000020",
@ -989,26 +992,26 @@ x"00002e65",
x"61766e49",
x"2064696c",
x"00444d43",
x"ffe00634",
x"ffe0065c",
x"ffe0065c",
x"ffe003e0",
x"ffe0065c",
x"ffe0065c",
x"ffe0065c",
x"ffe0062c",
x"ffe0065c",
x"ffe0065c",
x"ffe0065c",
x"ffe0065c",
x"ffe0065c",
x"ffe004a4",
x"ffe004b8",
x"ffe0065c",
x"ffe004ac",
x"ffe0065c",
x"ffe0065c",
x"ffe0064c",
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"33323130",
x"37363534",
x"62613938",

View file

@ -576,7 +576,7 @@ void get_exe(int src) {
if (src == EXE_STREAM_FLASH) {
addr = (uint32_t)SPI_BOOT_BASE_ADDR;
}
// get image from UART?
if (src == EXE_STREAM_UART) {
@ -634,7 +634,11 @@ void get_exe(int src) {
exe_available = size; // store exe size
}
getting_exe = 0; // to inform trap handler we are done getting an executable
// we might have caches so the executable might not yet have fully arrived in main memory yet
asm volatile ("fence"); // flush data caches to main memory
asm volatile ("fence.i"); // re-sync instruction fetch to updated main memory
getting_exe = 0; // inform trap handler that we are done getting an executable
}
@ -1046,9 +1050,9 @@ uint32_t twi_read_addr(uint32_t addr) {
#error "Unsupported TWI_ADDR_BYTES configuration!"
#endif
/***********************
* Set address to read
* Set address to read
***********************/
neorv32_twi_generate_start();
@ -1071,7 +1075,7 @@ uint32_t twi_read_addr(uint32_t addr) {
#endif
/***********************
* Read data
* Read data
***********************/
neorv32_twi_generate_start();
@ -1097,7 +1101,7 @@ uint32_t twi_read_addr(uint32_t addr) {
transfer = 0xFF;
neorv32_twi_trans(&transfer, 0); // NACK by master
data.uint8[3] = transfer;
neorv32_twi_generate_stop();
return data.uint32;