2 * FreeRTOS Kernel V10.2.0
\r
3 * Copyright (C) 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
\r
5 * Permission is hereby granted, free of charge, to any person obtaining a copy of
\r
6 * this software and associated documentation files (the "Software"), to deal in
\r
7 * the Software without restriction, including without limitation the rights to
\r
8 * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
\r
9 * the Software, and t
\r
11 o permit persons to whom the Software is furnished to do so,
\r
12 * subject to the following conditions:
\r
14 * The above copyright notice and this permission notice shall be included in all
\r
15 * copies or substantial portions of the Software.
\r
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
\r
18 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
\r
19 * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
\r
20 * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
\r
21 * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
\r
22 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
\r
24 * http://www.FreeRTOS.org
\r
25 * http://aws.amazon.com/freertos
\r
27 * 1 tab == 4 spaces!
\r
31 * The FreeRTOS kernel's RISC-V port is split between the the code that is
\r
32 * common across all currently supported RISC-V chips (implementations of the
\r
33 * RISC-V ISA), and code that tailors the port to a specific RISC-V chip:
\r
35 * + FreeRTOS\Source\portable\GCC\RISC-V-RV32\portASM.S contains the code that
\r
36 * is common to all currently supported RISC-V chips. There is only one
\r
37 * portASM.S file because the same file is built for all RISC-V target chips.
\r
39 * + Header files called freertos_risc_v_chip_specific_extensions.h contain the
\r
40 * code that tailors the FreeRTOS kernel's RISC-V port to a specific RISC-V
\r
41 * chip. There are multiple freertos_risc_v_chip_specific_extensions.h files
\r
42 * as there are multiple RISC-V chip implementations.
\r
45 * TAKE CARE TO INCLUDE THE CORRECT freertos_risc_v_chip_specific_extensions.h
\r
46 * HEADER FILE FOR THE CHIP IN USE. This is done using the assembler's (not the
\r
47 * compiler's!) include path. For example, if the chip in use includes a core
\r
48 * local interrupter (CLINT) and does not include any chip specific register
\r
49 * extensions then add the path below to the assembler's include path:
\r
50 * FreeRTOS\Source\portable\GCC\RISC-V-RV32\chip_specific_extensions\RV32I_CLINT_no_extensions
\r
55 * This freertos_risc_v_chip_specific_extensions.h is for use with Pulpino Ri5cy
\r
56 * devices, developed and tested using the Vega board RV32M1RM.
\r
59 #ifndef __FREERTOS_RISC_V_EXTENSIONS_H__
\r
60 #define __FREERTOS_RISC_V_EXTENSIONS_H__
\r
62 #define portasmHAS_CLINT 0
\r
64 /* Constants to define the additional registers found on the Pulpino RI5KY. */
\r
65 #define lpstart0 0x7b0
\r
66 #define lpend0 0x7b1
\r
67 #define lpcount0 0x7b2
\r
68 #define lpstart1 0x7b4
\r
69 #define lpend1 0x7b5
\r
70 #define lpcount1 0x7b6
\r
72 /* Six additional registers to save and restore, as per the #defines above. */
\r
73 #define portasmADDITIONAL_CONTEXT_SIZE 6 /* Must be even number on 32-bit cores. */
\r
75 /* Save additional registers found on the Pulpino. */
\r
76 .macro portasmSAVE_ADDITIONAL_REGISTERS
\r
77 addi sp, sp, -(portasmADDITIONAL_CONTEXT_SIZE * portWORD_SIZE) /* Make room for the additional registers. */
\r
78 csrr t0, lpstart0 /* Load additional registers into accessable temporary registers. */
\r
84 sw t0, 1 * portWORD_SIZE( sp )
\r
85 sw t1, 2 * portWORD_SIZE( sp )
\r
86 sw t2, 3 * portWORD_SIZE( sp )
\r
87 sw t3, 4 * portWORD_SIZE( sp )
\r
88 sw t4, 5 * portWORD_SIZE( sp )
\r
89 sw t5, 6 * portWORD_SIZE( sp )
\r
92 /* Restore the additional registers found on the Pulpino. */
\r
93 .macro portasmRESTORE_ADDITIONAL_REGISTERS
\r
94 lw t0, 1 * portWORD_SIZE( sp ) /* Load additional registers into accessable temporary registers. */
\r
95 lw t1, 2 * portWORD_SIZE( sp )
\r
96 lw t2, 3 * portWORD_SIZE( sp )
\r
97 lw t3, 4 * portWORD_SIZE( sp )
\r
98 lw t4, 5 * portWORD_SIZE( sp )
\r
99 lw t5, 6 * portWORD_SIZE( sp )
\r
106 addi sp, sp, (portasmADDITIONAL_CONTEXT_SIZE * portWORD_SIZE )/* Remove space added for additional registers. */
\r
109 #endif /* __FREERTOS_RISC_V_EXTENSIONS_H__ */
\r