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