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