aboutsummaryrefslogtreecommitdiff
path: root/contrib/loaders/flash/fespi/riscv_wrapper.S
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/loaders/flash/fespi/riscv_wrapper.S')
-rw-r--r--contrib/loaders/flash/fespi/riscv_wrapper.S5
1 files changed, 4 insertions, 1 deletions
diff --git a/contrib/loaders/flash/fespi/riscv_wrapper.S b/contrib/loaders/flash/fespi/riscv_wrapper.S
index b63b48a..c3f11ec 100644
--- a/contrib/loaders/flash/fespi/riscv_wrapper.S
+++ b/contrib/loaders/flash/fespi/riscv_wrapper.S
@@ -11,7 +11,10 @@
.section .text.entry
.global _start
_start:
- la sp, stack_end
+ /* Spell out `la sp, stack_end` because otherwise the assembler won't
+ generate position-independent code. */
+1: auipc sp, %pcrel_hi(stack_end) # load stack_end(hi)
+ addi sp, sp, %pcrel_lo(1b) # load stack_end(lo)
jal flash_fespi
ebreak