-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathled.lst
More file actions
214 lines (214 loc) · 13.3 KB
/
led.lst
File metadata and controls
214 lines (214 loc) · 13.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
1 ;--------------------------------------------------------
2 ; File Created by SDCC : free open source ANSI-C Compiler
3 ; Version 3.5.0 #9253 (Mar 24 2016) (Linux)
4 ; This file was generated Fri Mar 29 15:47:21 2019
5 ;--------------------------------------------------------
6 .module led
7 .optsdcc -mstm8
8
9 ;--------------------------------------------------------
10 ; Public variables in this module
11 ;--------------------------------------------------------
12 .globl _main
13 .globl _clock
14 ;--------------------------------------------------------
15 ; ram data
16 ;--------------------------------------------------------
17 .area DATA
18 ;--------------------------------------------------------
19 ; ram data
20 ;--------------------------------------------------------
21 .area INITIALIZED
22 ;--------------------------------------------------------
23 ; Stack segment in internal ram
24 ;--------------------------------------------------------
25 .area SSEG
000000 26 __start__stack:
000000 27 .ds 1
28
29 ;--------------------------------------------------------
30 ; absolute external ram data
31 ;--------------------------------------------------------
32 .area DABS (ABS)
33 ;--------------------------------------------------------
34 ; interrupt vector
35 ;--------------------------------------------------------
36 .area HOME
000000 37 __interrupt_vect:
000000 82v00u00u00 38 int s_GSINIT ;reset
000004 82 00 00 00 39 int 0x0000 ;trap
000008 82 00 00 00 40 int 0x0000 ;int0
00000C 82 00 00 00 41 int 0x0000 ;int1
000010 82 00 00 00 42 int 0x0000 ;int2
000014 82 00 00 00 43 int 0x0000 ;int3
000018 82 00 00 00 44 int 0x0000 ;int4
00001C 82 00 00 00 45 int 0x0000 ;int5
000020 82 00 00 00 46 int 0x0000 ;int6
000024 82 00 00 00 47 int 0x0000 ;int7
000028 82 00 00 00 48 int 0x0000 ;int8
00002C 82 00 00 00 49 int 0x0000 ;int9
000030 82 00 00 00 50 int 0x0000 ;int10
000034 82 00 00 00 51 int 0x0000 ;int11
000038 82 00 00 00 52 int 0x0000 ;int12
00003C 82 00 00 00 53 int 0x0000 ;int13
000040 82 00 00 00 54 int 0x0000 ;int14
000044 82 00 00 00 55 int 0x0000 ;int15
000048 82 00 00 00 56 int 0x0000 ;int16
00004C 82 00 00 00 57 int 0x0000 ;int17
000050 82 00 00 00 58 int 0x0000 ;int18
000054 82 00 00 00 59 int 0x0000 ;int19
000058 82 00 00 00 60 int 0x0000 ;int20
00005C 82 00 00 00 61 int 0x0000 ;int21
000060 82 00 00 00 62 int 0x0000 ;int22
000064 82 00 00 00 63 int 0x0000 ;int23
000068 82 00 00 00 64 int 0x0000 ;int24
00006C 82 00 00 00 65 int 0x0000 ;int25
000070 82 00 00 00 66 int 0x0000 ;int26
000074 82 00 00 00 67 int 0x0000 ;int27
000078 82 00 00 00 68 int 0x0000 ;int28
00007C 82 00 00 00 69 int 0x0000 ;int29
70 ;--------------------------------------------------------
71 ; global & static initialisations
72 ;--------------------------------------------------------
73 .area HOME
74 .area GSINIT
75 .area GSFINAL
76 .area GSINIT
000000 77 __sdcc_gs_init_startup:
000000 78 __sdcc_init_data:
79 ; stm8_genXINIT() start
000000 AEr00r00 [ 2] 80 ldw x, #l_DATA
000003 27 07 [ 1] 81 jreq 00002$
000005 82 00001$:
000005 72 4FuFFuFF [ 1] 83 clr (s_DATA - 1, x)
000009 5A [ 2] 84 decw x
00000A 26 F9 [ 1] 85 jrne 00001$
00000C 86 00002$:
00000C AEr00r00 [ 2] 87 ldw x, #l_INITIALIZER
00000F 27 09 [ 1] 88 jreq 00004$
000011 89 00003$:
000011 D6uFFuFF [ 1] 90 ld a, (s_INITIALIZER - 1, x)
000014 D7uFFuFF [ 1] 91 ld (s_INITIALIZED - 1, x), a
000017 5A [ 2] 92 decw x
000018 26 F7 [ 1] 93 jrne 00003$
00001A 94 00004$:
95 ; stm8_genXINIT() end
96 .area GSFINAL
000000 CCr00r80 [ 2] 97 jp __sdcc_program_startup
98 ;--------------------------------------------------------
99 ; Home
100 ;--------------------------------------------------------
101 .area HOME
102 .area HOME
000080 103 __sdcc_program_startup:
000080 CCr00r1D [ 2] 104 jp _main
105 ; return from main will return to caller
106 ;--------------------------------------------------------
107 ; code
108 ;--------------------------------------------------------
109 .area CODE
110 ; led.c: 19: clock (void)
111 ; genLabel
112 ; -----------------------------------------
113 ; function clock
114 ; -----------------------------------------
115 ; Register assignment might be sub-optimal.
116 ; Stack space usage: 6 bytes.
000000 117 _clock:
000000 52 06 [ 2] 118 sub sp, #6
119 ; led.c: 21: unsigned char h = TIM1_CNTRH;
120 ; genPointerGet
000002 AE 52 5E [ 2] 121 ldw x, #0x525e
000005 F6 [ 1] 122 ld a, (x)
000006 90 95 [ 1] 123 ld yh, a
124 ; genAssign
125 ; led.c: 22: unsigned char l = TIM1_CNTRL;
126 ; genPointerGet
000008 AE 52 5F [ 2] 127 ldw x, #0x525f
00000B F6 [ 1] 128 ld a, (x)
129 ; genAssign
130 ; led.c: 23: return ((unsigned int) (h) << 8 | l);
131 ; genCast
132 ; genAssign
00000C 0F 01 [ 1] 133 clr (0x01, sp)
134 ; genLeftShiftLiteral
00000E 0F 06 [ 1] 135 clr (0x06, sp)
136 ; genCast
137 ; genAssign
000010 0F 03 [ 1] 138 clr (0x03, sp)
139 ; genOr
000012 1A 06 [ 1] 140 or a, (0x06, sp)
000014 97 [ 1] 141 ld xl, a
000015 90 9E [ 1] 142 ld a, yh
000017 1A 03 [ 1] 143 or a, (0x03, sp)
000019 95 [ 1] 144 ld xh, a
145 ; genReturn
146 ; genLabel
147 ; peephole j30 removed unused label 00101$.
148 ; genEndFunction
00001A 5B 06 [ 2] 149 addw sp, #6
00001C 150 C$led.c$24$1$2 ==.
00001C 151 XG$clock$0$0 ==.
00001C 81 [ 4] 152 ret
153 ; led.c: 27: main (void)
154 ; genLabel
155 ; -----------------------------------------
156 ; function main
157 ; -----------------------------------------
158 ; Register assignment might be sub-optimal.
159 ; Stack space usage: 0 bytes.
00001D 160 _main:
161 ; led.c: 29: CLK_DIVR = 0x00; // Set the frequency to 16 MHz
162 ; genPointerSet
00001D 35 00 50 C6 [ 1] 163 mov 0x50c6+0, #0x00
164 ; led.c: 33: TIM1_PSCRH = 0x3e;
165 ; genPointerSet
000021 35 3E 52 60 [ 1] 166 mov 0x5260+0, #0x3e
167 ; led.c: 34: TIM1_PSCRL = 0x80;
168 ; genPointerSet
000025 35 80 52 61 [ 1] 169 mov 0x5261+0, #0x80
170 ; led.c: 36: TIM1_CR1 = 0x01;
171 ; genPointerSet
000029 35 01 52 50 [ 1] 172 mov 0x5250+0, #0x01
173 ; led.c: 38: PD_DDR = 0x01;
174 ; genPointerSet
00002D 35 01 50 11 [ 1] 175 mov 0x5011+0, #0x01
176 ; led.c: 39: PD_CR1 = 0x01; // which register is this
177 ; genPointerSet
000031 35 01 50 12 [ 1] 178 mov 0x5012+0, #0x01
179 ; genLabel
000035 180 00102$:
181 ; led.c: 44: PD_ODR = 0x2 |clock () % 1000 < 100; // was PD_ODR = clock () % 1000 < 500;
182 ; genCall
000035 CDr00r00 [ 4] 183 call _clock
184 ; genDivMod
000038 90 AE 03 E8 [ 2] 185 ldw y, #0x03e8
00003C 65 [ 2] 186 divw x, y
187 ; genCmp
188 ; genCmpTop
00003D 90 A3 00 64 [ 2] 189 cpw y, #0x0064
000041 25 03 [ 1] 190 jrc 00110$
000043 4F [ 1] 191 clr a
000044 20 02 [ 2] 192 jra 00111$
193 ; peephole j5 changed absolute to relative unconditional jump.
000046 194 00110$:
000046 A6 01 [ 1] 195 ld a, #0x01
000048 196 00111$:
197 ; genOr
000048 AA 02 [ 1] 198 or a, #0x02
199 ; genPointerSet
00004A AE 50 0F [ 2] 200 ldw x, #0x500f
00004D F7 [ 1] 201 ld (x), a
202 ; genGoto
00004E 20 E5 [ 2] 203 jra 00102$
204 ; peephole j5 changed absolute to relative unconditional jump.
205 ; led.c: 45: PD_ODR = PD_ODR | 0x2; // set same value on another pin
206 ; genLabel
207 ; peephole j30 removed unused label 00104$.
208 ; genEndFunction
000050 209 C$led.c$47$1$4 ==.
000050 210 XG$main$0$0 ==.
000050 81 [ 4] 211 ret
212 .area CODE
213 .area INITIALIZER
214 .area CABS (ABS)