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