Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TODO: Support for RISC-V Star64 JH7110 SBC (Branch star64d) #35

Closed
wants to merge 108 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
108 commits
Select commit Hold shift + click to select a range
f80b7fe
Print to UART OK yay!
lupyuen Jun 29, 2023
5de250a
Print to UART OK yay!
lupyuen Jun 29, 2023
b873dc0
Adding Linux Header
lupyuen Jun 29, 2023
7ff868f
Adding Linux Header
lupyuen Jun 29, 2023
94348e7
Adding Linux Header
lupyuen Jun 29, 2023
0c59496
Adding Linux Header
lupyuen Jun 29, 2023
a0787e7
Adding Linux Header
lupyuen Jun 30, 2023
b4744c9
Added Linux Header
lupyuen Jun 30, 2023
b75df20
Start at 0x44000000
lupyuen Jun 30, 2023
9e92bbc
Moved Start Address to 0x40200000. NuttX boots with `123` yay!
lupyuen Jul 1, 2023
5c59366
Moved Start Address to 0x40200000. NuttX boots with `123` yay!
lupyuen Jul 1, 2023
ed09c34
Sync MZ with Linux
lupyuen Jul 1, 2023
ecee2d9
Change Machine Registers to Supervisor Registers
lupyuen Jul 4, 2023
06f8bc9
Fix Hart ID
lupyuen Jul 4, 2023
43de842
Clean up
lupyuen Jul 4, 2023
55967a3
Add log
lupyuen Jul 4, 2023
8fdd020
Hangs at qemu_rv_start
lupyuen Jul 4, 2023
e99a241
Hangs at qemu_rv_start
lupyuen Jul 4, 2023
dc59c26
Hangs at qemu_rv_start
lupyuen Jul 4, 2023
005f0ea
Revert to earlier `sed`
lupyuen Jul 4, 2023
2b8ef3d
Hang in up_putc
lupyuen Jul 4, 2023
093a531
Hang in riscv_earlyserialinit
lupyuen Jul 4, 2023
ef9618a
Hang in nx_start
lupyuen Jul 4, 2023
b82ffaf
Hangs in enter_critical_section
lupyuen Jul 4, 2023
e057296
Hangs in enter_critical_section
lupyuen Jul 4, 2023
541b22d
Hangs in THRE
lupyuen Jul 4, 2023
13e6af4
Change RAM Address
lupyuen Jul 4, 2023
4dcd007
Enable Critical Section with rv-virt:knsh64. Garbled output
lupyuen Jul 4, 2023
4f5d964
Skip init m-mode. Hang in riscv_earlyserialinit
lupyuen Jul 4, 2023
6285e1c
Disable riscv_earlyserialinit. Critical section OK with rv-virt:knsh64
lupyuen Jul 4, 2023
62764c1
Fix knsh64 PBASE and VBASE
lupyuen Jul 5, 2023
751f24d
Don't load the Interrupt Vector Table, use OpenSBI for crash logging
lupyuen Jul 5, 2023
87b91e6
u16550_setup OK
lupyuen Jul 5, 2023
a34d036
Disable riscv_earlyserialinit
lupyuen Jul 5, 2023
5f5df15
Use NuttX trap vector. Something garbled is printed
lupyuen Jul 13, 2023
04e3bfb
Comment out UART Setup. 123067DFAGHBCIcl
lupyuen Jul 13, 2023
4fd337e
Restore riscv_earlyserialinit. 123067DFAGaclbH
lupyuen Jul 13, 2023
a678f68
Restore UART wait. 123067DF
lupyuen Jul 13, 2023
236a2b0
Check UART Base. 123067DF
lupyuen Jul 13, 2023
5e3b755
Clear BSS. 123067DF
lupyuen Jul 13, 2023
71ce60f
Fixing u16550_putc. 123067DFm
lupyuen Jul 14, 2023
6cd805f
Fixing u16550_putc. 123067DFmoooooooo
lupyuen Jul 14, 2023
55bfcde
Debug UART Addr. 123067DFm155Eoo
lupyuen Jul 14, 2023
606d7a7
CONFIG_16550_REGINCR=4 yay! 123067DFm45DTpAqGaclbHm45DTpBqm45DTpCqI
lupyuen Jul 14, 2023
ef83404
CONFIG_16550_REGINCR=4 yay! 123067DFm45DTpAqGaclbHm45DTpBqm45DTpCqI
lupyuen Jul 14, 2023
12eb3d8
Clean up. 123067DFAGaclbHBCI
lupyuen Jul 14, 2023
3551b48
Use OpenSBI for crash logging. 123067DFAGaclbHBCI
lupyuen Jul 14, 2023
7cf7097
Enable Scheduler Debug. nx_start_application: Starting init task: /sy…
lupyuen Jul 15, 2023
2891894
Switch to NuttX Trap Vector. nx_start_application: Starting init task…
lupyuen Jul 15, 2023
cad0e95
exec_spawn never returns
lupyuen Jul 15, 2023
dbe1048
exec_spawn never returns
lupyuen Jul 15, 2023
2f52bba
Enable Binary Loader Logging. elf_init: filename: /system/bin/init lo…
lupyuen Jul 15, 2023
b79c90e
Restore UART
lupyuen Jul 15, 2023
854045e
Restore UART. Tested OK
lupyuen Jul 15, 2023
2261b80
Restore qemu_rv_start. elf_init: filename: /system/bin/init loadinfo:…
lupyuen Jul 15, 2023
dd721d0
Restore qemu_rv_start. up_dump_register: EPC: 0000000040200434
lupyuen Jul 15, 2023
6ed2880
Debug host_call. host_call: host_call: nbr=0x1, parm=0x40406778, size=24
lupyuen Jul 15, 2023
c994f46
Disable Semihosting
lupyuen Jul 15, 2023
d794e95
Ignore initrd
lupyuen Jul 22, 2023
a2c117a
Loading RAM Disk
lupyuen Jul 22, 2023
1e5f221
Loading RAM Disk
lupyuen Jul 22, 2023
f7cf230
RAM Disk boots OK on Star64 yay! Disable info log
lupyuen Jul 22, 2023
e26103d
Ignore init.S
lupyuen Jul 26, 2023
e5751b6
Fix User Address Space and I/O Address Space. Same result
lupyuen Jul 27, 2023
46c1a0f
Change RAM Base to 0x40200000
lupyuen Jul 27, 2023
4d36dd3
Console Output is stuck
lupyuen Jul 27, 2023
6087f17
No Console Output from NuttX Shell
lupyuen Jul 28, 2023
ea607bd
Log Console Output
lupyuen Jul 28, 2023
3d1efea
Log Console Output
lupyuen Jul 28, 2023
7ee9fb9
Disable ACLINT
lupyuen Jul 28, 2023
2ff7d88
UART0 IRQ becomes 32
lupyuen Jul 28, 2023
f3efcb6
Log IRQ
lupyuen Jul 28, 2023
150b431
Clean
lupyuen Jul 28, 2023
fd11cba
Log IRQ
lupyuen Jul 28, 2023
eba8bbc
Change IRQ to 57, Ext IRQ is 32
lupyuen Jul 28, 2023
b1c349b
Log IRQ
lupyuen Jul 28, 2023
c03eba3
Extend to 127 IRQs
lupyuen Jul 28, 2023
4d76f70
Extend to 127 IRQs
lupyuen Jul 28, 2023
c8f0e3a
Fixing UART Interrupt
lupyuen Jul 28, 2023
121b08f
Fixing UART Interrupt
lupyuen Jul 28, 2023
bf3475d
Debug Exception
lupyuen Jul 28, 2023
a3f4121
Debug Exception
lupyuen Jul 28, 2023
2979e5f
Debug Exception
lupyuen Jul 28, 2023
715fab2
Debug Exception
lupyuen Jul 28, 2023
ea7e9a0
Debug Exception
lupyuen Jul 28, 2023
4ccd58d
Debug Exception
lupyuen Jul 28, 2023
c003d2e
Debug Exception
lupyuen Jul 28, 2023
c3c12d0
Debug Exception
lupyuen Jul 28, 2023
89d7fda
Fix PLIC for Hart 1 S-Mode
lupyuen Jul 28, 2023
c2d256a
IRQ 57 OK yay!
lupyuen Jul 28, 2023
e6f5ed7
Remove logs
lupyuen Jul 28, 2023
0678e84
Remove logs
lupyuen Jul 28, 2023
a5027d5
IRQ 57 OK yay!
lupyuen Jul 28, 2023
7923912
responds to UART Input yay
lupyuen Jul 29, 2023
1d5a79c
responds to UART Input yay
lupyuen Jul 29, 2023
9094e95
Interrupt triggered repeatedly
lupyuen Jul 29, 2023
9104a64
Shows 0 forever
lupyuen Jul 29, 2023
ba4231e
Checking claim
lupyuen Jul 29, 2023
652648d
Why UART_IIR_INTSTATUS = 0
lupyuen Jul 29, 2023
9d715b3
Log UART Interrupt Status. 056789
lupyuen Jul 29, 2023
37124df
Log UART Interrupt Status. 056789
lupyuen Jul 29, 2023
06e6b5a
Log riscv_dispatch_irq. Seems OK
lupyuen Jul 30, 2023
476eea0
Fix delay
lupyuen Jul 30, 2023
93dc2ab
Fixing interrupt
lupyuen Jul 30, 2023
7cd0b5f
Delay enable IRQ
lupyuen Jul 30, 2023
a74a89c
Remove logs
lupyuen Jul 30, 2023
84e2349
Remove logs. NSH OK yay!
lupyuen Jul 30, 2023
866da12
Hart 1 Machine Mode doesn't work
lupyuen Jul 30, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Expand Up @@ -60,3 +60,5 @@ uImage
.vscode
.DS_Store
tools/gdb/__pycache__
initrd
init.S
8 changes: 6 additions & 2 deletions arch/risc-v/include/qemu-rv/irq.h
Expand Up @@ -31,8 +31,12 @@

