/* * Copyright (C) 2022, 2023 - Tillitis AB * SPDX-License-Identifier: GPL-2.0-only * * Modified for rusTkey. (See README.md for details.) */ OUTPUT_ARCH( "riscv" ) ENTRY(_start) MEMORY { RAM (rwx) : ORIGIN = 0x40000000, LENGTH = 0x20000 /* 128 KB */ } SECTIONS { .text.init : { *(.text.init) } >RAM .text : { . = ALIGN(4); *(.text) /* .text sections (code) */ *(.text*) /* .text* sections (code) */ *(.rodata) /* .rodata sections (constants, strings, etc.) */ *(.rodata*) /* .rodata* sections (constants, strings, etc.) */ *(.srodata) /* .rodata sections (constants, strings, etc.) */ *(.srodata*) /* .rodata* sections (constants, strings, etc.) */ *(.eh_frame) /* TODO I added the '.eh_frame' region (?) in here, now everything happily compiles. I get that the region is needed for stack unwinding. I understand that this notion of eh_personality represents the behavior of an application with certain behavior like unwinding, exception-handling, etc. However, it seems to "convenient" to fix everything by just adding one entry to the memory layout. (Note: the section is considered read-only for the application, therefore should be fine in `.text`. This is an educated guess, though.) */ . = ALIGN(4); _etext = .; _sidata = _etext; } >RAM .data : AT (_etext) { . = ALIGN(4); _sdata = .; . = ALIGN(4); *(.data) /* .data sections */ *(.data*) /* .data* sections */ *(.sdata) /* .sdata sections */ *(.sdata*) /* .sdata* sections */ . = ALIGN(4); _edata = .; } >RAM /* Uninitialized data section */ .bss : { . = ALIGN(4); _sbss = .; *(.bss) *(.bss*) *(.sbss) *(.sbss*) *(COMMON) . = ALIGN(4); _ebss = .; } >RAM } _stack_start = ORIGIN(RAM) + LENGTH(RAM);