]> git.sur5r.net Git - freertos/blob - FreeRTOS/Demo/CORTEX_R4F_RZ_T_GCC_IAR_ARM/src/Full_Demo/reg_test_GCC.S
Baseline new GCC and Renesas compiler projects for RX71M and RX113 before adding...
[freertos] / FreeRTOS / Demo / CORTEX_R4F_RZ_T_GCC_IAR_ARM / src / Full_Demo / reg_test_GCC.S
1 /*\r
2     FreeRTOS V8.2.2 - Copyright (C) 2014 Real Time Engineers Ltd.\r
3 \r
4     FEATURES AND PORTS ARE ADDED TO FREERTOS ALL THE TIME.  PLEASE VISIT\r
5     http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.\r
6 \r
7     ***************************************************************************\r
8      *                                                                       *\r
9      *    FreeRTOS tutorial books are available in pdf and paperback.        *\r
10      *    Complete, revised, and edited pdf reference manuals are also       *\r
11      *    available.                                                         *\r
12      *                                                                       *\r
13      *    Purchasing FreeRTOS documentation will not only help you, by       *\r
14      *    ensuring you get running as quickly as possible and with an        *\r
15      *    in-depth knowledge of how to use FreeRTOS, it will also help       *\r
16      *    the FreeRTOS project to continue with its mission of providing     *\r
17      *    professional grade, cross platform, de facto standard solutions    *\r
18      *    for microcontrollers - completely free of charge!                  *\r
19      *                                                                       *\r
20      *    >>> See http://www.FreeRTOS.org/Documentation for details. <<<     *\r
21      *                                                                       *\r
22      *    Thank you for using FreeRTOS, and thank you for your support!      *\r
23      *                                                                       *\r
24     ***************************************************************************\r
25 \r
26 \r
27     This file is part of the FreeRTOS distribution.\r
28 \r
29     FreeRTOS is free software; you can redistribute it and/or modify it under\r
30     the terms of the GNU General Public License (version 2) as published by the\r
31     Free Software Foundation AND MODIFIED BY the FreeRTOS exception.\r
32 \r
33     >>>>>>NOTE<<<<<< The modification to the GPL is included to allow you to\r
34     distribute a combined work that includes FreeRTOS without being obliged to\r
35     provide the source code for proprietary components outside of the FreeRTOS\r
36     kernel.\r
37 \r
38     FreeRTOS is distributed in the hope that it will be useful, but WITHOUT ANY\r
39     WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS\r
40     FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more\r
41     details. You should have received a copy of the GNU General Public License\r
42     and the FreeRTOS license exception along with FreeRTOS; if not itcan be\r
43     viewed here: http://www.freertos.org/a00114.html and also obtained by\r
44     writing to Real Time Engineers Ltd., contact details for whom are available\r
45     on the FreeRTOS WEB site.\r
46 \r
47     1 tab == 4 spaces!\r
48 \r
49     ***************************************************************************\r
50      *                                                                       *\r
51      *    Having a problem?  Start by reading the FAQ "My application does   *\r
52      *    not run, what could be wrong?"                                     *\r
53      *                                                                       *\r
54      *    http://www.FreeRTOS.org/FAQHelp.html                               *\r
55      *                                                                       *\r
56     ***************************************************************************\r
57 \r
58 \r
59     http://www.FreeRTOS.org - Documentation, books, training, latest versions,\r
60     license and Real Time Engineers Ltd. contact details.\r
61 \r
62     http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,\r
63     including FreeRTOS+Trace - an indispensable productivity tool, and our new\r
64     fully thread aware and reentrant UDP/IP stack.\r
65 \r
66     http://www.OpenRTOS.com - Real Time Engineers ltd license FreeRTOS to High\r
67     Integrity Systems, who sell the code with commercial support,\r
68     indemnification and middleware, under the OpenRTOS brand.\r
69 \r
70     http://www.SafeRTOS.com - High Integrity Systems also provide a safety\r
71     engineered and independently SIL3 certified version for use in safety and\r
72     mission critical applications that require provable dependability.\r
73 */\r
74 \r
75         .global vRegTest1Implementation\r
76         .global vRegTest2Implementation\r
77         .extern ulRegTest1LoopCounter\r
78         .extern ulRegTest2LoopCounter\r
79 \r
80         .text\r
81         .arm\r
82 \r
83         /* This function is explained in the comments at the top of main-full.c. */\r
84 .type vRegTest1Implementation, %function\r
85 vRegTest1Implementation:\r
86 \r
87         /* Fill each general purpose register with a known value. */\r
88         mov             r0,  #0xFF\r
89         mov             r1,  #0x11\r
90         mov             r2,  #0x22\r
91         mov             r3,  #0x33\r
92         mov     r4,  #0x44\r
93         mov     r5,  #0x55\r
94         mov     r6,  #0x66\r
95         mov     r7,  #0x77\r
96         mov     r8,  #0x88\r
97         mov     r9,  #0x99\r
98         mov     r10, #0xAA\r
99         mov     r11, #0xBB\r
100         mov     r12, #0xCC\r
101         mov             r14, #0xEE\r
102 \r
103 \r
104         /* Fill each FPU register with a known value. */\r
105         vmov    d0, r0, r1\r
106         vmov    d1, r2, r3\r
107         vmov    d2, r4, r5\r
108         vmov    d3, r6, r7\r
109         vmov    d4, r8, r9\r
110         vmov    d5, r10, r11\r
111         vmov    d6, r0, r1\r
112         vmov    d7, r2, r3\r
113         vmov    d8, r4, r5\r
114         vmov    d9, r6, r7\r
115         vmov    d10, r8, r9\r
116         vmov    d11, r10, r11\r
117         vmov    d12, r0, r1\r
118         vmov    d13, r2, r3\r
119         vmov    d14, r4, r5\r
120         vmov    d15, r6, r7\r
121 \r
122         /* Loop, checking each itteration that each register still contains the\r
123         expected value. */\r
124 reg1_loop:\r
125         /* Yield to increase test coverage */\r
126         svc 0\r
127 \r
128         /* Check all the VFP registers still contain the values set above.\r
129         First save registers that are clobbered by the test. */\r
130         push { r0-r1 }\r
131 \r
132         vmov    r0, r1, d0\r
133         cmp     r0, #0xFF\r
134         bne     reg1_error_loopf\r
135         cmp     r1, #0x11\r
136         bne     reg1_error_loopf\r
137         vmov    r0, r1, d1\r
138         cmp     r0, #0x22\r
139         bne     reg1_error_loopf\r
140         cmp     r1, #0x33\r
141         bne     reg1_error_loopf\r
142         vmov    r0, r1, d2\r
143         cmp     r0, #0x44\r
144         bne     reg1_error_loopf\r
145         cmp     r1, #0x55\r
146         bne     reg1_error_loopf\r
147         vmov    r0, r1, d3\r
148         cmp     r0, #0x66\r
149         bne     reg1_error_loopf\r
150         cmp     r1, #0x77\r
151         bne     reg1_error_loopf\r
152         vmov    r0, r1, d4\r
153         cmp     r0, #0x88\r
154         bne     reg1_error_loopf\r
155         cmp     r1, #0x99\r
156         bne     reg1_error_loopf\r
157         vmov    r0, r1, d5\r
158         cmp     r0, #0xAA\r
159         bne     reg1_error_loopf\r
160         cmp     r1, #0xBB\r
161         bne     reg1_error_loopf\r
162         vmov    r0, r1, d6\r
163         cmp     r0, #0xFF\r
164         bne     reg1_error_loopf\r
165         cmp     r1, #0x11\r
166         bne     reg1_error_loopf\r
167         vmov    r0, r1, d7\r
168         cmp     r0, #0x22\r
169         bne     reg1_error_loopf\r
170         cmp     r1, #0x33\r
171         bne     reg1_error_loopf\r
172         vmov    r0, r1, d8\r
173         cmp     r0, #0x44\r
174         bne     reg1_error_loopf\r
175         cmp     r1, #0x55\r
176         bne     reg1_error_loopf\r
177         vmov    r0, r1, d9\r
178         cmp     r0, #0x66\r
179         bne     reg1_error_loopf\r
180         cmp     r1, #0x77\r
181         bne     reg1_error_loopf\r
182         vmov    r0, r1, d10\r
183         cmp     r0, #0x88\r
184         bne     reg1_error_loopf\r
185         cmp     r1, #0x99\r
186         bne     reg1_error_loopf\r
187         vmov    r0, r1, d11\r
188         cmp     r0, #0xAA\r
189         bne     reg1_error_loopf\r
190         cmp     r1, #0xBB\r
191         bne     reg1_error_loopf\r
192         vmov    r0, r1, d12\r
193         cmp     r0, #0xFF\r
194         bne     reg1_error_loopf\r
195         cmp     r1, #0x11\r
196         bne     reg1_error_loopf\r
197         vmov    r0, r1, d13\r
198         cmp     r0, #0x22\r
199         bne     reg1_error_loopf\r
200         cmp     r1, #0x33\r
201         bne     reg1_error_loopf\r
202         vmov    r0, r1, d14\r
203         cmp     r0, #0x44\r
204         bne     reg1_error_loopf\r
205         cmp     r1, #0x55\r
206         bne     reg1_error_loopf\r
207         vmov    r0, r1, d15\r
208         cmp     r0, #0x66\r
209         bne     reg1_error_loopf\r
210         cmp     r1, #0x77\r
211         bne     reg1_error_loopf\r
212 \r
213 \r
214         /* Restore the registers that were clobbered by the test. */\r
215         pop     {r0-r1}\r
216 \r
217         /* VFP register test passed.  Jump to the core register test. */\r
218         b               reg1_loopf_pass\r
219 \r
220 reg1_error_loopf:\r
221         /* If this line is hit then a VFP register value was found to be\r
222         incorrect. */\r
223         b reg1_error_loopf\r
224 \r
225 reg1_loopf_pass:\r
226 \r
227         /* Test each general purpose register to check that it still contains the\r
228         expected known value, jumping to reg1_error_loop if any register contains\r
229         an unexpected value. */\r
230         cmp             r0, #0xFF\r
231         bne             reg1_error_loop\r
232         cmp             r1, #0x11\r
233         bne             reg1_error_loop\r
234         cmp             r2, #0x22\r
235         bne             reg1_error_loop\r
236         cmp             r3, #0x33\r
237         bne             reg1_error_loop\r
238         cmp             r4, #0x44\r
239         bne             reg1_error_loop\r
240         cmp             r5, #0x55\r
241         bne             reg1_error_loop\r
242         cmp             r6, #0x66\r
243         bne             reg1_error_loop\r
244         cmp             r7, #0x77\r
245         bne             reg1_error_loop\r
246         cmp             r8, #0x88\r
247         bne             reg1_error_loop\r
248         cmp             r9, #0x99\r
249         bne             reg1_error_loop\r
250         cmp             r10, #0xAA\r
251         bne             reg1_error_loop\r
252         cmp             r11, #0xBB\r
253         bne             reg1_error_loop\r
254         cmp             r12, #0xCC\r
255         bne             reg1_error_loop\r
256         cmp             r14, #0xEE\r
257         bne             reg1_error_loop\r
258 \r
259         /* Everything passed, increment the loop counter. */\r
260         push { r0-r1 }\r
261         ldr     r0, =ulRegTest1LoopCounter\r
262         ldr r1, [r0]\r
263         adds r1, r1, #1\r
264         str r1, [r0]\r
265         pop { r0-r1 }\r
266 \r
267         /* Start again. */\r
268         b reg1_loop\r
269 \r
270 reg1_error_loop:\r
271         /* If this line is hit then there was an error in a core register value.\r
272         The loop ensures the loop counter stops incrementing. */\r
273         b reg1_error_loop\r
274         nop\r
275 \r
276 /*-----------------------------------------------------------*/\r
277 \r
278 .type vRegTest2Implementation, %function\r
279 vRegTest2Implementation:\r
280 \r
281         /* Put a known value in each register. */\r
282         mov             r0,  #0xFF000000\r
283         mov             r1,  #0x11000000\r
284         mov             r2,  #0x22000000\r
285         mov             r3,  #0x33000000\r
286         mov     r4,  #0x44000000\r
287         mov     r5,  #0x55000000\r
288         mov     r6,  #0x66000000\r
289         mov     r7,  #0x77000000\r
290         mov     r8,  #0x88000000\r
291         mov     r9,  #0x99000000\r
292         mov     r10, #0xAA000000\r
293         mov     r11, #0xBB000000\r
294         mov     r12, #0xCC000000\r
295         mov     r14, #0xEE000000\r
296 \r
297         /* Likewise the floating point registers */\r
298         vmov    d0, r0, r1\r
299         vmov    d1, r2, r3\r
300         vmov    d2, r4, r5\r
301         vmov    d3, r6, r7\r
302         vmov    d4, r8, r9\r
303         vmov    d5, r10, r11\r
304         vmov    d6, r0, r1\r
305         vmov    d7, r2, r3\r
306         vmov    d8, r4, r5\r
307         vmov    d9, r6, r7\r
308         vmov    d10, r8, r9\r
309         vmov    d11, r10, r11\r
310         vmov    d12, r0, r1\r
311         vmov    d13, r2, r3\r
312         vmov    d14, r4, r5\r
313         vmov    d15, r6, r7\r
314 \r
315         /* Loop, checking each itteration that each register still contains the\r
316         expected value. */\r
317 reg2_loop:\r
318         /* Check all the VFP registers still contain the values set above.\r
319         First save registers that are clobbered by the test. */\r
320         push    { r0-r1 }\r
321 \r
322         vmov    r0, r1, d0\r
323         cmp     r0, #0xFF000000\r
324         bne     reg2_error_loopf\r
325         cmp     r1, #0x11000000\r
326         bne     reg2_error_loopf\r
327         vmov    r0, r1, d1\r
328         cmp     r0, #0x22000000\r
329         bne     reg2_error_loopf\r
330         cmp     r1, #0x33000000\r
331         bne     reg2_error_loopf\r
332         vmov    r0, r1, d2\r
333         cmp     r0, #0x44000000\r
334         bne     reg2_error_loopf\r
335         cmp     r1, #0x55000000\r
336         bne     reg2_error_loopf\r
337         vmov    r0, r1, d3\r
338         cmp     r0, #0x66000000\r
339         bne     reg2_error_loopf\r
340         cmp     r1, #0x77000000\r
341         bne     reg2_error_loopf\r
342         vmov    r0, r1, d4\r
343         cmp     r0, #0x88000000\r
344         bne     reg2_error_loopf\r
345         cmp     r1, #0x99000000\r
346         bne     reg2_error_loopf\r
347         vmov    r0, r1, d5\r
348         cmp     r0, #0xAA000000\r
349         bne     reg2_error_loopf\r
350         cmp     r1, #0xBB000000\r
351         bne     reg2_error_loopf\r
352         vmov    r0, r1, d6\r
353         cmp     r0, #0xFF000000\r
354         bne     reg2_error_loopf\r
355         cmp     r1, #0x11000000\r
356         bne     reg2_error_loopf\r
357         vmov    r0, r1, d7\r
358         cmp     r0, #0x22000000\r
359         bne     reg2_error_loopf\r
360         cmp     r1, #0x33000000\r
361         bne     reg2_error_loopf\r
362         vmov    r0, r1, d8\r
363         cmp     r0, #0x44000000\r
364         bne     reg2_error_loopf\r
365         cmp     r1, #0x55000000\r
366         bne     reg2_error_loopf\r
367         vmov    r0, r1, d9\r
368         cmp     r0, #0x66000000\r
369         bne     reg2_error_loopf\r
370         cmp     r1, #0x77000000\r
371         bne     reg2_error_loopf\r
372         vmov    r0, r1, d10\r
373         cmp     r0, #0x88000000\r
374         bne     reg2_error_loopf\r
375         cmp     r1, #0x99000000\r
376         bne     reg2_error_loopf\r
377         vmov    r0, r1, d11\r
378         cmp     r0, #0xAA000000\r
379         bne     reg2_error_loopf\r
380         cmp     r1, #0xBB000000\r
381         bne     reg2_error_loopf\r
382         vmov    r0, r1, d12\r
383         cmp     r0, #0xFF000000\r
384         bne     reg2_error_loopf\r
385         cmp     r1, #0x11000000\r
386         bne     reg2_error_loopf\r
387         vmov    r0, r1, d13\r
388         cmp     r0, #0x22000000\r
389         bne     reg2_error_loopf\r
390         cmp     r1, #0x33000000\r
391         bne     reg2_error_loopf\r
392         vmov    r0, r1, d14\r
393         cmp     r0, #0x44000000\r
394         bne     reg2_error_loopf\r
395         cmp     r1, #0x55000000\r
396         bne     reg2_error_loopf\r
397         vmov    r0, r1, d15\r
398         cmp     r0, #0x66000000\r
399         bne     reg2_error_loopf\r
400         cmp     r1, #0x77000000\r
401         bne     reg2_error_loopf\r
402 \r
403         /* Restore the registers that were clobbered by the test. */\r
404         pop     {r0-r1}\r
405 \r
406         /* VFP register test passed.  Jump to the core register test. */\r
407         b               reg2_loopf_pass\r
408 \r
409 reg2_error_loopf:\r
410         /* If this line is hit then a VFP register value was found to be\r
411         incorrect. */\r
412         b               reg2_error_loopf\r
413 \r
414 reg2_loopf_pass:\r
415 \r
416         cmp             r0, #0xFF000000\r
417         bne             reg2_error_loop\r
418         cmp             r1, #0x11000000\r
419         bne             reg2_error_loop\r
420         cmp             r2, #0x22000000\r
421         bne             reg2_error_loop\r
422         cmp             r3, #0x33000000\r
423         bne             reg2_error_loop\r
424         cmp             r4, #0x44000000\r
425         bne             reg2_error_loop\r
426         cmp             r5, #0x55000000\r
427         bne             reg2_error_loop\r
428         cmp             r6, #0x66000000\r
429         bne             reg2_error_loop\r
430         cmp             r7, #0x77000000\r
431         bne             reg2_error_loop\r
432         cmp             r8, #0x88000000\r
433         bne             reg2_error_loop\r
434         cmp             r9, #0x99000000\r
435         bne             reg2_error_loop\r
436         cmp             r10, #0xAA000000\r
437         bne             reg2_error_loop\r
438         cmp             r11, #0xBB000000\r
439         bne             reg2_error_loop\r
440         cmp             r12, #0xCC000000\r
441         bne             reg2_error_loop\r
442         cmp     r14, #0xEE000000\r
443         bne             reg2_error_loop\r
444 \r
445         /* Everything passed, increment the loop counter. */\r
446         push    { r0-r1 }\r
447         ldr             r0, =ulRegTest2LoopCounter\r
448         ldr     r1, [r0]\r
449         adds    r1, r1, #1\r
450         str     r1, [r0]\r
451         pop     { r0-r1 }\r
452 \r
453         /* Start again. */\r
454         b               reg2_loop\r
455 \r
456 reg2_error_loop:\r
457         /* If this line is hit then there was an error in a core register value.\r
458         The loop ensures the loop counter stops incrementing. */\r
459         b               reg2_error_loop\r
460         nop\r
461 \r
462 \r
463         .end\r
464 \r