/* Map RISC-V exception code to NuttX IRQ */

#define QEMU_RV_IRQ_UART0 (RISCV_IRQ_MEXT + 10)
//// "JH7110 Interrupt Connections" says that Global Interrupts are 0 to 126 (127 total interrupts)
//// https://doc-en.rvspace.org/JH7110/TRM/JH7110_TRM/interrupt_connections.html
#define NR_IRQS (RISCV_IRQ_SEXT + 127)

#define NR_IRQS (QEMU_RV_IRQ_UART0 + 1)
////#define QEMU_RV_IRQ_UART0 (RISCV_IRQ_MEXT + 10)

////#define NR_IRQS (QEMU_RV_IRQ_UART0 + 1)

#endif /* __ARCH_RISCV_INCLUDE_QEMU_RV_IRQ_H */
5 changes: 5 additions & 0 deletions arch/risc-v/src/common/riscv_hostfs.c
Expand Up @@ -31,6 +31,8 @@
#include <string.h>
#include <syscall.h>
#include <unistd.h>
#include <debug.h>////
#include <assert.h>////

/****************************************************************************
* Pre-processor Definitions
Expand All @@ -52,6 +54,9 @@

static long host_call(unsigned int nbr, void *parm, size_t size)
{
_info("nbr=0x%x, parm=%p, size=%ld\n", nbr, parm, size);////
DEBUGPANIC();//// Semihosting not supported

#ifdef CONFIG_RISCV_SEMIHOSTING_HOSTFS_CACHE_COHERENCE
up_clean_dcache(parm, parm + size);
#endif
Expand Down
2 changes: 1 addition & 1 deletion arch/risc-v/src/qemu-rv/hardware/qemu_rv_memorymap.h
Expand Up @@ -28,7 +28,7 @@
/* Register Base Address ****************************************************/

