\r
/* Save additional registers found on the Pulpino. */\r
.macro portasmSAVE_ADDITIONAL_REGISTERS\r
- addi sp, sp, -portasmADDITIONAL_CONTEXT_SIZE /* Make room for the additional registers. */\r
+ addi sp, sp, -(portasmADDITIONAL_CONTEXT_SIZE * portWORD_SIZE) /* Make room for the additional registers. */\r
csrr t0, lpstart0 /* Load additional registers into accessable temporary registers. */\r
csrr t1, lpend0\r
csrr t2, lpcount0\r
csrw lpstart1, t3\r
csrw lpend1, t4\r
csrw lpcount1, t5\r
- addi sp, sp, -portasmADDITIONAL_CONTEXT_SIZE /* Remove space added for additional registers. */\r
+ addi sp, sp, (portasmADDITIONAL_CONTEXT_SIZE * portWORD_SIZE )/* Remove space added for additional registers. */\r
.endm\r
\r
#endif /* __FREERTOS_RISC_V_EXTENSIONS_H__ */\r
* x6\r
* x5\r
* portTASK_RETURN_ADDRESS\r
+ * [chip specific registers go here]\r
* pxCode\r
*/\r
.align 8\r
.func\r
pxPortInitialiseStack:\r
\r
- addi t0, x0, portasmADDITIONAL_CONTEXT_SIZE /* The number of chip specific additional registers. */\r
-\r
-chip_specific_stack_frame: /* First add any chip specific registers to the stack frame being created. */\r
- beq t0, x0, standard_stack_frame /* No more chip specific registers to save. */\r
- addi a0, a0, -portWORD_SIZE /* Make space for chip specific register. */\r
- sw x0, 0(a0) /* Give the chip specific register an initial value of zero. */\r
- addi t0, t0, -1 /* Decrement the count of chip specific registers remaining. */\r
- j chip_specific_stack_frame /* Until no more chip specific registers. */\r
-\r
-standard_stack_frame: /* Now create the stack frame for the standard registers. */\r
csrr t0, mstatus /* Obtain current mstatus value. */\r
addi t1, x0, 0x188 /* Generate the value 0x1880, which are the MPIE and MPP bits to set in mstatus. */\r
slli t1, t1, 4\r
sw a2, 0(a0) /* Task parameters (pvParameters parameter) goes into register X10/a0 on the stack. */\r
addi a0, a0, -(6 * portWORD_SIZE) /* Space for registers x5-x9. */\r
sw x0, 0(a0) /* Return address onto the stack, could be portTASK_RETURN_ADDRESS */\r
+ addi t0, x0, portasmADDITIONAL_CONTEXT_SIZE /* The number of chip specific additional registers. */\r
+chip_specific_stack_frame: /* First add any chip specific registers to the stack frame being created. */\r
+ beq t0, x0, 1f /* No more chip specific registers to save. */\r
+ addi a0, a0, -portWORD_SIZE /* Make space for chip specific register. */\r
+ sw x0, 0(a0) /* Give the chip specific register an initial value of zero. */\r
+ addi t0, t0, -1 /* Decrement the count of chip specific registers remaining. */\r
+ j chip_specific_stack_frame /* Until no more chip specific registers. */\r
+1:\r
addi a0, a0, -portWORD_SIZE\r
sw a1, 0(a0) /* mret value (pxCode parameter) onto the stack. */\r
ret\r