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