-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.lss
203 lines (183 loc) · 7.2 KB
/
main.lss
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
main.elf: file format elf32-avr
Sections:
Idx Name Size VMA LMA File off Algn
0 .data 00000006 00800100 0000010c 00000180 2**0
CONTENTS, ALLOC, LOAD, DATA
1 .text 0000010c 00000000 00000000 00000074 2**1
CONTENTS, ALLOC, LOAD, READONLY, CODE
2 .comment 00000011 00000000 00000000 00000186 2**0
CONTENTS, READONLY
3 .note.gnu.avr.deviceinfo 00000040 00000000 00000000 00000198 2**2
CONTENTS, READONLY
4 .debug_aranges 00000068 00000000 00000000 000001d8 2**3
CONTENTS, READONLY, DEBUGGING
5 .debug_info 00000937 00000000 00000000 00000240 2**0
CONTENTS, READONLY, DEBUGGING
6 .debug_abbrev 00000742 00000000 00000000 00000b77 2**0
CONTENTS, READONLY, DEBUGGING
7 .debug_line 00000281 00000000 00000000 000012b9 2**0
CONTENTS, READONLY, DEBUGGING
8 .debug_frame 00000070 00000000 00000000 0000153c 2**2
CONTENTS, READONLY, DEBUGGING
9 .debug_str 00000363 00000000 00000000 000015ac 2**0
CONTENTS, READONLY, DEBUGGING
10 .debug_loc 00000074 00000000 00000000 0000190f 2**0
CONTENTS, READONLY, DEBUGGING
11 .debug_ranges 00000018 00000000 00000000 00001983 2**0
CONTENTS, READONLY, DEBUGGING
Disassembly of section .text:
00000000 <__vectors>:
0: 0c 94 34 00 jmp 0x68 ; 0x68 <__ctors_end>
4: 0c 94 49 00 jmp 0x92 ; 0x92 <__bad_interrupt>
8: 0c 94 49 00 jmp 0x92 ; 0x92 <__bad_interrupt>
c: 0c 94 49 00 jmp 0x92 ; 0x92 <__bad_interrupt>
10: 0c 94 49 00 jmp 0x92 ; 0x92 <__bad_interrupt>
14: 0c 94 49 00 jmp 0x92 ; 0x92 <__bad_interrupt>
18: 0c 94 49 00 jmp 0x92 ; 0x92 <__bad_interrupt>
1c: 0c 94 49 00 jmp 0x92 ; 0x92 <__bad_interrupt>
20: 0c 94 49 00 jmp 0x92 ; 0x92 <__bad_interrupt>
24: 0c 94 49 00 jmp 0x92 ; 0x92 <__bad_interrupt>
28: 0c 94 49 00 jmp 0x92 ; 0x92 <__bad_interrupt>
2c: 0c 94 49 00 jmp 0x92 ; 0x92 <__bad_interrupt>
30: 0c 94 49 00 jmp 0x92 ; 0x92 <__bad_interrupt>
34: 0c 94 49 00 jmp 0x92 ; 0x92 <__bad_interrupt>
38: 0c 94 49 00 jmp 0x92 ; 0x92 <__bad_interrupt>
3c: 0c 94 49 00 jmp 0x92 ; 0x92 <__bad_interrupt>
40: 0c 94 49 00 jmp 0x92 ; 0x92 <__bad_interrupt>
44: 0c 94 49 00 jmp 0x92 ; 0x92 <__bad_interrupt>
48: 0c 94 49 00 jmp 0x92 ; 0x92 <__bad_interrupt>
4c: 0c 94 49 00 jmp 0x92 ; 0x92 <__bad_interrupt>
50: 0c 94 49 00 jmp 0x92 ; 0x92 <__bad_interrupt>
54: 0c 94 49 00 jmp 0x92 ; 0x92 <__bad_interrupt>
58: 0c 94 49 00 jmp 0x92 ; 0x92 <__bad_interrupt>
5c: 0c 94 49 00 jmp 0x92 ; 0x92 <__bad_interrupt>
60: 0c 94 49 00 jmp 0x92 ; 0x92 <__bad_interrupt>
64: 0c 94 49 00 jmp 0x92 ; 0x92 <__bad_interrupt>
00000068 <__ctors_end>:
68: 11 24 eor r1, r1
6a: 1f be out 0x3f, r1 ; 63
6c: cf ef ldi r28, 0xFF ; 255
6e: d8 e0 ldi r29, 0x08 ; 8
70: de bf out 0x3e, r29 ; 62
72: cd bf out 0x3d, r28 ; 61
00000074 <__do_copy_data>:
74: 11 e0 ldi r17, 0x01 ; 1
76: a0 e0 ldi r26, 0x00 ; 0
78: b1 e0 ldi r27, 0x01 ; 1
7a: ec e0 ldi r30, 0x0C ; 12
7c: f1 e0 ldi r31, 0x01 ; 1
7e: 02 c0 rjmp .+4 ; 0x84 <__do_copy_data+0x10>
80: 05 90 lpm r0, Z+
82: 0d 92 st X+, r0
84: a6 30 cpi r26, 0x06 ; 6
86: b1 07 cpc r27, r17
88: d9 f7 brne .-10 ; 0x80 <__do_copy_data+0xc>
8a: 0e 94 74 00 call 0xe8 ; 0xe8 <main>
8e: 0c 94 84 00 jmp 0x108 ; 0x108 <_exit>
00000092 <__bad_interrupt>:
92: 0c 94 00 00 jmp 0 ; 0x0 <__vectors>
00000096 <Init_Uart>:
void Init_Uart()
{
// setting the baud rate based on the datasheet
#define UART_BAUD 102
UBRR0H = (unsigned char)(UART_BAUD >> 8); // 0x00 // TODO: change it to value
96: 10 92 c5 00 sts 0x00C5, r1 ; 0x8000c5 <__DATA_REGION_ORIGIN__+0x65>
UBRR0L = (unsigned char)UART_BAUD; // 0x0C
9a: 86 e6 ldi r24, 0x66 ; 102
9c: 80 93 c4 00 sts 0x00C4, r24 ; 0x8000c4 <__DATA_REGION_ORIGIN__+0x64>
// enabling TX & RX
UCSR0B = (1 << TXEN0) | (1 << RXEN0);
a0: 88 e1 ldi r24, 0x18 ; 24
a2: 80 93 c1 00 sts 0x00C1, r24 ; 0x8000c1 <__DATA_REGION_ORIGIN__+0x61>
UCSR0A = (1 << UDRE0);
a6: 80 e2 ldi r24, 0x20 ; 32
a8: 80 93 c0 00 sts 0x00C0, r24 ; 0x8000c0 <__DATA_REGION_ORIGIN__+0x60>
UCSR0C = (1 << UCSZ01) | (1 << UCSZ00); // Set frame: 8data, 1 stop
ac: 86 e0 ldi r24, 0x06 ; 6
ae: 80 93 c2 00 sts 0x00C2, r24 ; 0x8000c2 <__DATA_REGION_ORIGIN__+0x62>
}
b2: 08 95 ret
000000b4 <Uart_Receive>:
uint8_t Uart_Receive(void)
{
/* Wait for data to be received */
while (!(UCSR0A & (1 << RXC0)))
b4: 80 91 c0 00 lds r24, 0x00C0 ; 0x8000c0 <__DATA_REGION_ORIGIN__+0x60>
b8: 87 ff sbrs r24, 7
ba: fc cf rjmp .-8 ; 0xb4 <Uart_Receive>
;
/* Get and return received data from buffer */
return UDR0;
bc: 80 91 c6 00 lds r24, 0x00C6 ; 0x8000c6 <__DATA_REGION_ORIGIN__+0x66>
}
c0: 08 95 ret
000000c2 <Uart_Transmit>:
void Uart_Transmit(unsigned char data)
{
/* Wait for empty transmit buffer */
while (!(UCSR0A & (1 << UDRE0)))
c2: 90 91 c0 00 lds r25, 0x00C0 ; 0x8000c0 <__DATA_REGION_ORIGIN__+0x60>
c6: 95 ff sbrs r25, 5
c8: fc cf rjmp .-8 ; 0xc2 <Uart_Transmit>
;
/* Put data into buffer, sends the data */
UDR0 = data;
ca: 80 93 c6 00 sts 0x00C6, r24 ; 0x8000c6 <__DATA_REGION_ORIGIN__+0x66>
}
ce: 08 95 ret
000000d0 <USART_transmit_string>:
void USART_transmit_string(char *s)
{
d0: cf 93 push r28
d2: df 93 push r29
d4: ec 01 movw r28, r24
// transmit character until NULL is reached
while (*s > 0)
d6: 89 91 ld r24, Y+
d8: 18 16 cp r1, r24
da: 1c f0 brlt .+6 ; 0xe2 <USART_transmit_string+0x12>
Uart_Transmit(*s++);
}
dc: df 91 pop r29
de: cf 91 pop r28
e0: 08 95 ret
void USART_transmit_string(char *s)
{
// transmit character until NULL is reached
while (*s > 0)
Uart_Transmit(*s++);
e2: 0e 94 61 00 call 0xc2 ; 0xc2 <Uart_Transmit>
e6: f7 cf rjmp .-18 ; 0xd6 <USART_transmit_string+0x6>
000000e8 <main>:
}
int main()
{
Init_Uart();
e8: 0e 94 4b 00 call 0x96 ; 0x96 <Init_Uart>
// Set_Led_PCB(1);
while(1)
{
USART_transmit_string("-APP");
ec: 80 e0 ldi r24, 0x00 ; 0
ee: 91 e0 ldi r25, 0x01 ; 1
f0: 0e 94 68 00 call 0xd0 ; 0xd0 <USART_transmit_string>
#else
//round up by default
__ticks_dc = (uint32_t)(ceil(fabs(__tmp)));
#endif
__builtin_avr_delay_cycles(__ticks_dc);
f4: 2f ef ldi r18, 0xFF ; 255
f6: 81 ef ldi r24, 0xF1 ; 241
f8: 9b e2 ldi r25, 0x2B ; 43
fa: 21 50 subi r18, 0x01 ; 1
fc: 80 40 sbci r24, 0x00 ; 0
fe: 90 40 sbci r25, 0x00 ; 0
100: e1 f7 brne .-8 ; 0xfa <main+0x12>
102: 00 c0 rjmp .+0 ; 0x104 <main+0x1c>
104: 00 00 nop
106: f2 cf rjmp .-28 ; 0xec <main+0x4>
00000108 <_exit>:
108: f8 94 cli
0000010a <__stop_program>:
10a: ff cf rjmp .-2 ; 0x10a <__stop_program>