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