soc: gd32vf103: Link soc-specific before common code

For a proper initialisation,  the soc-specific `__nuclei_start` has to
be executed before the common `__start`. To ensure that `__nuclei_start`
is linked first, I added the linker section init.

Signed-off-by: Greter Raffael <rgreter@baumer.com>
This commit is contained in:
Greter Raffael 2023-11-28 10:18:42 +00:00 committed by Carles Cufí
parent 43490289ff
commit 8460ed093e
3 changed files with 10 additions and 1 deletions

View file

@ -4,4 +4,6 @@
zephyr_sources(entry.S)
zephyr_sources(soc.c)
zephyr_linker_sources(ROM_START SORT_KEY 0x0 init.ld)
set(SOC_LINKER_SCRIPT ${ZEPHYR_BASE}/include/zephyr/arch/riscv/common/linker.ld CACHE INTERNAL "")

View file

@ -10,7 +10,7 @@
#include <zephyr/arch/riscv/csr.h>
GTEXT(__nuclei_start)
SECTION_FUNC(vectors, __nuclei_start)
SECTION_FUNC(init, __nuclei_start)
/* Disable Global Interrupt */
csrc mstatus, MSTATUS_MIE
/* Jump to logical address first to ensure correct operation of RAM region */

View file

@ -0,0 +1,7 @@
/*
* Copyright (c) 2023 Andes Technology Corporation
*
* SPDX-License-Identifier: Apache-2.0
*/
KEEP(*(.init.*))