#define QEMU_RV_CLINT_BASE 0x02000000
#define QEMU_RV_ACLINT_BASE 0x02f00000
////#define QEMU_RV_ACLINT_BASE 0x02f00000
#define QEMU_RV_PLIC_BASE 0x0c000000

#endif /* __ARCH_RISCV_SRC_QEMU_RV_HARDWARE_QEMU_RV_MEMORYMAP_H */
26 changes: 22 additions & 4 deletions arch/risc-v/src/qemu-rv/hardware/qemu_rv_plic.h
Expand Up @@ -31,14 +31,32 @@
* Pre-processor Definitions
****************************************************************************/

// | 0x0C00_0004 | 4B | RW | Source 1 priority
#define QEMU_RV_PLIC_PRIORITY (QEMU_RV_PLIC_BASE + 0x000000)

// | 0x0C00_1000 | 4B | RO | Start of pending array
#define QEMU_RV_PLIC_PENDING1 (QEMU_RV_PLIC_BASE + 0x001000)

// Previously:
// #define QEMU_RV_PLIC_PRIORITY (QEMU_RV_PLIC_BASE + 0x000000)
// #define QEMU_RV_PLIC_PENDING1 (QEMU_RV_PLIC_BASE + 0x001000)

#ifdef CONFIG_ARCH_USE_S_MODE
# define QEMU_RV_PLIC_ENABLE1 (QEMU_RV_PLIC_BASE + 0x002080)
# define QEMU_RV_PLIC_ENABLE2 (QEMU_RV_PLIC_BASE + 0x002084)
# define QEMU_RV_PLIC_THRESHOLD (QEMU_RV_PLIC_BASE + 0x201000)
# define QEMU_RV_PLIC_CLAIM (QEMU_RV_PLIC_BASE + 0x201004)
// | 0x0C00_2100 | 4B | RW | Start Hart 1 S-Mode interrupt enables
# define QEMU_RV_PLIC_ENABLE1 (QEMU_RV_PLIC_BASE + 0x002100)
# define QEMU_RV_PLIC_ENABLE2 (QEMU_RV_PLIC_BASE + 0x002104)

