From f3232373fe128512909dac5faed527c66780ef4a Mon Sep 17 00:00:00 2001 From: Eyck Jentzsch Date: Sun, 1 Feb 2026 18:58:28 +0100 Subject: [PATCH] changes memeory map to match RISCV-VP, commit a94fd67 --- port/moonlight/platform.h | 6 +++--- src/memory_map.ld | 8 ++++---- src/sections.ld | 11 ++++++++--- 3 files changed, 15 insertions(+), 10 deletions(-) diff --git a/port/moonlight/platform.h b/port/moonlight/platform.h index 1194f7e..dc74a02 100644 --- a/port/moonlight/platform.h +++ b/port/moonlight/platform.h @@ -5,11 +5,11 @@ #include "riscv-traps.h" #define PERIPH(TYPE, ADDR) ((volatile TYPE*)(ADDR)) -#define APB_BASE 0x10000000 +#define APB_BASE 0xF0000000 #define uart PERIPH(uart_t, APB_BASE + 0x01000) #define aclint PERIPH(aclint_t, APB_BASE + 0x30000) -#define ethmac0 PERIPH(ethmac_t, 0x18000000) -#define ethmac1 PERIPH(ethmac_t, 0x18001000) +#define ethmac0 PERIPH(ethmac_t, 0xF1000000) +#define ethmac1 PERIPH(ethmac_t, 0xF1001000) #define UART0_IRQ 16 #define TIMER0_IRQ0 17 diff --git a/src/memory_map.ld b/src/memory_map.ld index 378d716..2299136 100644 --- a/src/memory_map.ld +++ b/src/memory_map.ld @@ -1,7 +1,7 @@ MEMORY { - ram (wxa!ri) : ORIGIN = 0x00000000, LENGTH = 128K - rom (rxai!w) : ORIGIN = 0x10080000, LENGTH = 8k - flash (rxai!w) : ORIGIN = 0x20000000, LENGTH = 16M - dram (wxa!ri) : ORIGIN = 0x40000000, LENGTH = 2048M + dram (wxa!ri) : ORIGIN = 0x00000000, LENGTH = 1024M + ram (wxa!ri) : ORIGIN = 0xE0000000, LENGTH = 128K + rom (rxai!w) : ORIGIN = 0xF0080000, LENGTH = 8k + flash (rxai!w) : ORIGIN = 0xF2000000, LENGTH = 16M } diff --git a/src/sections.ld b/src/sections.ld index 67cf800..0e53721 100644 --- a/src/sections.ld +++ b/src/sections.ld @@ -11,7 +11,6 @@ SECTIONS { __stack_size = DEFINED(__stack_size) ? __stack_size : 2K; __stack_segment_size = DEFINED(__stack_segment_size) ? __stack_segment_size : __stack_size; - __data_vma_base = ORIGIN(LOCATION_DATA) + ((ORIGIN(LOCATION_DATA) == 0) ? 0x10 : 0); /* Code/Const in LOCATION_TEXT */ . = ORIGIN(LOCATION_TEXT); @@ -48,9 +47,15 @@ SECTIONS PROVIDE_HIDDEN(__fini_array_end = .); } > LOCATION_TEXT :text - /* .data in LOCATION_DATA, Load-Image in LOCATION_TEXT, PHDR is data */ - .data __data_vma_base : ALIGN(4) + .data_pad (NOLOAD) : ALIGN(4) { + } > LOCATION_DATA :data + __data_offs = ((ADDR(.data_pad) == 0) ? 0x10 : 0); + + /* .data in LOCATION_DATA, Load-Image in LOCATION_TEXT, PHDR is data */ + .data : ALIGN(4) + { + . += __data_offs; __data_start = .; *(.data .data.*) __data_end = .;