]> git.sur5r.net Git - freertos/blob - FreeRTOS/Demo/CORTEX_M0+_LPC51U68_LPCXpresso/IAR_specific/RegTest_IAR.s
Remove build files accidentally checked in.
[freertos] / FreeRTOS / Demo / CORTEX_M0+_LPC51U68_LPCXpresso / IAR_specific / RegTest_IAR.s
1 /*\r
2  * FreeRTOS Kernel V10.2.1\r
3  * Copyright (C) 2019 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.\r
14  *\r
15  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r
16  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\r
17  * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\r
18  * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\r
19  * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
20  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r
21  *\r
22  * http://www.FreeRTOS.org\r
23  * http://aws.amazon.com/freertos\r
24  *\r
25  * 1 tab == 4 spaces!\r
26  */\r
27 \r
28 /* \r
29  * "Reg test" tasks - These fill the registers with known values, then check\r
30  * that each register maintains its expected value for the lifetime of the\r
31  * task.  Each task uses a different set of values.  The reg test tasks execute\r
32  * with a very low priority, so get preempted very frequently.  A register\r
33  * containing an unexpected value is indicative of an error in the context\r
34  * switching mechanism.\r
35  */\r
36  \r
37         RSEG    CODE:CODE(2)\r
38         thumb\r
39 \r
40 \r
41         EXTERN ulRegTest1LoopCounter\r
42         EXTERN ulRegTest2LoopCounter\r
43 \r
44         PUBLIC vRegTest1Task\r
45         PUBLIC vRegTest2Task\r
46 \r
47 /*-----------------------------------------------------------*/\r
48 vRegTest1Task\r
49 \r
50         /* Fill the core registers with known values.  This is only done once. */\r
51         movs r1, #101\r
52         movs r2, #102\r
53         movs r3, #103\r
54         movs r4, #104\r
55         movs r5, #105\r
56         movs r6, #106\r
57         movs r7, #107\r
58         movs r0, #108\r
59         mov      r8, r0\r
60         movs r0, #109\r
61         mov  r9, r0\r
62         movs r0, #110\r
63         mov      r10, r0\r
64         movs r0, #111\r
65         mov      r11, r0\r
66         movs r0, #112\r
67         mov  r12, r0\r
68         movs r0, #100\r
69 \r
70 reg1_loop\r
71         /* Repeatedly check that each register still contains the value written to\r
72         it when the task started. */\r
73         cmp     r0, #100\r
74         bne     reg1_error_loop\r
75         cmp     r1, #101\r
76         bne     reg1_error_loop\r
77         cmp     r2, #102\r
78         bne     reg1_error_loop\r
79         cmp r3, #103\r
80         bne     reg1_error_loop\r
81         cmp     r4, #104\r
82         bne     reg1_error_loop\r
83         cmp     r5, #105\r
84         bne     reg1_error_loop\r
85         cmp     r6, #106\r
86         bne     reg1_error_loop\r
87         cmp     r7, #107\r
88         bne     reg1_error_loop\r
89         movs r0, #108\r
90         cmp     r8, r0\r
91         bne     reg1_error_loop\r
92         movs r0, #109\r
93         cmp     r9, r0\r
94         bne     reg1_error_loop\r
95         movs r0, #110\r
96         cmp     r10, r0\r
97         bne     reg1_error_loop\r
98         movs r0, #111\r
99         cmp     r11, r0\r
100         bne     reg1_error_loop\r
101         movs r0, #112\r
102         cmp     r12, r0\r
103         bne     reg1_error_loop\r
104 \r
105         /* Everything passed, increment the loop counter. */\r
106         push { r1 }\r
107         ldr     r0, =ulRegTest1LoopCounter\r
108         ldr r1, [r0]\r
109         adds r1, r1, #1\r
110         str r1, [r0]\r
111 \r
112         /* Yield to increase test coverage. */\r
113         movs r0, #0x01\r
114         ldr r1, =0xe000ed04 /* NVIC_INT_CTRL */\r
115         lsls r0 ,r0, #28 /* Shift to PendSV bit */\r
116         str r0, [r1]\r
117         dsb\r
118         pop { r1 }\r
119 \r
120         /* Start again. */\r
121         movs r0, #100\r
122         b reg1_loop\r
123 \r
124 reg1_error_loop\r
125         /* If this line is hit then there was an error in a core register value.\r
126         The loop ensures the loop counter stops incrementing. */\r
127         b reg1_error_loop\r
128         nop\r
129 \r
130 \r
131 \r
132 vRegTest2Task\r
133 \r
134         /* Fill the core registers with known values.  This is only done once. */\r
135         movs r1, #1\r
136         movs r2, #2\r
137         movs r3, #3\r
138         movs r4, #4\r
139         movs r5, #5\r
140         movs r6, #6\r
141         movs r7, #7\r
142         movs r0, #8\r
143         mov     r8, r0\r
144         movs r0, #9\r
145         mov r9, r0\r
146         movs r0, #10\r
147         mov     r10, r0\r
148         movs r0, #11\r
149         mov     r11, r0\r
150         movs r0, #12\r
151         mov r12, r0\r
152         movs r0, #10\r
153 \r
154 reg2_loop\r
155         /* Repeatedly check that each register still contains the value written to\r
156         it when the task started. */\r
157         cmp     r0, #10\r
158         bne     reg2_error_loop\r
159         cmp     r1, #1\r
160         bne     reg2_error_loop\r
161         cmp     r2, #2\r
162         bne     reg2_error_loop\r
163         cmp r3, #3\r
164         bne     reg2_error_loop\r
165         cmp     r4, #4\r
166         bne     reg2_error_loop\r
167         cmp     r5, #5\r
168         bne     reg2_error_loop\r
169         cmp     r6, #6\r
170         bne     reg2_error_loop\r
171         cmp     r7, #7\r
172         bne     reg2_error_loop\r
173         movs r0, #8\r
174         cmp     r8, r0\r
175         bne     reg2_error_loop\r
176         movs r0, #9\r
177         cmp     r9, r0\r
178         bne     reg2_error_loop\r
179         movs r0, #10\r
180         cmp     r10, r0\r
181         bne     reg2_error_loop\r
182         movs r0, #11\r
183         cmp     r11, r0\r
184         bne     reg2_error_loop\r
185         movs r0, #12\r
186         cmp     r12, r0\r
187         bne     reg2_error_loop\r
188 \r
189         /* Everything passed, increment the loop counter. */\r
190         push { r1 }\r
191         ldr     r0, =ulRegTest2LoopCounter\r
192         ldr r1, [r0]\r
193         adds r1, r1, #1\r
194         str r1, [r0]\r
195         pop { r1 }\r
196 \r
197         /* Start again. */\r
198         movs r0, #10\r
199         b reg2_loop\r
200 \r
201 reg2_error_loop\r
202         ;/* If this line is hit then there was an error in a core register value.\r
203         ;The loop ensures the loop counter stops incrementing. */\r
204         b reg2_error_loop\r
205         nop\r
206 \r
207         END\r