// | 0x0C20_2000 | 4B | RW | Hart 1 S-Mode priority threshold
# define QEMU_RV_PLIC_THRESHOLD (QEMU_RV_PLIC_BASE + 0x202000)

// | 0x0C20_2004 | 4B | RW | Hart 1 S-Mode claim/complete
# define QEMU_RV_PLIC_CLAIM (QEMU_RV_PLIC_BASE + 0x202004)

// Previously:
// # define QEMU_RV_PLIC_ENABLE1 (QEMU_RV_PLIC_BASE + 0x002080)
// # define QEMU_RV_PLIC_ENABLE2 (QEMU_RV_PLIC_BASE + 0x002084)
// # define QEMU_RV_PLIC_THRESHOLD (QEMU_RV_PLIC_BASE + 0x201000)
// # define QEMU_RV_PLIC_CLAIM (QEMU_RV_PLIC_BASE + 0x201004)
#else
# define QEMU_RV_PLIC_ENABLE1 (QEMU_RV_PLIC_BASE + 0x002000)
# define QEMU_RV_PLIC_ENABLE2 (QEMU_RV_PLIC_BASE + 0x002004)
Expand Down
86 changes: 82 additions & 4 deletions arch/risc-v/src/qemu-rv/qemu_rv_head.S
Expand Up @@ -40,17 +40,78 @@
.global __start

__start:
/* Begin Test */

/* DO NOT MODIFY. Image Header expected by Linux bootloaders.
*
* This `li` instruction has no meaningful effect except that
* its opcode forms the magic "MZ" signature of a PE/COFF file
* that is required for UEFI applications.
*
* Some bootloaders check the magic "MZ" to see if the image is a valid
* Linux image. But modifying the bootLoader is unnecessary unless we
* need to do a customized secure boot. So we just put "MZ" in the
* header to make the bootloader happy.
*/

c.li s4, -13 /* Magic Signature "MZ" (2 bytes) */
j real_start /* Jump to Kernel Start (2 bytes) */
.long 0 /* Executable Code padded to 8 bytes */
.quad 0x200000 /* Image load offset from start of RAM */
/* TODO: _e_initstack - __start */
.quad 171644 /* Effective size of kernel image, little-endian */
.quad 0x0 /* Kernel flags, little-endian */
.long 0x2 /* Version of this header */
.long 0 /* Reserved */
.quad 0 /* Reserved */
.ascii "RISCV\x00\x00\x00" /* Magic number, "RISCV" (8 bytes) */
.ascii "RSC\x05" /* Magic number 2, "RSC\x05" (4 bytes) */
.long 0 /* Reserved for PE COFF offset */

real_start:

/* Load UART Base Address to Register t0 */
li t0, 0x10000000

/* Load `1` to Register t1 */
li t1, 0x31
/* Store byte from Register t1 to UART Base Address, Offset 0 */
sb t1, 0(t0)

/* Load `2` to Register t1 */
li t1, 0x32
/* Store byte from Register t1 to UART Base Address, Offset 0 */
sb t1, 0(t0)

/* Load `3` to Register t1 */
li t1, 0x33
/* Store byte from Register t1 to UART Base Address, Offset 0 */
sb t1, 0(t0)

/* End Test */

/* Load mhartid (cpuid) */
/* Previously: csrr a0, mhartid */

