/* The monitor: ROM 20000-27FFF (writes ignored), RAM 28000-29FFF (data only) with the saved registers at 29E80h (crt0.S) and the stack below them. */ OUTPUT_ARCH("riscv") ENTRY(_start) MEMORY { ROM (rx) : ORIGIN = 0x20000, LENGTH = 0x8000 RAM (rw) : ORIGIN = 0x28000, LENGTH = 0x1B00 } SECTIONS { .text : { KEEP(*(.text.start)) *(.text .text.*) *(.rodata .rodata.* .srodata .srodata.*) . = ALIGN(4); } > ROM .data : ALIGN(4) { __data_start = .; *(.data .data.* .sdata .sdata.*) . = ALIGN(4); __data_end = .; } > RAM AT > ROM __data_load = LOADADDR(.data); /* the monitor's gp (set in crt0.S): its variables in one instruction */ /* (0xC00, not 0x800: before relaxing, the ROM overflows into 28000h) */ __global_pointer$ = ORIGIN(RAM) + 0xC00; .bss (NOLOAD) : ALIGN(4) { __bss_start = .; *(.sbss .sbss.* .bss .bss.* COMMON) . = ALIGN(4); __bss_end = .; } > RAM /DISCARD/ : { *(.comment) *(.riscv.attributes) } }