OUTPUT_FORMAT("elf32-littleriscv") OUTPUT_ARCH(riscv) ENTRY(_start) MEMORY { RAM (rwx) : ORIGIN = 0x80000000, LENGTH = 16M } PHDRS { text PT_LOAD FLAGS(5); data PT_LOAD FLAGS(6); } SECTIONS { . = ORIGIN(RAM); .text : ALIGN(4) { KEEP(*(.vectors)) *(.text.startup .text.startup.*) *(.text .text.*) } > RAM :text .rodata : ALIGN(4) { *(.rodata .rodata.*) } > RAM :text .data : ALIGN(16) { __data_start = .; *(.data .data.*) *(.sdata .sdata.*) __data_end = .; } > RAM :data .bss (NOLOAD) : ALIGN(16) { __bss_start = .; *(.bss .bss.* COMMON) *(.sbss .sbss.*) __bss_end = .; } > RAM :data . = ALIGN(16); _end = .; PROVIDE(end = .); __stack_top = ORIGIN(RAM) + LENGTH(RAM); __stack_reserve = 64K; __stack_bottom = __stack_top - __stack_reserve; __global_pointer$ = __data_start + 0x800; /DISCARD/ : { *(.comment) *(.note .note.*) } } ASSERT(_end <= __stack_bottom, "C10: program overlaps the reserved 64 KiB stack")