]> git.sur5r.net Git - freertos/blob - FreeRTOS/Demo/CORTEX_R4F_RZ_T_GCC_IAR/src/Full_Demo/reg_test_GCC.S
Update to MIT licensed FreeRTOS V10.0.0 - see https://www.freertos.org/History.txt
[freertos] / FreeRTOS / Demo / CORTEX_R4F_RZ_T_GCC_IAR / src / Full_Demo / reg_test_GCC.S
1 /*\r
2  * FreeRTOS Kernel V10.0.0\r
3  * Copyright (C) 2017 Amazon.com, Inc. or its affiliates.  All Rights Reserved.\r
4  *\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
11  *\r
12  * The above copyright notice and this permission notice shall be included in all\r
13  * copies or substantial portions of the Software. If you wish to use our Amazon\r
14  * FreeRTOS name, please do so in a fair use way that does not cause confusion.\r
15  *\r
16  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r
17  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\r
18  * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\r
19  * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\r
20  * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
21  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r
22  *\r
23  * http://www.FreeRTOS.org\r
24  * http://aws.amazon.com/freertos\r
25  *\r
26  * 1 tab == 4 spaces!\r
27  */\r
28 \r
29         .global vRegTest1Implementation\r
30         .global vRegTest2Implementation\r
31         .extern ulRegTest1LoopCounter\r
32         .extern ulRegTest2LoopCounter\r
33 \r
34         .text\r
35         .arm\r
36 \r
37         /* This function is explained in the comments at the top of main-full.c. */\r
38 .type vRegTest1Implementation, %function\r
39 vRegTest1Implementation:\r
40 \r
41         /* Fill each general purpose register with a known value. */\r
42         mov             r0,  #0xFF\r
43         mov             r1,  #0x11\r
44         mov             r2,  #0x22\r
45         mov             r3,  #0x33\r
46         mov     r4,  #0x44\r
47         mov     r5,  #0x55\r
48         mov     r6,  #0x66\r
49         mov     r7,  #0x77\r
50         mov     r8,  #0x88\r
51         mov     r9,  #0x99\r
52         mov     r10, #0xAA\r
53         mov     r11, #0xBB\r
54         mov     r12, #0xCC\r
55         mov             r14, #0xEE\r
56 \r
57 \r
58         /* Fill each FPU register with a known value. */\r
59         vmov    d0, r0, r1\r
60         vmov    d1, r2, r3\r
61         vmov    d2, r4, r5\r
62         vmov    d3, r6, r7\r
63         vmov    d4, r8, r9\r
64         vmov    d5, r10, r11\r
65         vmov    d6, r0, r1\r
66         vmov    d7, r2, r3\r
67         vmov    d8, r4, r5\r
68         vmov    d9, r6, r7\r
69         vmov    d10, r8, r9\r
70         vmov    d11, r10, r11\r
71         vmov    d12, r0, r1\r
72         vmov    d13, r2, r3\r
73         vmov    d14, r4, r5\r
74         vmov    d15, r6, r7\r
75 \r
76         /* Loop, checking each iteration that each register still contains the\r
77         expected value. */\r
78 reg1_loop:\r
79         /* Yield to increase test coverage */\r
80         svc 0\r
81 \r
82         /* Check all the VFP registers still contain the values set above.\r
83         First save registers that are clobbered by the test. */\r
84         push { r0-r1 }\r
85 \r
86         vmov    r0, r1, d0\r
87         cmp     r0, #0xFF\r
88         bne     reg1_error_loopf\r
89         cmp     r1, #0x11\r
90         bne     reg1_error_loopf\r
91         vmov    r0, r1, d1\r
92         cmp     r0, #0x22\r
93         bne     reg1_error_loopf\r
94         cmp     r1, #0x33\r
95         bne     reg1_error_loopf\r
96         vmov    r0, r1, d2\r
97         cmp     r0, #0x44\r
98         bne     reg1_error_loopf\r
99         cmp     r1, #0x55\r
100         bne     reg1_error_loopf\r
101         vmov    r0, r1, d3\r
102         cmp     r0, #0x66\r
103         bne     reg1_error_loopf\r
104         cmp     r1, #0x77\r
105         bne     reg1_error_loopf\r
106         vmov    r0, r1, d4\r
107         cmp     r0, #0x88\r
108         bne     reg1_error_loopf\r
109         cmp     r1, #0x99\r
110         bne     reg1_error_loopf\r
111         vmov    r0, r1, d5\r
112         cmp     r0, #0xAA\r
113         bne     reg1_error_loopf\r
114         cmp     r1, #0xBB\r
115         bne     reg1_error_loopf\r
116         vmov    r0, r1, d6\r
117         cmp     r0, #0xFF\r
118         bne     reg1_error_loopf\r
119         cmp     r1, #0x11\r
120         bne     reg1_error_loopf\r
121         vmov    r0, r1, d7\r
122         cmp     r0, #0x22\r
123         bne     reg1_error_loopf\r
124         cmp     r1, #0x33\r
125         bne     reg1_error_loopf\r
126         vmov    r0, r1, d8\r
127         cmp     r0, #0x44\r
128         bne     reg1_error_loopf\r
129         cmp     r1, #0x55\r
130         bne     reg1_error_loopf\r
131         vmov    r0, r1, d9\r
132         cmp     r0, #0x66\r
133         bne     reg1_error_loopf\r
134         cmp     r1, #0x77\r
135         bne     reg1_error_loopf\r
136         vmov    r0, r1, d10\r
137         cmp     r0, #0x88\r
138         bne     reg1_error_loopf\r
139         cmp     r1, #0x99\r
140         bne     reg1_error_loopf\r
141         vmov    r0, r1, d11\r
142         cmp     r0, #0xAA\r
143         bne     reg1_error_loopf\r
144         cmp     r1, #0xBB\r
145         bne     reg1_error_loopf\r
146         vmov    r0, r1, d12\r
147         cmp     r0, #0xFF\r
148         bne     reg1_error_loopf\r
149         cmp     r1, #0x11\r
150         bne     reg1_error_loopf\r
151         vmov    r0, r1, d13\r
152         cmp     r0, #0x22\r
153         bne     reg1_error_loopf\r
154         cmp     r1, #0x33\r
155         bne     reg1_error_loopf\r
156         vmov    r0, r1, d14\r
157         cmp     r0, #0x44\r
158         bne     reg1_error_loopf\r
159         cmp     r1, #0x55\r
160         bne     reg1_error_loopf\r
161         vmov    r0, r1, d15\r
162         cmp     r0, #0x66\r
163         bne     reg1_error_loopf\r
164         cmp     r1, #0x77\r
165         bne     reg1_error_loopf\r
166 \r
167 \r
168         /* Restore the registers that were clobbered by the test. */\r
169         pop     {r0-r1}\r
170 \r
171         /* VFP register test passed.  Jump to the core register test. */\r
172         b               reg1_loopf_pass\r
173 \r
174 reg1_error_loopf:\r
175         /* If this line is hit then a VFP register value was found to be\r
176         incorrect. */\r
177         b reg1_error_loopf\r
178 \r
179 reg1_loopf_pass:\r
180 \r
181         /* Test each general purpose register to check that it still contains the\r
182         expected known value, jumping to reg1_error_loop if any register contains\r
183         an unexpected value. */\r
184         cmp             r0, #0xFF\r
185         bne             reg1_error_loop\r
186         cmp             r1, #0x11\r
187         bne             reg1_error_loop\r
188         cmp             r2, #0x22\r
189         bne             reg1_error_loop\r
190         cmp             r3, #0x33\r
191         bne             reg1_error_loop\r
192         cmp             r4, #0x44\r
193         bne             reg1_error_loop\r
194         cmp             r5, #0x55\r
195         bne             reg1_error_loop\r
196         cmp             r6, #0x66\r
197         bne             reg1_error_loop\r
198         cmp             r7, #0x77\r
199         bne             reg1_error_loop\r
200         cmp             r8, #0x88\r
201         bne             reg1_error_loop\r
202         cmp             r9, #0x99\r
203         bne             reg1_error_loop\r
204         cmp             r10, #0xAA\r
205         bne             reg1_error_loop\r
206         cmp             r11, #0xBB\r
207         bne             reg1_error_loop\r
208         cmp             r12, #0xCC\r
209         bne             reg1_error_loop\r
210         cmp             r14, #0xEE\r
211         bne             reg1_error_loop\r
212 \r
213         /* Everything passed, increment the loop counter. */\r
214         push { r0-r1 }\r
215         ldr     r0, =ulRegTest1LoopCounter\r
216         ldr r1, [r0]\r
217         adds r1, r1, #1\r
218         str r1, [r0]\r
219         pop { r0-r1 }\r
220 \r
221         /* Start again. */\r
222         b reg1_loop\r
223 \r
224 reg1_error_loop:\r
225         /* If this line is hit then there was an error in a core register value.\r
226         The loop ensures the loop counter stops incrementing. */\r
227         b reg1_error_loop\r
228         nop\r
229 \r
230 /*-----------------------------------------------------------*/\r
231 \r
232 .type vRegTest2Implementation, %function\r
233 vRegTest2Implementation:\r
234 \r
235         /* Put a known value in each register. */\r
236         mov             r0,  #0xFF000000\r
237         mov             r1,  #0x11000000\r
238         mov             r2,  #0x22000000\r
239         mov             r3,  #0x33000000\r
240         mov     r4,  #0x44000000\r
241         mov     r5,  #0x55000000\r
242         mov     r6,  #0x66000000\r
243         mov     r7,  #0x77000000\r
244         mov     r8,  #0x88000000\r
245         mov     r9,  #0x99000000\r
246         mov     r10, #0xAA000000\r
247         mov     r11, #0xBB000000\r
248         mov     r12, #0xCC000000\r
249         mov     r14, #0xEE000000\r
250 \r
251         /* Likewise the floating point registers */\r
252         vmov    d0, r0, r1\r
253         vmov    d1, r2, r3\r
254         vmov    d2, r4, r5\r
255         vmov    d3, r6, r7\r
256         vmov    d4, r8, r9\r
257         vmov    d5, r10, r11\r
258         vmov    d6, r0, r1\r
259         vmov    d7, r2, r3\r
260         vmov    d8, r4, r5\r
261         vmov    d9, r6, r7\r
262         vmov    d10, r8, r9\r
263         vmov    d11, r10, r11\r
264         vmov    d12, r0, r1\r
265         vmov    d13, r2, r3\r
266         vmov    d14, r4, r5\r
267         vmov    d15, r6, r7\r
268 \r
269         /* Loop, checking each iteration that each register still contains the\r
270         expected value. */\r
271 reg2_loop:\r
272         /* Check all the VFP registers still contain the values set above.\r
273         First save registers that are clobbered by the test. */\r
274         push    { r0-r1 }\r
275 \r
276         vmov    r0, r1, d0\r
277         cmp     r0, #0xFF000000\r
278         bne     reg2_error_loopf\r
279         cmp     r1, #0x11000000\r
280         bne     reg2_error_loopf\r
281         vmov    r0, r1, d1\r
282         cmp     r0, #0x22000000\r
283         bne     reg2_error_loopf\r
284         cmp     r1, #0x33000000\r
285         bne     reg2_error_loopf\r
286         vmov    r0, r1, d2\r
287         cmp     r0, #0x44000000\r
288         bne     reg2_error_loopf\r
289         cmp     r1, #0x55000000\r
290         bne     reg2_error_loopf\r
291         vmov    r0, r1, d3\r
292         cmp     r0, #0x66000000\r
293         bne     reg2_error_loopf\r
294         cmp     r1, #0x77000000\r
295         bne     reg2_error_loopf\r
296         vmov    r0, r1, d4\r
297         cmp     r0, #0x88000000\r
298         bne     reg2_error_loopf\r
299         cmp     r1, #0x99000000\r
300         bne     reg2_error_loopf\r
301         vmov    r0, r1, d5\r
302         cmp     r0, #0xAA000000\r
303         bne     reg2_error_loopf\r
304         cmp     r1, #0xBB000000\r
305         bne     reg2_error_loopf\r
306         vmov    r0, r1, d6\r
307         cmp     r0, #0xFF000000\r
308         bne     reg2_error_loopf\r
309         cmp     r1, #0x11000000\r
310         bne     reg2_error_loopf\r
311         vmov    r0, r1, d7\r
312         cmp     r0, #0x22000000\r
313         bne     reg2_error_loopf\r
314         cmp     r1, #0x33000000\r
315         bne     reg2_error_loopf\r
316         vmov    r0, r1, d8\r
317         cmp     r0, #0x44000000\r
318         bne     reg2_error_loopf\r
319         cmp     r1, #0x55000000\r
320         bne     reg2_error_loopf\r
321         vmov    r0, r1, d9\r
322         cmp     r0, #0x66000000\r
323         bne     reg2_error_loopf\r
324         cmp     r1, #0x77000000\r
325         bne     reg2_error_loopf\r
326         vmov    r0, r1, d10\r
327         cmp     r0, #0x88000000\r
328         bne     reg2_error_loopf\r
329         cmp     r1, #0x99000000\r
330         bne     reg2_error_loopf\r
331         vmov    r0, r1, d11\r
332         cmp     r0, #0xAA000000\r
333         bne     reg2_error_loopf\r
334         cmp     r1, #0xBB000000\r
335         bne     reg2_error_loopf\r
336         vmov    r0, r1, d12\r
337         cmp     r0, #0xFF000000\r
338         bne     reg2_error_loopf\r
339         cmp     r1, #0x11000000\r
340         bne     reg2_error_loopf\r
341         vmov    r0, r1, d13\r
342         cmp     r0, #0x22000000\r
343         bne     reg2_error_loopf\r
344         cmp     r1, #0x33000000\r
345         bne     reg2_error_loopf\r
346         vmov    r0, r1, d14\r
347         cmp     r0, #0x44000000\r
348         bne     reg2_error_loopf\r
349         cmp     r1, #0x55000000\r
350         bne     reg2_error_loopf\r
351         vmov    r0, r1, d15\r
352         cmp     r0, #0x66000000\r
353         bne     reg2_error_loopf\r
354         cmp     r1, #0x77000000\r
355         bne     reg2_error_loopf\r
356 \r
357         /* Restore the registers that were clobbered by the test. */\r
358         pop     {r0-r1}\r
359 \r
360         /* VFP register test passed.  Jump to the core register test. */\r
361         b               reg2_loopf_pass\r
362 \r
363 reg2_error_loopf:\r
364         /* If this line is hit then a VFP register value was found to be\r
365         incorrect. */\r
366         b               reg2_error_loopf\r
367 \r
368 reg2_loopf_pass:\r
369 \r
370         cmp             r0, #0xFF000000\r
371         bne             reg2_error_loop\r
372         cmp             r1, #0x11000000\r
373         bne             reg2_error_loop\r
374         cmp             r2, #0x22000000\r
375         bne             reg2_error_loop\r
376         cmp             r3, #0x33000000\r
377         bne             reg2_error_loop\r
378         cmp             r4, #0x44000000\r
379         bne             reg2_error_loop\r
380         cmp             r5, #0x55000000\r
381         bne             reg2_error_loop\r
382         cmp             r6, #0x66000000\r
383         bne             reg2_error_loop\r
384         cmp             r7, #0x77000000\r
385         bne             reg2_error_loop\r
386         cmp             r8, #0x88000000\r
387         bne             reg2_error_loop\r
388         cmp             r9, #0x99000000\r
389         bne             reg2_error_loop\r
390         cmp             r10, #0xAA000000\r
391         bne             reg2_error_loop\r
392         cmp             r11, #0xBB000000\r
393         bne             reg2_error_loop\r
394         cmp             r12, #0xCC000000\r
395         bne             reg2_error_loop\r
396         cmp     r14, #0xEE000000\r
397         bne             reg2_error_loop\r
398 \r
399         /* Everything passed, increment the loop counter. */\r
400         push    { r0-r1 }\r
401         ldr             r0, =ulRegTest2LoopCounter\r
402         ldr     r1, [r0]\r
403         adds    r1, r1, #1\r
404         str     r1, [r0]\r
405         pop     { r0-r1 }\r
406 \r
407         /* Start again. */\r
408         b               reg2_loop\r
409 \r
410 reg2_error_loop:\r
411         /* If this line is hit then there was an error in a core register value.\r
412         The loop ensures the loop counter stops incrementing. */\r
413         b               reg2_error_loop\r
414         nop\r
415 \r
416 \r
417         .end\r
418 \r