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