arch: riscv: linker script: add support for rom_start section

With this change, we can put contents into rom_start section
by calling zephyr_linker_sources(ROM_START ...)

Signed-off-by: Dino Li <Dino.Li@ite.com.tw>
Co-authored-by: Torsten Tejlmand Rasmussen
Change-Id: If1169423b013d3e4df52d91cdb2fbdddc3bace7b
This commit is contained in:
Dino Li 2021-05-26 14:45:07 +08:00 committed by Kumar Gala
parent 958c79ea5a
commit 2bf63134e8
2 changed files with 11 additions and 1 deletions

View file

@ -1088,7 +1088,8 @@ endfunction(zephyr_check_compiler_flag_hardcoded)
# RODATA Inside the rodata output section.
# ROM_START Inside the first output section of the image. This option is
# currently only available on ARM Cortex-M, ARM Cortex-R,
# x86, ARC, and openisa_rv32m1.
# x86, ARC, openisa_rv32m1, and RISC-V.
# Note: On RISC-V the rom_start section will be after vector section.
# RAM_SECTIONS Inside the RAMABLE_REGION GROUP.
# SECTIONS Near the end of the file. Don't use this when linking into
# RAMABLE_REGION, use RAM_SECTIONS instead.

View file

@ -108,6 +108,15 @@ SECTIONS
KEEP(*(.vectors.*))
} GROUP_LINK_IN(ROMABLE_REGION)
SECTION_PROLOGUE(rom_start,,)
{
. = ALIGN(16);
/* Located in generated directory. This file is populated by calling
* zephyr_linker_sources(ROM_START ...).
*/
#include <snippets-rom-start.ld>
} GROUP_LINK_IN(ROMABLE_REGION)
SECTION_PROLOGUE(_RESET_SECTION_NAME,,)
{
KEEP(*(.reset.*))