2 * FreeRTOS Kernel V10.1.0
\r
3 * Copyright (C) 2018 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 to permit persons to whom the Software is furnished to do so,
\r
10 * subject to the following conditions:
\r
12 * The above copyright notice and this permission notice shall be included in all
\r
13 * copies or substantial portions of the Software.
\r
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
\r
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
\r
17 * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
\r
18 * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
\r
19 * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
\r
20 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
\r
22 * http://www.FreeRTOS.org
\r
23 * http://aws.amazon.com/freertos
\r
25 * 1 tab == 4 spaces!
\r
30 * The register test task as described in the comments at the top of main-full.c.
\r
32 .global vRegTest1Implementation
\r
33 .global vRegTest2Implementation
\r
35 /* Variables that are incremented on each iteration of the reg test tasks -
\r
36 provided the tasks have not reported any errors. The check timer inspects these
\r
37 variables to ensure they are still incrementing as expected. If a variable
\r
38 stops incrementing then it is likely that its associate task has stalled or
\r
39 detected an error. */
\r
40 .extern ulRegTest1LoopCounter
\r
41 .extern ulRegTest2LoopCounter
\r
43 /*-----------------------------------------------------------*/
\r
47 vRegTest1Implementation:
\r
48 /* First fill the relevant registers with known values. r0 is always 0, r1
\r
49 is the stack pointer, and r3 is a read only small data area pointer. */
\r
60 /* R13 = read write small data area anchour. */
\r
61 /* R14 = return address for interrupt. */
\r
62 /* R15 = return address for sub-routine. */
\r
63 /* R16 = return address for trap. */
\r
64 /* R17 = return address for exceptions. */
\r
65 /* R18 = reserved for assembler and compiler temporaries. */
\r
80 /* Now test the register values to ensure they contain the same value that
\r
81 was written to them above. This task will get preempted frequently so
\r
82 other tasks are likely to have executed since the register values were
\r
83 written. If any register contains an unexpected value then the task will
\r
84 branch to Error_Loop_1, which in turn prevents it from incrementing its
\r
85 loop counter, enabling the check timer to determine that all is not as it
\r
90 bnei r18, Error_Loop_1
\r
92 bnei r18, Error_Loop_1
\r
94 bnei r18, Error_Loop_1
\r
96 bnei r18, Error_Loop_1
\r
98 bnei r18, Error_Loop_1
\r
100 bnei r18, Error_Loop_1
\r
102 bnei r18, Error_Loop_1
\r
104 bnei r18, Error_Loop_1
\r
106 bnei r18, Error_Loop_1
\r
108 bnei r18, Error_Loop_1
\r
110 bnei r18, Error_Loop_1
\r
112 bnei r18, Error_Loop_1
\r
114 bnei r18, Error_Loop_1
\r
116 bnei r18, Error_Loop_1
\r
118 bnei r18, Error_Loop_1
\r
120 bnei r18, Error_Loop_1
\r
122 bnei r18, Error_Loop_1
\r
124 bnei r18, Error_Loop_1
\r
126 bnei r18, Error_Loop_1
\r
128 bnei r18, Error_Loop_1
\r
130 bnei r18, Error_Loop_1
\r
132 bnei r18, Error_Loop_1
\r
134 /* If this task has not branched to the error loop, then everything is ok,
\r
135 and the check variable can be incremented to indicate that this task
\r
136 is still running. Then, brach back to the top to check the register
\r
138 lwi r18, r0, ulRegTest1LoopCounter
\r
140 swi r18, r0, ulRegTest1LoopCounter
\r
144 /* The test function will branch here if it discovers an error. This part
\r
145 of the code just sits in a NULL loop, which prevents the check variable
\r
146 incrementing any further to allow the check timer to recognize that this
\r
147 test has failed. */
\r
152 /*-----------------------------------------------------------*/
\r
156 vRegTest2Implementation:
\r
157 /* First fill the relevant registers with known values. r0 is always 0, r1
\r
158 is the stack pointer, and r3 is a read only small data area pointer. */
\r
166 addi r10, r0, 100000
\r
167 addi r11, r0, 110000
\r
168 addi r12, r0, 120000
\r
169 /* R13 = read write small data area anchour. */
\r
170 /* R14 = return address for interrupt. */
\r
171 /* R15 = return address for sub-routine. */
\r
172 /* R16 = return address for trap. */
\r
173 /* R17 = return address for exceptions. */
\r
174 /* R18 = reserved for assembler and compiler temporaries. */
\r
175 addi r19, r0, 190000
\r
176 addi r20, r0, 200000
\r
177 addi r21, r0, 210000
\r
178 addi r22, r0, 220000
\r
179 addi r23, r0, 230000
\r
180 addi r24, r0, 240000
\r
181 addi r25, r0, 250000
\r
182 addi r26, r0, 260000
\r
183 addi r27, r0, 270000
\r
184 addi r28, r0, 280000
\r
185 addi r29, r0, 290000
\r
186 addi r30, r0, 300000
\r
187 addi r31, r0, 310000
\r
189 /* Now test the register values to ensure they contain the same value that
\r
190 was written to them above. This task will get preempted frequently so
\r
191 other tasks are likely to have executed since the register values were
\r
192 written. If any register contains an unexpected value then the task will
\r
193 branch to Error_Loop_2, which in turn prevents it from incrementing its
\r
194 loop counter, enabling the check timer to determine that all is not as it
\r
198 xori r18, r3, 30000
\r
199 bnei r18, Error_Loop_2
\r
200 xori r18, r4, 40000
\r
201 bnei r18, Error_Loop_2
\r
202 xori r18, r6, 60000
\r
203 bnei r18, Error_Loop_2
\r
204 xori r18, r7, 70000
\r
205 bnei r18, Error_Loop_2
\r
206 xori r18, r8, 80000
\r
207 bnei r18, Error_Loop_2
\r
208 xori r18, r9, 90000
\r
209 bnei r18, Error_Loop_2
\r
210 xori r18, r10, 100000
\r
211 bnei r18, Error_Loop_2
\r
212 xori r18, r11, 110000
\r
213 bnei r18, Error_Loop_2
\r
214 xori r18, r12, 120000
\r
215 bnei r18, Error_Loop_2
\r
216 xori r18, r19, 190000
\r
217 bnei r18, Error_Loop_2
\r
218 xori r18, r20, 200000
\r
219 bnei r18, Error_Loop_2
\r
220 xori r18, r21, 210000
\r
221 bnei r18, Error_Loop_2
\r
222 xori r18, r22, 220000
\r
223 bnei r18, Error_Loop_2
\r
224 xori r18, r23, 230000
\r
225 bnei r18, Error_Loop_2
\r
226 xori r18, r24, 240000
\r
227 bnei r18, Error_Loop_2
\r
228 xori r18, r25, 250000
\r
229 bnei r18, Error_Loop_2
\r
230 xori r18, r26, 260000
\r
231 bnei r18, Error_Loop_2
\r
232 xori r18, r27, 270000
\r
233 bnei r18, Error_Loop_2
\r
234 xori r18, r28, 280000
\r
235 bnei r18, Error_Loop_2
\r
236 xori r18, r29, 290000
\r
237 bnei r18, Error_Loop_2
\r
238 xori r18, r30, 300000
\r
239 bnei r18, Error_Loop_2
\r
240 xori r18, r31, 310000
\r
241 bnei r18, Error_Loop_2
\r
243 /* If this task has not branched to the error loop, then everything is ok,
\r
244 and the check variable can be incremented to indicate that this task
\r
245 is still running. Then, brach back to the top to check the register
\r
247 lwi r18, r0, ulRegTest2LoopCounter
\r
249 swi r18, r0, ulRegTest2LoopCounter
\r
253 /* The test function will branch here if it discovers an error. This part
\r
254 of the code just sits in a NULL loop, which prevents the check variable
\r
255 incrementing any further to allow the check timer to recognize that this
\r
256 test has failed. */
\r