summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortaitep <taitep@taitep.se>2025-12-21 19:38:32 +0100
committertaitep <taitep@taitep.se>2025-12-21 19:38:32 +0100
commita2d4dec4176d9ef89a8f411dbb3503c217ba0d62 (patch)
treeeaf0b14f27903792ff3f305be4b4d0829586995c
parent6c39a5eef270e160f9954dc8eac99ce53e8423c9 (diff)
Add some stuff to help with using C in link.ld
-rw-r--r--link.ld21
1 files changed, 15 insertions, 6 deletions
diff --git a/link.ld b/link.ld
index 3868b23..50514b1 100644
--- a/link.ld
+++ b/link.ld
@@ -1,22 +1,31 @@
ENTRY(_start)
-SECTIONS {
- . = 0x80000000;
+MEMORY {
+ RAM (rwx) : ORIGIN = 0x80000000, LENGTH = 1M
+}
+SECTIONS {
.text : ALIGN(4) {
+ *(.text._start)
*(.text*)
- }
+ } > RAM
.rodata : ALIGN(8) {
*(.rodata*)
- }
+ } > RAM
.data : ALIGN(8) {
+ _data = .;
*(.data*)
- }
+ _edata = .;
+ } > RAM
.bss : ALIGN(8) {
+ _bss = .;
*(.bss*)
*(COMMON)
- }
+ _ebss = .;
+ } > RAM
+
+ _stack_top = ORIGIN(RAM) + LENGTH(RAM);
}