From 8fdc18325e92117d59448ba2f7f01348c05d27d4 Mon Sep 17 00:00:00 2001 From: D4VID Date: Sun, 12 Jan 2025 16:00:01 +0100 Subject: [PATCH] Handle .rodata --- .gitignore | 1 + Makefile | 1 + memory.x | 9 +++++---- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index 56b93a1..5ad8f69 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ /target text.bin +rodata.bin diff --git a/Makefile b/Makefile index 6d69614..d0b209e 100644 --- a/Makefile +++ b/Makefile @@ -5,6 +5,7 @@ build: extract: build riscv32-elf-objcopy -O binary --only-section=.text target/riscv32i-unknown-none-elf/release/lw-riscv text.bin + riscv32-elf-objcopy -O binary --only-section=.rodata target/riscv32i-unknown-none-elf/release/lw-riscv rodata.bin size: extract cargo size --release -- -A diff --git a/memory.x b/memory.x index 741d469..a25471a 100644 --- a/memory.x +++ b/memory.x @@ -1,11 +1,12 @@ MEMORY { - RAM : ORIGIN = 0x10000000, LENGTH = 16K - FLASH : ORIGIN = 0x00000000, LENGTH = 256K + INST : ORIGIN = 0x00000000, LENGTH = 256K + CONST : ORIGIN = 0x40000000, LENGTH = 16K + RAM : ORIGIN = 0x80000000, LENGTH = 16K } -REGION_ALIAS("REGION_TEXT", FLASH); -REGION_ALIAS("REGION_RODATA", FLASH); +REGION_ALIAS("REGION_TEXT", INST); +REGION_ALIAS("REGION_RODATA", CONST); REGION_ALIAS("REGION_DATA", RAM); REGION_ALIAS("REGION_BSS", RAM); REGION_ALIAS("REGION_HEAP", RAM);