]> begriffs open source - cmsis-freertos/blob - Demo/RX100_RX113-RSK_GCC_e2studio_IAR/src/Full_Demo/RegTest_GCC.S
Update README.md - branch main is now the base branch
[cmsis-freertos] / Demo / RX100_RX113-RSK_GCC_e2studio_IAR / src / Full_Demo / RegTest_GCC.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         .global _vRegTest1Implementation
29         .global _vRegTest2Implementation
30
31         .extern _ulRegTest1LoopCounter
32         .extern _ulRegTest2LoopCounter
33
34         .text
35
36
37 ;/* This function is explained in the comments at the top of main.c. */
38 _vRegTest1Implementation:
39
40         ; Put a known value in each register.
41         MOV.L   #1, R1
42         MOV.L   #2, R2
43         MOV.L   #3, R3
44         MOV.L   #4, R4
45         MOV.L   #5, R5
46         MOV.L   #6, R6
47         MOV.L   #7, R7
48         MOV.L   #8, R8
49         MOV.L   #9, R9
50         MOV.L   #10, R10
51         MOV.L   #11, R11
52         MOV.L   #12, R12
53         MOV.L   #13, R13
54         MOV.L   #14, R14
55         MOV.L   #15, R15
56
57         ; Loop, checking each iteration that each register still contains the
58         ; expected value.
59 TestLoop1:
60
61         ; Push the registers that are going to get clobbered.
62         PUSHM   R14-R15
63
64         ; Increment the loop counter to show this task is still getting CPU time.
65         MOV.L   #_ulRegTest1LoopCounter, R14
66         MOV.L   [ R14 ], R15
67         ADD             #1, R15
68         MOV.L   R15, [ R14 ]
69
70         ; Yield to extend the text coverage.  Set the bit in the ITU SWINTR register.
71         MOV.L   #1, R14
72         MOV.L   #0872E0H, R15
73         MOV.B   R14, [R15]
74         NOP
75         NOP
76
77         ; Restore the clobbered registers.
78         POPM    R14-R15
79
80         ; Now compare each register to ensure it still contains the value that was
81         ; set before this loop was entered.
82         CMP             #1, R1
83         BNE             RegTest1Error
84         CMP             #2, R2
85         BNE             RegTest1Error
86         CMP             #3, R3
87         BNE             RegTest1Error
88         CMP             #4, R4
89         BNE             RegTest1Error
90         CMP             #5, R5
91         BNE             RegTest1Error
92         CMP             #6, R6
93         BNE             RegTest1Error
94         CMP             #7, R7
95         BNE             RegTest1Error
96         CMP             #8, R8
97         BNE             RegTest1Error
98         CMP             #9, R9
99         BNE             RegTest1Error
100         CMP             #10, R10
101         BNE             RegTest1Error
102         CMP             #11, R11
103         BNE             RegTest1Error
104         CMP             #12, R12
105         BNE             RegTest1Error
106         CMP             #13, R13
107         BNE             RegTest1Error
108         CMP             #14, R14
109         BNE             RegTest1Error
110         CMP             #15, R15
111         BNE             RegTest1Error
112
113         ; All comparisons passed, start a new itteratio of this loop.
114         BRA             TestLoop1
115
116 RegTest1Error:
117         ; A compare failed, just loop here so the loop counter stops incrementing
118         ; causing the check task to indicate the error.
119         BRA RegTest1Error
120 ;/*-----------------------------------------------------------*/
121
122 ;/* This function is explained in the comments at the top of main.c. */
123 _vRegTest2Implementation:
124
125         ; Put a known value in each register.
126         MOV.L   #10, R1
127         MOV.L   #20, R2
128         MOV.L   #30, R3
129         MOV.L   #40, R4
130         MOV.L   #50, R5
131         MOV.L   #60, R6
132         MOV.L   #70, R7
133         MOV.L   #80, R8
134         MOV.L   #90, R9
135         MOV.L   #100, R10
136         MOV.L   #110, R11
137         MOV.L   #120, R12
138         MOV.L   #130, R13
139         MOV.L   #140, R14
140         MOV.L   #150, R15
141
142         ; Loop, checking on each iteration that each register still contains the
143         ; expected value.
144 TestLoop2:
145
146         ; Push the registers that are going to get clobbered.
147         PUSHM   R14-R15
148
149         ; Increment the loop counter to show this task is still getting CPU time.
150         MOV.L   #_ulRegTest2LoopCounter, R14
151         MOV.L   [ R14 ], R15
152         ADD             #1, R15
153         MOV.L   R15, [ R14 ]
154
155         ; Restore the clobbered registers.
156         POPM    R14-R15
157
158         CMP             #10, R1
159         BNE             RegTest2Error
160         CMP             #20, R2
161         BNE             RegTest2Error
162         CMP             #30, R3
163         BNE             RegTest2Error
164         CMP             #40, R4
165         BNE             RegTest2Error
166         CMP             #50, R5
167         BNE             RegTest2Error
168         CMP             #60, R6
169         BNE             RegTest2Error
170         CMP             #70, R7
171         BNE             RegTest2Error
172         CMP             #80, R8
173         BNE             RegTest2Error
174         CMP             #90, R9
175         BNE             RegTest2Error
176         CMP             #100, R10
177         BNE             RegTest2Error
178         CMP             #110, R11
179         BNE             RegTest2Error
180         CMP             #120, R12
181         BNE             RegTest2Error
182         CMP             #130, R13
183         BNE             RegTest2Error
184         CMP             #140, R14
185         BNE             RegTest2Error
186         CMP             #150, R15
187         BNE             RegTest2Error
188
189         ; All comparisons passed, start a new itteratio of this loop.
190         BRA             TestLoop2
191
192 RegTest2Error:
193         ; A compare failed, just loop here so the loop counter stops incrementing
194         ; - causing the check task to indicate the error.
195         BRA RegTest2Error
196
197         .END