mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
cpu/riscv_common: Jump to rom start on boot
With this the riscv start code jumps to the ROM start on boot when the ROM area doesn't start at address 0x0.
This commit is contained in:
parent
285d20b7bf
commit
c1d81cfb56
@ -21,6 +21,8 @@ ifneq (,$(ITIM_START_ADDR))
|
||||
LINKFLAGS += $(LINKFLAGPREFIX)--defsym=_itim_length=$(ITIM_LEN)
|
||||
endif
|
||||
|
||||
CFLAGS += -DROM_START_ADDR=$(ROM_START_ADDR)
|
||||
|
||||
LINKER_SCRIPT ?= riscv.ld
|
||||
|
||||
include $(RIOTMAKE)/arch/riscv.inc.mk
|
||||
|
@ -5,7 +5,10 @@
|
||||
* General Public License v2.1. See the file LICENSE in the top level
|
||||
* directory for more details.
|
||||
*/
|
||||
.section .init
|
||||
#include "vendor/riscv_csr.h"
|
||||
|
||||
.section .init
|
||||
|
||||
.globl _start
|
||||
.type _start,@function
|
||||
|
||||
@ -14,6 +17,15 @@ _start:
|
||||
.cfi_undefined ra
|
||||
.option push
|
||||
.option norelax
|
||||
csrc CSR_MSTATUS, MSTATUS_MIE
|
||||
la a0, _start
|
||||
li a1, ROM_START_ADDR
|
||||
bleu a1, a0, _start_real
|
||||
la a0, _start_real
|
||||
add a0, a0, a1
|
||||
jr a0
|
||||
|
||||
_start_real:
|
||||
la gp, __global_pointer$
|
||||
.option pop
|
||||
la sp, _sp
|
||||
|
Loading…
Reference in New Issue
Block a user