]> begriffs open source - cmsis-freertos/blob - Demo/CORTEX_M0_STM32F0518_IAR/RegTest.s
Update cmsis_os2.c
[cmsis-freertos] / Demo / CORTEX_M0_STM32F0518_IAR / 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         RSEG    CODE:CODE(2)
71         thumb
72
73         EXTERN ulRegTest1LoopCounter
74         EXTERN ulRegTest2LoopCounter
75
76         PUBLIC vRegTest1Task
77         PUBLIC vRegTest2Task
78
79 /*-----------------------------------------------------------*/
80 vRegTest1Task
81
82         /* Fill the core registers with known values.  This is only done once. */
83         movs r1, #101
84         movs r2, #102
85         movs r3, #103
86         movs r4, #104
87         movs r5, #105
88         movs r6, #106
89         movs r7, #107
90         movs r0, #108
91         mov      r8, r0
92         movs r0, #109
93         mov  r9, r0
94         movs r0, #110
95         mov      r10, r0
96         movs r0, #111
97         mov      r11, r0
98         movs r0, #112
99         mov  r12, r0
100         movs r0, #100
101
102 reg1_loop
103         /* Repeatedly check that each register still contains the value written to
104         it when the task started. */
105         cmp     r0, #100
106         bne     reg1_error_loop
107         cmp     r1, #101
108         bne     reg1_error_loop
109         cmp     r2, #102
110         bne     reg1_error_loop
111         cmp r3, #103
112         bne     reg1_error_loop
113         cmp     r4, #104
114         bne     reg1_error_loop
115         cmp     r5, #105
116         bne     reg1_error_loop
117         cmp     r6, #106
118         bne     reg1_error_loop
119         cmp     r7, #107
120         bne     reg1_error_loop
121         movs r0, #108
122         cmp     r8, r0
123         bne     reg1_error_loop
124         movs r0, #109
125         cmp     r9, r0
126         bne     reg1_error_loop
127         movs r0, #110
128         cmp     r10, r0
129         bne     reg1_error_loop
130         movs r0, #111
131         cmp     r11, r0
132         bne     reg1_error_loop
133         movs r0, #112
134         cmp     r12, r0
135         bne     reg1_error_loop
136
137         /* Everything passed, increment the loop counter. */
138         push { r1 }
139         ldr     r0, =ulRegTest1LoopCounter
140         ldr r1, [r0]
141         adds r1, r1, #1
142         str r1, [r0]
143         pop { r1 }
144
145         /* Start again. */
146         movs r0, #100
147         b reg1_loop
148
149 reg1_error_loop
150         /* If this line is hit then there was an error in a core register value.
151         The loop ensures the loop counter stops incrementing. */
152         b reg1_error_loop
153         nop
154
155
156
157 vRegTest2Task
158
159         /* Fill the core registers with known values.  This is only done once. */
160         movs r1, #1
161         movs r2, #2
162         movs r3, #3
163         movs r4, #4
164         movs r5, #5
165         movs r6, #6
166         movs r7, #7
167         movs r0, #8
168         mov     r8, r0
169         movs r0, #9
170         mov r9, r0
171         movs r0, #10
172         mov     r10, r0
173         movs r0, #11
174         mov     r11, r0
175         movs r0, #12
176         mov r12, r0
177         movs r0, #10
178
179 reg2_loop
180         /* Repeatedly check that each register still contains the value written to
181         it when the task started. */
182         cmp     r0, #10
183         bne     reg2_error_loop
184         cmp     r1, #1
185         bne     reg2_error_loop
186         cmp     r2, #2
187         bne     reg2_error_loop
188         cmp r3, #3
189         bne     reg2_error_loop
190         cmp     r4, #4
191         bne     reg2_error_loop
192         cmp     r5, #5
193         bne     reg2_error_loop
194         cmp     r6, #6
195         bne     reg2_error_loop
196         cmp     r7, #7
197         bne     reg2_error_loop
198         movs r0, #8
199         cmp     r8, r0
200         bne     reg2_error_loop
201         movs r0, #9
202         cmp     r9, r0
203         bne     reg2_error_loop
204         movs r0, #10
205         cmp     r10, r0
206         bne     reg2_error_loop
207         movs r0, #11
208         cmp     r11, r0
209         bne     reg2_error_loop
210         movs r0, #12
211         cmp     r12, r0
212         bne     reg2_error_loop
213
214         /* Everything passed, increment the loop counter. */
215         push { r1 }
216         ldr     r0, =ulRegTest2LoopCounter
217         ldr r1, [r0]
218         adds r1, r1, #1
219         str r1, [r0]
220         pop { r1 }
221
222         /* Start again. */
223         movs r0, #10
224         b reg2_loop
225
226 reg2_error_loop
227         /* If this line is hit then there was an error in a core register value.
228         The loop ensures the loop counter stops incrementing. */
229         b reg2_error_loop
230         nop
231
232         END