mirror of
https://github.com/FreeRTOS/FreeRTOS-Kernel.git
synced 2025-09-07 06:37:47 -04:00
Move the RISC-V pxPortInitialiseStack() implementation to the assembly port file from the C port file so it can have access to the number of chip specific registers it needs to save space for on the stack.
This commit is contained in:
parent
911a1de273
commit
60b133b2c6
6 changed files with 195 additions and 149 deletions
|
@ -44,7 +44,7 @@
|
|||
* base set of RISC-V registers. There are additional
|
||||
* freertos_risc_v_port_specific_extensions.h files for RISC-V implementations
|
||||
* that do not include a standard CLINT or do add to the base set of RISC-V
|
||||
* regiters.
|
||||
* registers.
|
||||
*
|
||||
* CARE MUST BE TAKEN TO INCLDUE THE CORRECT
|
||||
* freertos_risc_v_port_specific_extensions.h HEADER FILE FOR THE CHIP
|
||||
|
@ -62,12 +62,49 @@
|
|||
|
||||
#define portasmHAS_CLINT 0
|
||||
|
||||
/* Constants to define the additional registers found on the Pulpino RI5KY. */
|
||||
#define lpstart0 0x7b0
|
||||
#define lpend0 0x7b1
|
||||
#define lpcount0 0x7b2
|
||||
#define lpstart1 0x7b4
|
||||
#define lpend1 0x7b5
|
||||
#define lpcount1 0x7b6
|
||||
|
||||
/* Six additional registers to save and restore, as per the #defines above. */
|
||||
#define portasmADDITIONAL_CONTEXT_SIZE 6 /* Must be even number on 32-bit cores. */
|
||||
|
||||
/* Save additional registers found on the Pulpino. */
|
||||
.macro portasmSAVE_ADDITIONAL_REGISTERS
|
||||
addi sp, sp, -portasmADDITIONAL_CONTEXT_SIZE /* Make room for the additional registers. */
|
||||
csrr t0, lpstart0 /* Load additional registers into accessable temporary registers. */
|
||||
csrr t1, lpend0
|
||||
csrr t2, lpcount0
|
||||
csrr t3, lpstart1
|
||||
csrr t4, lpend1
|
||||
csrr t5, lpcount1
|
||||
sw t0, 1 * portWORD_SIZE( sp )
|
||||
sw t1, 2 * portWORD_SIZE( sp )
|
||||
sw t2, 3 * portWORD_SIZE( sp )
|
||||
sw t3, 4 * portWORD_SIZE( sp )
|
||||
sw t4, 5 * portWORD_SIZE( sp )
|
||||
sw t5, 6 * portWORD_SIZE( sp )
|
||||
.endm
|
||||
|
||||
/* Restore the additional registers found on the Pulpino. */
|
||||
.macro portasmRESTORE_ADDITIONAL_REGISTERS
|
||||
/* This file is for use with chips that do not add to the standard RISC-V
|
||||
* register set, so there is nothing to do here. */
|
||||
lw t0, 1 * portWORD_SIZE( sp ) /* Load additional registers into accessable temporary registers. */
|
||||
lw t1, 2 * portWORD_SIZE( sp )
|
||||
lw t2, 3 * portWORD_SIZE( sp )
|
||||
lw t3, 4 * portWORD_SIZE( sp )
|
||||
lw t4, 5 * portWORD_SIZE( sp )
|
||||
lw t5, 6 * portWORD_SIZE( sp )
|
||||
csrw lpstart0, t0
|
||||
csrw lpend0, t1
|
||||
csrw lpcount0, t2
|
||||
csrw lpstart1, t3
|
||||
csrw lpend1, t4
|
||||
csrw lpcount1, t5
|
||||
addi sp, sp, -portasmADDITIONAL_CONTEXT_SIZE /* Remove space added for additional registers. */
|
||||
.endm
|
||||
|
||||
#endif /* __FREERTOS_RISC_V_EXTENSIONS_H__ */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue