Skip to content

Commit

Permalink
loader: change stack size from 32 words to 128 words
Browse files Browse the repository at this point in the history
If you need to place more local variables or do complex function call, take care of the stack size, you may need to increase it
  • Loading branch information
fanghuaqi authored Dec 27, 2024
1 parent e3f8d3f commit f206b31
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion loader/startup.S
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ _start:
csrw mcause, x0
csrw mtval, x0

/* no global variables or static variables are allowed in loader_main and its called sub functions */
/* TODO: take care of the stack size usage, if your function and subfunction are complex and use many variable */
jal loader_main

ebreak
Expand All @@ -33,5 +35,7 @@ early_exc_entry:
.section .data
.balign REGBYTES
stack:
.fill 32, REGBYTES, 0x8675309
/* TODO: Change 128 to bigger size if your code is complex and workarea is big enough */
/* Otherwise it may crupt normal text section code */
.fill 128, REGBYTES, 0x8675309
stack_end:

0 comments on commit f206b31

Please sign in to comment.