aboutsummaryrefslogtreecommitdiffstats
path: root/device.lds
diff options
context:
space:
mode:
authorBrian Cully <bjc@kublai.com>2022-08-03 09:00:58 -0400
committerBrian Cully <bjc@kublai.com>2022-08-03 09:00:58 -0400
commit17cac5fe6421e144619f4828409e8174986f3e3b (patch)
treeeb34f3af60fa95ec7ca53ac9acf0704dd250e07b /device.lds
downloadluchie-17cac5fe6421e144619f4828409e8174986f3e3b.tar.gz
luchie-17cac5fe6421e144619f4828409e8174986f3e3b.zip
Initial bootstrap into ‘main’.
Diffstat (limited to 'device.lds')
-rw-r--r--device.lds54
1 files changed, 54 insertions, 0 deletions
diff --git a/device.lds b/device.lds
new file mode 100644
index 0000000..ec4729d
--- /dev/null
+++ b/device.lds
@@ -0,0 +1,54 @@
+OUTPUT_ARCH("riscv")
+
+ENTRY(_start)
+
+MEMORY
+{
+ /* 0x0000_0000 is an alias for 0x08000_0000 */
+ FLASH(rwx) : ORIGIN = 0x00000000, LENGTH = 128K
+ RAM(rw) : ORIGIN = 0x20000000, LENGTH = 32K
+}
+
+PHDRS
+{
+ text PT_LOAD;
+ bss PT_NULL;
+ rodata PT_LOAD;
+ data PT_LOAD;
+}
+
+SECTIONS
+{
+ .text : {
+ PROVIDE(_text_start = .);
+ *(.text.init) *(.text .text.*)
+ PROVIDE(_text_end = .);
+ } >FLASH AT>FLASH :text
+
+ PROVIDE(__global_pointer$ = . + 2048);
+
+ .rodata : {
+ PROVIDE(_rodata_start = .);
+ *(.rodata .rodata.*)
+ PROVIDE(_rodata_end = .);
+ } >FLASH AT>FLASH :rodata
+
+ . = ALIGN(4096);
+
+ .data : {
+ PROVIDE(_data_start = .);
+ *(.sdata .sdata.*) *(.data .data.*)
+ PROVIDE(_data_end = .);
+ } >RAM AT>RAM :data
+
+ .bss : {
+ PROVIDE(_bss_start = .);
+ *(.sbss .sbss.*) *(.bss .bss.*)
+ PROVIDE(_bss_end = .);
+ } >RAM AT>RAM :bss
+
+ . = ALIGN(2);
+ PROVIDE(_memory_start = ORIGIN(RAM));
+ PROVIDE(_memory_end = _memory_start + LENGTH(RAM));
+ PROVIDE(_stack_top = . + _memory_end);
+}