]> begriffs open source - cmsis-freertos/blob - Demo/CORTEX_M0_STM32F0518_IAR/RegTest.s
Update README.md - branch main is now the base branch
[cmsis-freertos] / Demo / CORTEX_M0_STM32F0518_IAR / RegTest.s
1 /*
2  * FreeRTOS V202111.00
3  * Copyright (C) 2020 Amazon.com, Inc. or its affiliates.  All Rights Reserved.
4  *
5  * Permission is hereby granted, free of charge, to any person obtaining a copy of
6  * this software and associated documentation files (the "Software"), to deal in
7  * the Software without restriction, including without limitation the rights to
8  * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9  * the Software, and to permit persons to whom the Software is furnished to do so,
10  * subject to the following conditions:
11  *
12  * The above copyright notice and this permission notice shall be included in all
13  * copies or substantial portions of the Software.
14  *
15  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17  * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18  * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19  * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21  *
22  * http://www.FreeRTOS.org
23  * http://aws.amazon.com/freertos
24  *
25  * 1 tab == 4 spaces!
26  */
27
28         RSEG    CODE:CODE(2)
29         thumb
30
31         EXTERN ulRegTest1LoopCounter
32         EXTERN ulRegTest2LoopCounter
33
34         PUBLIC vRegTest1Task
35         PUBLIC vRegTest2Task
36
37 /*-----------------------------------------------------------*/
38 vRegTest1Task
39
40         /* Fill the core registers with known values.  This is only done once. */
41         movs r1, #101
42         movs r2, #102
43         movs r3, #103
44         movs r4, #104
45         movs r5, #105
46         movs r6, #106
47         movs r7, #107
48         movs r0, #108
49         mov      r8, r0
50         movs r0, #109
51         mov  r9, r0
52         movs r0, #110
53         mov      r10, r0
54         movs r0, #111
55         mov      r11, r0
56         movs r0, #112
57         mov  r12, r0
58         movs r0, #100
59
60 reg1_loop
61         /* Repeatedly check that each register still contains the value written to
62         it when the task started. */
63         cmp     r0, #100
64         bne     reg1_error_loop
65         cmp     r1, #101
66         bne     reg1_error_loop
67         cmp     r2, #102
68         bne     reg1_error_loop
69         cmp r3, #103
70         bne     reg1_error_loop
71         cmp     r4, #104
72         bne     reg1_error_loop
73         cmp     r5, #105
74         bne     reg1_error_loop
75         cmp     r6, #106
76         bne     reg1_error_loop
77         cmp     r7, #107
78         bne     reg1_error_loop
79         movs r0, #108
80         cmp     r8, r0
81         bne     reg1_error_loop
82         movs r0, #109
83         cmp     r9, r0
84         bne     reg1_error_loop
85         movs r0, #110
86         cmp     r10, r0
87         bne     reg1_error_loop
88         movs r0, #111
89         cmp     r11, r0
90         bne     reg1_error_loop
91         movs r0, #112
92         cmp     r12, r0
93         bne     reg1_error_loop
94
95         /* Everything passed, increment the loop counter. */
96         push { r1 }
97         ldr     r0, =ulRegTest1LoopCounter
98         ldr r1, [r0]
99         adds r1, r1, #1
100         str r1, [r0]
101         pop { r1 }
102
103         /* Start again. */
104         movs r0, #100
105         b reg1_loop
106
107 reg1_error_loop
108         /* If this line is hit then there was an error in a core register value.
109         The loop ensures the loop counter stops incrementing. */
110         b reg1_error_loop
111         nop
112
113
114
115 vRegTest2Task
116
117         /* Fill the core registers with known values.  This is only done once. */
118         movs r1, #1
119         movs r2, #2
120         movs r3, #3
121         movs r4, #4
122         movs r5, #5
123         movs r6, #6
124         movs r7, #7
125         movs r0, #8
126         mov     r8, r0
127         movs r0, #9
128         mov r9, r0
129         movs r0, #10
130         mov     r10, r0
131         movs r0, #11
132         mov     r11, r0
133         movs r0, #12
134         mov r12, r0
135         movs r0, #10
136
137 reg2_loop
138         /* Repeatedly check that each register still contains the value written to
139         it when the task started. */
140         cmp     r0, #10
141         bne     reg2_error_loop
142         cmp     r1, #1
143         bne     reg2_error_loop
144         cmp     r2, #2
145         bne     reg2_error_loop
146         cmp r3, #3
147         bne     reg2_error_loop
148         cmp     r4, #4
149         bne     reg2_error_loop
150         cmp     r5, #5
151         bne     reg2_error_loop
152         cmp     r6, #6
153         bne     reg2_error_loop
154         cmp     r7, #7
155         bne     reg2_error_loop
156         movs r0, #8
157         cmp     r8, r0
158         bne     reg2_error_loop
159         movs r0, #9
160         cmp     r9, r0
161         bne     reg2_error_loop
162         movs r0, #10
163         cmp     r10, r0
164         bne     reg2_error_loop
165         movs r0, #11
166         cmp     r11, r0
167         bne     reg2_error_loop
168         movs r0, #12
169         cmp     r12, r0
170         bne     reg2_error_loop
171
172         /* Everything passed, increment the loop counter. */
173         push { r1 }
174         ldr     r0, =ulRegTest2LoopCounter
175         ldr r1, [r0]
176         adds r1, r1, #1
177         str r1, [r0]
178         pop { r1 }
179
180         /* Start again. */
181         movs r0, #10
182         b reg2_loop
183
184 reg2_error_loop
185         /* If this line is hit then there was an error in a core register value.
186         The loop ensures the loop counter stops incrementing. */
187         b reg2_error_loop
188         nop
189
190         END