riscv: linker.ld: Port vector table to zephyr_linker_sources()

Put it in its own linker file snippet.

Signed-off-by: Øyvind Rønningstad <oyvind.ronningstad@nordicsemi.no>
This commit is contained in:
Øyvind Rønningstad 2019-11-29 13:31:53 +01:00 committed by Anas Nashif
commit 8531c7cb44
3 changed files with 36 additions and 27 deletions

View file

@ -18,3 +18,5 @@ zephyr_sources(
wdog.S
soc.c
)
zephyr_linker_sources(TEXT_START SORT_KEY 0x0vectors vector_table.ld)

View file

@ -103,39 +103,14 @@ SECTIONS
SECTION_PROLOGUE(_TEXT_SECTION_NAME,,)
{
/*
* Respect for CONFIG_TEXT_SECTION_OFFSET is mandatory
* for MCUboot support, so .reset.* and .exception.*
* must come after that offset from ROM_BASE.
*/
#ifdef CONFIG_BOOTLOADER_MCUBOOT
/*
* For CONFIG_BOOTLOADER_MCUBOOT, the vector table is located at the
* end of the image header of the MCUboot. After the tagert image is
* boot, the register Machine Trap-Vector Base Address (MTVEC) is
* set with the value of _vector_start in the reset handler.
*/
_vector_start = .;
KEEP(*(.vectors.*))
_vector_end = .;
. = ALIGN(4);
#endif
KEEP(*(.reset.*))
KEEP(*(".exception.entry.*")) /* contains __irq_wrapper */
*(".exception.other.*")
KEEP(*(.openocd_debug))
KEEP(*(".openocd_debug.*"))
_image_text_start = .;
/* Located in generated directory. This file is populated by the
* zephyr_linker_sources() Cmake function.
*/
#include <snippets-text-start.ld>
_image_text_start = .;
*(.text .text.*)
*(.gnu.linkonce.t.*)
*(.eh_frame)

View file

@ -0,0 +1,32 @@
/*
* Copyright (c) 2019 Foundries.io Ltd
* Copyright (c) 2019 Nordic Semiconductor ASA
*
* SPDX-License-Identifier: Apache-2.0
*/
/*
* Respect for CONFIG_TEXT_SECTION_OFFSET is mandatory
* for MCUboot support, so .reset.* and .exception.*
* must come after that offset from ROM_BASE.
*/
#ifdef CONFIG_BOOTLOADER_MCUBOOT
/*
* For CONFIG_BOOTLOADER_MCUBOOT, the vector table is located at the
* end of the image header of the MCUboot. After the tagert image is
* boot, the register Machine Trap-Vector Base Address (MTVEC) is
* set with the value of _vector_start in the reset handler.
*/
_vector_start = .;
KEEP(*(.vectors.*))
_vector_end = .;
. = ALIGN(4);
#endif
KEEP(*(.reset.*))
KEEP(*(".exception.entry.*")) /* contains __irq_wrapper */
*(".exception.other.*")
KEEP(*(.openocd_debug))
KEEP(*(".openocd_debug.*"))