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