-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlinker.ld
More file actions
45 lines (37 loc) · 1.05 KB
/
linker.ld
File metadata and controls
45 lines (37 loc) · 1.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
/* Copyright (c) 2025, Rye Stahle-Smith
December 2nd, 2025 - linker.ld
Description: Kernel linker script defining memory layout, virtual addresses, sections, and entry point for the RISC-V OS. */
ENTRY(_start)
MEMORY
{
RAM (rwx) : ORIGIN = 0x80000000, LENGTH = 50M
}
SECTIONS
{
. = ORIGIN(RAM);
.text : {
*(.text*)
*(.rodata*)
} > RAM
.data : {
*(.data*)
} > RAM
.bss : {
__bss_start__ = .;
*(.bss*)
*(COMMON)
__bss_end__ = .;
} > RAM
/* ----------------------------------------------- */
/* Kernel heap region: grows upward */
/* ----------------------------------------------- */
. = ALIGN(16);
_kernel_heap_start = .;
/* Reserve 10 MB for kernel heap (tweak as needed) */
. = . + 10M;
_kernel_heap_end = .;
/* ----------------------------------------------- */
/* Stack at top of RAM (grows downward) */
/* ----------------------------------------------- */
_stack_start = ORIGIN(RAM) + LENGTH(RAM);
}