]> git.sur5r.net Git - freertos/blob - FreeRTOS/Demo/CORTEX_M0_Infineon_XMC1000_IAR_Keil_GCC/IAR_Specific/RegTest_IAR.s
485c51ce20f6bdb040e435592de6c85642891bbf
[freertos] / FreeRTOS / Demo / CORTEX_M0_Infineon_XMC1000_IAR_Keil_GCC / IAR_Specific / RegTest_IAR.s
1 /*\r
2     FreeRTOS V9.0.0rc1 - Copyright (C) 2016 Real Time Engineers Ltd.\r
3     All rights reserved\r
4 \r
5     VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.\r
6 \r
7     This file is part of the FreeRTOS distribution.\r
8 \r
9     FreeRTOS is free software; you can redistribute it and/or modify it under\r
10     the terms of the GNU General Public License (version 2) as published by the\r
11     Free Software Foundation >>>> AND MODIFIED BY <<<< the FreeRTOS exception.\r
12 \r
13     ***************************************************************************\r
14     >>!   NOTE: The modification to the GPL is included to allow you to     !<<\r
15     >>!   distribute a combined work that includes FreeRTOS without being   !<<\r
16     >>!   obliged to provide the source code for proprietary components     !<<\r
17     >>!   outside of the FreeRTOS kernel.                                   !<<\r
18     ***************************************************************************\r
19 \r
20     FreeRTOS is distributed in the hope that it will be useful, but WITHOUT ANY\r
21     WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS\r
22     FOR A PARTICULAR PURPOSE.  Full license text is available on the following\r
23     link: http://www.freertos.org/a00114.html\r
24 \r
25     ***************************************************************************\r
26      *                                                                       *\r
27      *    FreeRTOS provides completely free yet professionally developed,    *\r
28      *    robust, strictly quality controlled, supported, and cross          *\r
29      *    platform software that is more than just the market leader, it     *\r
30      *    is the industry's de facto standard.                               *\r
31      *                                                                       *\r
32      *    Help yourself get started quickly while simultaneously helping     *\r
33      *    to support the FreeRTOS project by purchasing a FreeRTOS           *\r
34      *    tutorial book, reference manual, or both:                          *\r
35      *    http://www.FreeRTOS.org/Documentation                              *\r
36      *                                                                       *\r
37     ***************************************************************************\r
38 \r
39     http://www.FreeRTOS.org/FAQHelp.html - Having a problem?  Start by reading\r
40     the FAQ page "My application does not run, what could be wrong?".  Have you\r
41     defined configASSERT()?\r
42 \r
43     http://www.FreeRTOS.org/support - In return for receiving this top quality\r
44     embedded software for free we request you assist our global community by\r
45     participating in the support forum.\r
46 \r
47     http://www.FreeRTOS.org/training - Investing in training allows your team to\r
48     be as productive as possible as early as possible.  Now you can receive\r
49     FreeRTOS training directly from Richard Barry, CEO of Real Time Engineers\r
50     Ltd, and the world's leading authority on the world's leading RTOS.\r
51 \r
52     http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,\r
53     including FreeRTOS+Trace - an indispensable productivity tool, a DOS\r
54     compatible FAT file system, and our tiny thread aware UDP/IP stack.\r
55 \r
56     http://www.FreeRTOS.org/labs - Where new FreeRTOS products go to incubate.\r
57     Come and try FreeRTOS+TCP, our new open source TCP/IP stack for FreeRTOS.\r
58 \r
59     http://www.OpenRTOS.com - Real Time Engineers ltd. license FreeRTOS to High\r
60     Integrity Systems ltd. to sell under the OpenRTOS brand.  Low cost OpenRTOS\r
61     licenses offer ticketed support, indemnification and commercial middleware.\r
62 \r
63     http://www.SafeRTOS.com - High Integrity Systems also provide a safety\r
64     engineered and independently SIL3 certified version for use in safety and\r
65     mission critical applications that require provable dependability.\r
66 \r
67     1 tab == 4 spaces!\r
68 */\r
69 \r
70 /* \r
71  * "Reg test" tasks - These fill the registers with known values, then check\r
72  * that each register maintains its expected value for the lifetime of the\r
73  * task.  Each task uses a different set of values.  The reg test tasks execute\r
74  * with a very low priority, so get preempted very frequently.  A register\r
75  * containing an unexpected value is indicative of an error in the context\r
76  * switching mechanism.\r
77  */\r
78  \r
79         RSEG    CODE:CODE(2)\r
80         thumb\r
81 \r
82 \r
83         EXTERN ulRegTest1LoopCounter\r
84         EXTERN ulRegTest2LoopCounter\r
85 \r
86         PUBLIC vRegTest1Task\r
87         PUBLIC vRegTest2Task\r
88 \r
89 /*-----------------------------------------------------------*/\r
90 vRegTest1Task\r
91 \r
92         /* Fill the core registers with known values.  This is only done once. */\r
93         movs r1, #101\r
94         movs r2, #102\r
95         movs r3, #103\r
96         movs r4, #104\r
97         movs r5, #105\r
98         movs r6, #106\r
99         movs r7, #107\r
100         movs r0, #108\r
101         mov      r8, r0\r
102         movs r0, #109\r
103         mov  r9, r0\r
104         movs r0, #110\r
105         mov      r10, r0\r
106         movs r0, #111\r
107         mov      r11, r0\r
108         movs r0, #112\r
109         mov  r12, r0\r
110         movs r0, #100\r
111 \r
112 reg1_loop\r
113         /* Repeatedly check that each register still contains the value written to\r
114         it when the task started. */\r
115         cmp     r0, #100\r
116         bne     reg1_error_loop\r
117         cmp     r1, #101\r
118         bne     reg1_error_loop\r
119         cmp     r2, #102\r
120         bne     reg1_error_loop\r
121         cmp r3, #103\r
122         bne     reg1_error_loop\r
123         cmp     r4, #104\r
124         bne     reg1_error_loop\r
125         cmp     r5, #105\r
126         bne     reg1_error_loop\r
127         cmp     r6, #106\r
128         bne     reg1_error_loop\r
129         cmp     r7, #107\r
130         bne     reg1_error_loop\r
131         movs r0, #108\r
132         cmp     r8, r0\r
133         bne     reg1_error_loop\r
134         movs r0, #109\r
135         cmp     r9, r0\r
136         bne     reg1_error_loop\r
137         movs r0, #110\r
138         cmp     r10, r0\r
139         bne     reg1_error_loop\r
140         movs r0, #111\r
141         cmp     r11, r0\r
142         bne     reg1_error_loop\r
143         movs r0, #112\r
144         cmp     r12, r0\r
145         bne     reg1_error_loop\r
146 \r
147         /* Everything passed, increment the loop counter. */\r
148         push { r1 }\r
149         ldr     r0, =ulRegTest1LoopCounter\r
150         ldr r1, [r0]\r
151         adds r1, r1, #1\r
152         str r1, [r0]\r
153 \r
154         /* Yield to increase test coverage. */\r
155         movs r0, #0x01\r
156         ldr r1, =0xe000ed04 /* NVIC_INT_CTRL */\r
157         lsls r0 ,r0, #28 /* Shift to PendSV bit */\r
158         str r0, [r1]\r
159         dsb\r
160         pop { r1 }\r
161 \r
162         /* Start again. */\r
163         movs r0, #100\r
164         b reg1_loop\r
165 \r
166 reg1_error_loop\r
167         /* If this line is hit then there was an error in a core register value.\r
168         The loop ensures the loop counter stops incrementing. */\r
169         b reg1_error_loop\r
170         nop\r
171 \r
172 \r
173 \r
174 vRegTest2Task\r
175 \r
176         /* Fill the core registers with known values.  This is only done once. */\r
177         movs r1, #1\r
178         movs r2, #2\r
179         movs r3, #3\r
180         movs r4, #4\r
181         movs r5, #5\r
182         movs r6, #6\r
183         movs r7, #7\r
184         movs r0, #8\r
185         mov     r8, r0\r
186         movs r0, #9\r
187         mov r9, r0\r
188         movs r0, #10\r
189         mov     r10, r0\r
190         movs r0, #11\r
191         mov     r11, r0\r
192         movs r0, #12\r
193         mov r12, r0\r
194         movs r0, #10\r
195 \r
196 reg2_loop\r
197         /* Repeatedly check that each register still contains the value written to\r
198         it when the task started. */\r
199         cmp     r0, #10\r
200         bne     reg2_error_loop\r
201         cmp     r1, #1\r
202         bne     reg2_error_loop\r
203         cmp     r2, #2\r
204         bne     reg2_error_loop\r
205         cmp r3, #3\r
206         bne     reg2_error_loop\r
207         cmp     r4, #4\r
208         bne     reg2_error_loop\r
209         cmp     r5, #5\r
210         bne     reg2_error_loop\r
211         cmp     r6, #6\r
212         bne     reg2_error_loop\r
213         cmp     r7, #7\r
214         bne     reg2_error_loop\r
215         movs r0, #8\r
216         cmp     r8, r0\r
217         bne     reg2_error_loop\r
218         movs r0, #9\r
219         cmp     r9, r0\r
220         bne     reg2_error_loop\r
221         movs r0, #10\r
222         cmp     r10, r0\r
223         bne     reg2_error_loop\r
224         movs r0, #11\r
225         cmp     r11, r0\r
226         bne     reg2_error_loop\r
227         movs r0, #12\r
228         cmp     r12, r0\r
229         bne     reg2_error_loop\r
230 \r
231         /* Everything passed, increment the loop counter. */\r
232         push { r1 }\r
233         ldr     r0, =ulRegTest2LoopCounter\r
234         ldr r1, [r0]\r
235         adds r1, r1, #1\r
236         str r1, [r0]\r
237         pop { r1 }\r
238 \r
239         /* Start again. */\r
240         movs r0, #10\r
241         b reg2_loop\r
242 \r
243 reg2_error_loop\r
244         ;/* If this line is hit then there was an error in a core register value.\r
245         ;The loop ensures the loop counter stops incrementing. */\r
246         b reg2_error_loop\r
247         nop\r
248 \r
249         END\r