summaryrefslogtreecommitdiff
path: root/linker.ld
diff options
context:
space:
mode:
authorRichard Qin <richard.qin.x@gmail.com>2025-12-08 22:25:48 +0800
committerRichard Qin <richard.qin.x@gmail.com>2025-12-08 22:25:48 +0800
commit8cf8be522133548ee25fdcb0258ddf3950a68bcf (patch)
tree17d97abd848638d44de41e202d891dcaf4bb68c0 /linker.ld
downloadlume-8cf8be522133548ee25fdcb0258ddf3950a68bcf.tar.gz
lume-8cf8be522133548ee25fdcb0258ddf3950a68bcf.tar.xz
The start of the project -- A MicroDOS
feat: Initial bare-metal RISC-V boot with UART
Diffstat (limited to 'linker.ld')
-rw-r--r--linker.ld47
1 files changed, 47 insertions, 0 deletions
diff --git a/linker.ld b/linker.ld
new file mode 100644
index 0000000..0b01e98
--- /dev/null
+++ b/linker.ld
@@ -0,0 +1,47 @@
+OUTPUT_ARCH( "riscv" )
+ENTRY(_start)
+
+MEMORY
+{
+ ram (wxa) : ORIGIN = 0x80000000, LENGTH = 128M
+}
+
+SECTIONS
+{
+ . = 0x80000000;
+
+ .text : {
+ PROVIDE(_text_start = .);
+ *(.text.entry)
+ *(.text .text.*)
+ PROVIDE(_text_end = .);
+ } > ram
+
+ .rodata : {
+ . = ALIGN(16);
+ PROVIDE(_rodata_start = .);
+ *(.rodata .rodata.*)
+ PROVIDE(_rodata_end = .);
+ } > ram
+
+ .data : {
+ . = ALIGN(16);
+ PROVIDE(_data_start = .);
+ *(.data .data.*)
+ *(.sdata .sdata.*)
+ PROVIDE(_data_end = .);
+ } > ram
+
+ .bss : {
+ . = ALIGN(16);
+ PROVIDE(_bss_start = .);
+ *(.bss .bss.*)
+ *(.sbss .sbss.*)
+ PROVIDE(_bss_end = .);
+ } > ram
+
+ . = ALIGN(4096);
+ PROVIDE(_stack_top = . + 0x8000);
+ . = . + 0x8000;
+ PROVIDE(_heap_start = .);
+} \ No newline at end of file