/* We assume that OpenSBI has passed Hart ID (value 1) in Register a0. */
/* But NuttX expects Hart ID to start at 0, so we subtract 1. */
addi a0, a0, -1

csrr a0, mhartid
/* Print the Hart ID */
addi t1, a0, 0x30
/* Store byte from Register t1 to UART Base Address, Offset 0 */
sb t1, 0(t0)

/* Set stack pointer to the idle thread stack */

bnez a0, 1f
la sp, QEMU_RV_IDLESTACK_TOP
j 2f
1:
/* Print `4` */
li t0, 0x10000000
li t1, 0x34
sb t1, 0(t0)

/* Load the number of CPUs that the kernel supports */

Expand All @@ -63,10 +124,16 @@ __start:
/* If a0 (mhartid) >= t1 (the number of CPUs), stop here */

blt a0, t1, 3f
csrw mie, zero
csrw sie, zero
/* Previously: csrw mie, zero */
wfi

3:
/* Print `5` */
li t0, 0x10000000
li t1, 0x35
sb t1, 0(t0)

/* To get g_cpu_basestack[mhartid], must get g_cpu_basestack first */

la t0, g_cpu_basestack
Expand Down Expand Up @@ -95,13 +162,24 @@ __start:
add sp, sp, t0

2:
/* Print `6` */
li t0, 0x10000000
li t1, 0x36
sb t1, 0(t0)

/* Disable all interrupts (i.e. timer, external) in mie */

csrw mie, zero
csrw sie, zero
/* Previously: csrw mie, zero */

la t0, __trap_vec
csrw mtvec, t0
csrw stvec, t0
/* Previously: csrw mtvec, t0 */

/* Print `7` */
li t0, 0x10000000
li t1, 0x37
sb t1, 0(t0)

/* Jump to qemu_rv_start */

Expand Down
24 changes: 21 additions & 3 deletions arch/risc-v/src/qemu-rv/qemu_rv_irq.c
Expand Up @@ -54,6 +54,15 @@ void up_irqinitialize(void)
putreg32(0x0, QEMU_RV_PLIC_ENABLE1);
putreg32(0x0, QEMU_RV_PLIC_ENABLE2);

#ifdef NOTUSED
// Disable All Global Interrupts for Hart 1 Machine-Mode
// | 0x0C00_2080 | 4B | RW | Start Hart 1 M-Mode interrupt enables
#define QEMU_RV_PLIC_ENABLE1_MMODE (QEMU_RV_PLIC_BASE + 0x002080)
#define QEMU_RV_PLIC_ENABLE2_MMODE (QEMU_RV_PLIC_BASE + 0x002084)
putreg32(0x0, QEMU_RV_PLIC_ENABLE1_MMODE);
putreg32(0x0, QEMU_RV_PLIC_ENABLE2_MMODE);
#endif // NOTUSED

/* Colorize the interrupt stack for debug purposes */

#if defined(CONFIG_STACK_COLORATION) && CONFIG_ARCH_INTERRUPTSTACK > 15
Expand All @@ -65,7 +74,8 @@ void up_irqinitialize(void)

int id;

for (id = 1; id <= 52; id++)
////TODO: Why 52 PLIC Interrupts?
for (id = 1; id <= NR_IRQS; id++) //// Changed 52 to NR_IRQS
{
putreg32(1, (uintptr_t)(QEMU_RV_PLIC_PRIORITY + 4 * id));
}
Expand Down Expand Up @@ -104,6 +114,7 @@ void up_irqinitialize(void)

