Skip to content
Snippets Groups Projects
Commit f197453a authored by davip00's avatar davip00
Browse files

Work around qemu not (yet) setting the stack pointer

parent e2c1d4e4
No related branches found
No related tags found
No related merge requests found
......@@ -12,7 +12,7 @@ CWD ?= $(realpath $(CURDIR))
FLASH_ADDR ?= 0 # 2nd stage bootloader flash offset
DOCKER ?= docker run -it --rm -v $(CWD):$(CWD) -v $(MDK):$(MDK) -w $(CWD) mdashnet/riscv
TOOLCHAIN ?= $(DOCKER) riscv-none-elf
SRCS ?= $(MDK)/$(ARCH)/boot.c $(SOURCES)
SRCS ?= $(MDK)/$(ARCH)/boot.c $(MDK)/$(ARCH)/emulator_workarounds.S $(SOURCES)
build: $(PROG).bin
......
//; In the current state of our emulator, it doesn't run a proper boot ROM.
//; This function does some minor fixups (setting stack pointer etc.)
//; and runs the MDK init function.
.section .text
.align 2
.global emulator_workarounds
emulator_workarounds:
//; Not sure if this is the best address for the stack
//; FIXME: This should be set to a range specified in the linker script
li sp, 0x40384400
//; Jump to MDK's real setup function
j _reset
......@@ -5,7 +5,7 @@ MEMORY {
}
_eram = ORIGIN(dram) + LENGTH(dram);
ENTRY(_reset)
ENTRY(emulator_workarounds)
SECTIONS {
.text : { *(.text) *(.text*) } > iram
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment