Skip to content

Latest commit

 

History

History
215 lines (215 loc) · 13.4 KB

serial.rst

File metadata and controls

215 lines (215 loc) · 13.4 KB
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:22 2019 5 ;-------------------------------------------------------- 6 .module serial 7 .optsdcc -mstm8 8 9 ;--------------------------------------------------------

10 ; Public variables in this module 11 ;-------------------------------------------------------- 12 .globl _main 13 .globl _printf 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

000001 26 __start__stack: 000001 27 .ds 1

28 29 ;-------------------------------------------------------- 30 ; absolute external ram data 31 ;-------------------------------------------------------- 32 .area DABS (ABS) 33 ;-------------------------------------------------------- 34 ; interrupt vector 35 ;-------------------------------------------------------- 36 .area HOME

008000 37 __interrupt_vect: 008000 82 00 80 83 38 int s_GSINIT ;reset 008004 82 00 00 00 39 int 0x0000 ;trap 008008 82 00 00 00 40 int 0x0000 ;int0 00800C 82 00 00 00 41 int 0x0000 ;int1 008010 82 00 00 00 42 int 0x0000 ;int2 008014 82 00 00 00 43 int 0x0000 ;int3 008018 82 00 00 00 44 int 0x0000 ;int4 00801C 82 00 00 00 45 int 0x0000 ;int5 008020 82 00 00 00 46 int 0x0000 ;int6 008024 82 00 00 00 47 int 0x0000 ;int7 008028 82 00 00 00 48 int 0x0000 ;int8 00802C 82 00 00 00 49 int 0x0000 ;int9 008030 82 00 00 00 50 int 0x0000 ;int10 008034 82 00 00 00 51 int 0x0000 ;int11 008038 82 00 00 00 52 int 0x0000 ;int12 00803C 82 00 00 00 53 int 0x0000 ;int13 008040 82 00 00 00 54 int 0x0000 ;int14 008044 82 00 00 00 55 int 0x0000 ;int15 008048 82 00 00 00 56 int 0x0000 ;int16 00804C 82 00 00 00 57 int 0x0000 ;int17 008050 82 00 00 00 58 int 0x0000 ;int18 008054 82 00 00 00 59 int 0x0000 ;int19 008058 82 00 00 00 60 int 0x0000 ;int20 00805C 82 00 00 00 61 int 0x0000 ;int21 008060 82 00 00 00 62 int 0x0000 ;int22 008064 82 00 00 00 63 int 0x0000 ;int23 008068 82 00 00 00 64 int 0x0000 ;int24 00806C 82 00 00 00 65 int 0x0000 ;int25 008070 82 00 00 00 66 int 0x0000 ;int26 008074 82 00 00 00 67 int 0x0000 ;int27 008078 82 00 00 00 68 int 0x0000 ;int28 00807C 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

008083 77 __sdcc_gs_init_startup: 008083 78 __sdcc_init_data:

79 ; stm8_genXINIT() start

008083 AE 00 00 [ 2] 80 ldw x, #l_DATA 008086 27 07 [ 1] 81 jreq 00002$ 008088 82 00001$: 008088 72 4F 00 00 [ 1] 83 clr (s_DATA - 1, x) 00808C 5A [ 2] 84 decw x 00808D 26 F9 [ 1] 85 jrne 00001$ 00808F 86 00002$: 00808F AE 00 00 [ 2] 87 ldw x, #l_INITIALIZER 008092 27 09 [ 1] 88 jreq 00004$ 008094 89 00003$: 008094 D6 88 3F [ 1] 90 ld a, (s_INITIALIZER - 1, x) 008097 D7 00 00 [ 1] 91 ld (s_INITIALIZED - 1, x), a 00809A 5A [ 2] 92 decw x 00809B 26 F7 [ 1] 93 jrne 00003$ 00809D 94 00004$:

95 ; stm8_genXINIT() end 96 .area GSFINAL
00809D CC 80 80 [ 2] 97 jp __sdcc_program_startup
98 ;-------------------------------------------------------- 99 ; Home

100 ;-------------------------------------------------------- 101 .area HOME 102 .area HOME

008080 103 __sdcc_program_startup: 008080 CC 80 A0 [ 2] 104 jp _main

105 ; return from main will return to caller 106 ;-------------------------------------------------------- 107 ; code 108 ;-------------------------------------------------------- 109 .area CODE 110 ; serial.c: 30: void main(void) 111 ; genLabel 112 ; ----------------------------------------- 113 ; function main 114 ; ----------------------------------------- 115 ; Register assignment might be sub-optimal. 116 ; Stack space usage: 8 bytes.

0080A0 117 _main: 0080A0 52 08 [ 2] 118 sub sp, #8

119 ; serial.c: 34: CLK_DIVR = 0x00; // Set the frequency to 16 MHz 120 ; genPointerSet
0080A2 35 00 50 C0 [ 1] 121 mov 0x50c0+0, #0x00
122 ; serial.c: 35: CLK_PCKENR1 = 0xFF; // Enable peripherals 123 ; genPointerSet
0080A6 35 FF 50 C3 [ 1] 124 mov 0x50c3+0, #0xff
125 ; serial.c: 37: PC_DDR = 0x08; // Put TX line on 126 ; genPointerSet
0080AA 35 08 50 0C [ 1] 127 mov 0x500c+0, #0x08
128 ; serial.c: 38: PC_CR1 = 0x08; 129 ; genPointerSet
0080AE 35 08 50 0D [ 1] 130 mov 0x500d+0, #0x08
131 ; serial.c: 40: USART1_CR2 = USART_CR2_TEN; // Allow TX and RX 132 ; genPointerSet
0080B2 35 08 52 35 [ 1] 133 mov 0x5235+0, #0x08
134 ; serial.c: 41: USART1_CR3 &= ~(USART_CR3_STOP1 | USART_CR3_STOP2); // 1 stop bit 135 ; genPointerGet 136 ; genCast 137 ; genAssign 138 ; genAnd 139 ; genPointerSet

0080B6 AE 52 36 [ 2] 140 ldw x, #0x5236 0080B9 F6 [ 1] 141 ld a, (x) 0080BA A4 CF [ 1] 142 and a, #0xcf

143 ; peephole 10 removed redundant load of #0x5236 into x
0080BC F7 [ 1] 144 ld (x), a
145 ; serial.c: 42: USART1_BRR2 = 0x03; USART1_BRR1 = 0x68; // 9600 baud 146 ; genPointerSet
0080BD 35 03 52 33 [ 1] 147 mov 0x5233+0, #0x03
148 ; genPointerSet
0080C1 35 68 52 32 [ 1] 149 mov 0x5232+0, #0x68
150 ; genLabel
0080C5 151 00106$:
152 ; serial.c: 46: printf("Hello World!n"); 153 ; genAddrOf
0080C5 AE 80 FB [ 2] 154 ldw x, #___str_0+0
155 ; genCast 156 ; genAssign 157 ; genIPush
0080C8 89 [ 2] 158 pushw x
159 ; genCall

0080C9 CD 81 23 [ 4] 160 call _printf 0080CC 5B 02 [ 2] 161 addw sp, #2

162 ; serial.c: 47: for(i = 0; i < 147456; i++); // Sleep 163 ; genAssign

0080CE AE 40 00 [ 2] 164 ldw x, #0x4000 0080D1 1F 03 [ 2] 165 ldw (0x03, sp), x 0080D3 A6 02 [ 1] 166 ld a, #0x02 0080D5 0F 01 [ 1] 167 clr (0x01, sp)

168 ; genLabel
0080D7 169 00105$:
170 ; genMinus

0080D7 1E 03 [ 2] 171 ldw x, (0x03, sp) 0080D9 1D 00 01 [ 2] 172 subw x, #0x0001 0080DC 1F 07 [ 2] 173 ldw (0x07, sp), x 0080DE A2 00 [ 1] 174 sbc a, #0x00 0080E0 97 [ 1] 175 ld xl, a 0080E1 7B 01 [ 1] 176 ld a, (0x01, sp) 0080E3 A2 00 [ 1] 177 sbc a, #0x00 0080E5 95 [ 1] 178 ld xh, a

179 ; genAssign

0080E6 02 [ 1] 180 rlwa x 0080E7 6B 01 [ 1] 181 ld (0x01, sp), a 0080E9 01 [ 1] 182 rrwa x 0080EA 16 07 [ 2] 183 ldw y, (0x07, sp) 0080EC 17 03 [ 2] 184 ldw (0x03, sp), y 0080EE 9F [ 1] 185 ld a, xl

186 ; genIfx

0080EF 16 07 [ 2] 187 ldw y, (0x07, sp) 0080F1 26 E4 [ 1] 188 jrne 00105$

189 ; peephole j22 jumped to 00105$ directly instead of via 00122$.

0080F3 5D [ 2] 190 tnzw x 0080F4 27 CF [ 1] 191 jreq 00106$

192 ; peephole j19 jumped to 00106$ directly instead of via 00123$. 193 ; peephole j30 removed unused label 00122$. 194 ; peephole j5 changed absolute to relative unconditional jump. 195 ; peephole j30 removed unused label 00123$. 196 ; genGoto
0080F6 20 DF [ 2] 197 jra 00105$
198 ; peephole j2d removed unreachable jump to 00106$. 199 ; peephole j5 changed absolute to relative unconditional jump. 200 ; genLabel 201 ; peephole j30 removed unused label 00108$. 202 ; genEndFunction
0080F8 5B 08 [ 2] 203 addw sp, #8
00005A 204 C$serial.c$49$1$13 ==. 00005A 205 XG$main$0$0 ==.
0080FA 81 [ 4] 206 ret
207 .area CODE

00005B 208 Fserial$__str_0$0$0 == .

0080FB 209 ___str_0: 0080FB 48 65 6C 6C 6F 20 57 210 .ascii "Hello World!"

6F 72 6C 64 21

008107 0A 211 .db 0x0A 008108 00 212 .db 0x00

213 .area INITIALIZER 214 .area CABS (ABS)