void up_disable_irq(int irq)
{
_info("irq=%d\n", irq);////
int extirq;

if (irq == RISCV_IRQ_SOFT)
Expand All @@ -124,7 +135,7 @@ void up_disable_irq(int irq)

/* Clear enable bit for the irq */

if (0 <= extirq && extirq <= 63)
if (0 <= extirq && extirq <= 63) ////TODO: Why 63?
{
modifyreg32(QEMU_RV_PLIC_ENABLE1 + (4 * (extirq / 32)),
1 << (extirq % 32), 0);
Expand All @@ -146,23 +157,27 @@ void up_disable_irq(int irq)

void up_enable_irq(int irq)
{
_info("irq=%d\n", irq);////
int extirq;

if (irq == RISCV_IRQ_SOFT)
{
_info("RISCV_IRQ_SOFT=%d\n", RISCV_IRQ_SOFT);////
/* Read m/sstatus & set machine software interrupt enable in m/sie */

SET_CSR(CSR_IE, IE_SIE);
}
else if (irq == RISCV_IRQ_TIMER)
{
_info("RISCV_IRQ_TIMER=%d\n", RISCV_IRQ_TIMER);////
/* Read m/sstatus & set timer interrupt enable in m/sie */

SET_CSR(CSR_IE, IE_TIE);
}
#ifdef CONFIG_BUILD_KERNEL
else if (irq == RISCV_IRQ_MTIMER)
{
_info("RISCV_IRQ_MTIMER=%d\n", RISCV_IRQ_MTIMER);////
/* Read m/sstatus & set timer interrupt enable in m/sie */

SET_CSR(mie, MIE_MTIE);
Expand All @@ -171,10 +186,11 @@ void up_enable_irq(int irq)
else if (irq > RISCV_IRQ_EXT)
{
extirq = irq - RISCV_IRQ_EXT;
_info("extirq=%d, RISCV_IRQ_EXT=%d\n", extirq, RISCV_IRQ_EXT);////

/* Set enable bit for the irq */

if (0 <= extirq && extirq <= 63)
if (0 <= extirq && extirq <= 63) ////TODO: Why 63?
{
modifyreg32(QEMU_RV_PLIC_ENABLE1 + (4 * (extirq / 32)),
0, 1 << (extirq % 32));
Expand All @@ -184,10 +200,12 @@ void up_enable_irq(int irq)
PANIC();
}
}
else { _info("***NOT ENABLED: irq=%d\n", irq); }////
}

irqstate_t up_irq_enable(void)
{
_info("\n");////
irqstate_t oldstat;

/* Enable external interrupts (mie/sie) */
Expand Down
3 changes: 3 additions & 0 deletions arch/risc-v/src/qemu-rv/qemu_rv_irq_dispatch.c
Expand Up @@ -26,6 +26,7 @@

#include <stdint.h>
#include <assert.h>
#include <debug.h>///

#include <nuttx/irq.h>
#include <nuttx/arch.h>
Expand Down Expand Up @@ -79,6 +80,8 @@ void *riscv_dispatch_irq(uintptr_t vector, uintptr_t *regs)

if (RISCV_IRQ_EXT <= irq)
{
////_info("irq=%d, RISCV_IRQ_EXT=%d\n", irq, RISCV_IRQ_EXT);////
////up_putc('.'); up_mdelay(1000);////
/* Then write PLIC_CLAIM to clear pending in PLIC */

putreg32(irq - RISCV_IRQ_EXT, QEMU_RV_PLIC_CLAIM);
Expand Down
18 changes: 17 additions & 1 deletion arch/risc-v/src/qemu-rv/qemu_rv_mm_init.c
Expand Up @@ -43,7 +43,7 @@
/* Map the whole I/O memory with vaddr = paddr mappings */

#define MMU_IO_BASE (0x00000000)
#define MMU_IO_SIZE (0x80000000)
#define MMU_IO_SIZE (0x40000000)

#ifdef CONFIG_ARCH_MMU_TYPE_SV32

Expand Down Expand Up @@ -269,6 +269,22 @@ void qemu_rv_kernel_mappings(void)
binfo("map kernel data\n");
map_region(KSRAM_START, KSRAM_START, KSRAM_SIZE, MMU_KDATA_FLAGS);

// Added RAM Disk
//// From nuttx/boards/risc-v/litex/arty_a7/include/board_memorymap.h
/* ramdisk (RW) */
extern uint8_t __ramdisk_start[];
extern uint8_t __ramdisk_size[];
// Copy 0x46100000 to __ramdisk_start (__ramdisk_size bytes)
// TODO: RAM Disk must not exceed __ramdisk_size bytes
memcpy((void *)__ramdisk_start, (void *)0x46100000, (size_t)__ramdisk_size);

#ifdef NOTUSED
/* Added RAM Disk */
_info("map RAM Disk\n");
map_region((uintptr_t)__ramdisk_start, (uintptr_t)__ramdisk_start, (uintptr_t)__ramdisk_size, MMU_KDATA_FLAGS);
_info("map RAM Disk done\n");
#endif // NOTUSED

#ifdef CONFIG_ARCH_MMU_TYPE_SV39

/* Connect the L1 and L2 page tables for the kernel text and data */
Expand Down