MCU选择MEGA8 ,优化级S级的的效果, test.elf: file format elf32-avr
Sections: Idx Name Size VMA LMA File off Algn 0 .text 000001fe 00000000 00000000 00000094 2**1 CONTENTS, ALLOC, LOAD, READONLY, CODE 1 .bss 00000005 00800060 000001fe 00000292 2**0 ALLOC 2 .eeprom 00000013 00810000 00810000 00000292 2**0 CONTENTS, ALLOC, LOAD, DATA 3 .stab 00001278 00000000 00000000 000002a8 2**2 CONTENTS, READONLY, DEBUGGING 4 .stabstr 00000b37 00000000 00000000 00001520 2**0 CONTENTS, READONLY, DEBUGGING Disassembly of section .text:
00000000 <__vectors>: 0: 12 c0 rjmp .+36 ; 0x26 <__ctors_end> 2: 2c c0 rjmp .+88 ; 0x5c <__bad_interrupt> 4: 2b c0 rjmp .+86 ; 0x5c <__bad_interrupt> 6: 2a c0 rjmp .+84 ; 0x5c <__bad_interrupt> 8: 29 c0 rjmp .+82 ; 0x5c <__bad_interrupt> a: 28 c0 rjmp .+80 ; 0x5c <__bad_interrupt> c: 27 c0 rjmp .+78 ; 0x5c <__bad_interrupt> e: 26 c0 rjmp .+76 ; 0x5c <__bad_interrupt> 10: 25 c0 rjmp .+74 ; 0x5c <__bad_interrupt> 12: 24 c0 rjmp .+72 ; 0x5c <__bad_interrupt> 14: 23 c0 rjmp .+70 ; 0x5c <__bad_interrupt> 16: 22 c0 rjmp .+68 ; 0x5c <__bad_interrupt> 18: 21 c0 rjmp .+66 ; 0x5c <__bad_interrupt> 1a: 20 c0 rjmp .+64 ; 0x5c <__bad_interrupt> 1c: 1f c0 rjmp .+62 ; 0x5c <__bad_interrupt> 1e: 1e c0 rjmp .+60 ; 0x5c <__bad_interrupt> 20: 1d c0 rjmp .+58 ; 0x5c <__bad_interrupt> 22: 1c c0 rjmp .+56 ; 0x5c <__bad_interrupt> 24: 1b c0 rjmp .+54 ; 0x5c <__bad_interrupt>
00000026 <__ctors_end>: 26: 11 24 eor r1, r1 28: 1f be out 0x3f, r1 ; 63 2a: cf e5 ldi r28, 0x5F ; 95 2c: d4 e0 ldi r29, 0x04 ; 4 2e: de bf out 0x3e, r29 ; 62 30: cd bf out 0x3d, r28 ; 61
00000032 <__do_copy_data>: 32: 10 e0 ldi r17, 0x00 ; 0 34: a0 e6 ldi r26, 0x60 ; 96 36: b0 e0 ldi r27, 0x00 ; 0 38: ee ef ldi r30, 0xFE ; 254 3a: f1 e0 ldi r31, 0x01 ; 1 3c: 02 c0 rjmp .+4 ; 0x42 <.do_copy_data_start>
0000003e <.do_copy_data_loop>: 3e: 05 90 lpm r0, Z+ 40: 0d 92 st X+, r0
00000042 <.do_copy_data_start>: 42: a0 36 cpi r26, 0x60 ; 96 44: b1 07 cpc r27, r17 46: d9 f7 brne .-10 ; 0x3e <.do_copy_data_loop>
00000048 <__do_clear_bss>: 48: 10 e0 ldi r17, 0x00 ; 0 4a: a0 e6 ldi r26, 0x60 ; 96 4c: b0 e0 ldi r27, 0x00 ; 0 4e: 01 c0 rjmp .+2 ; 0x52 <.do_clear_bss_start>
00000050 <.do_clear_bss_loop>: 50: 1d 92 st X+, r1
00000052 <.do_clear_bss_start>: 52: a5 36 cpi r26, 0x65 ; 101 54: b1 07 cpc r27, r17 56: e1 f7 brne .-8 ; 0x50 <.do_clear_bss_loop> 58: ab d0 rcall .+342 ; 0x1b0 <main> 5a: d0 c0 rjmp .+416 ; 0x1fc <_exit>
0000005c <__bad_interrupt>: 5c: d1 cf rjmp .-94 ; 0x0 <__vectors>
0000005e <write_eeprom>:
void eeprom_write_byte (uint8_t *addr,uint8_t value) { __asm__ __volatile__ ( 5e: 81 e0 ldi r24, 0x01 ; 1 60: a3 e0 ldi r26, 0x03 ; 3 62: b0 e0 ldi r27, 0x00 ; 0 64: 08 2e mov r0, r24 66: b9 d0 rcall .+370 ; 0x1da <__eeprom_write_byte_1C1D1E>
//eeprom_busy_wait(); //等待EEPROM 读写就绪 temp=1; eeprom_write_byte (&type,temp);//装置类型 eeprom_busy_wait(); 68: e1 99 sbic 0x1c, 1 ; 28 6a: fe cf rjmp .-4 ; 0x68 <write_eeprom+0xa>
void eeprom_write_byte (uint8_t *addr,uint8_t value) { __asm__ __volatile__ ( 6c: 82 e0 ldi r24, 0x02 ; 2 6e: a4 e0 ldi r26, 0x04 ; 4 70: b0 e0 ldi r27, 0x00 ; 0 72: 08 2e mov r0, r24 74: b2 d0 rcall .+356 ; 0x1da <__eeprom_write_byte_1C1D1E> temp=2; eeprom_write_byte (&tx_id,temp);//通讯地址 eeprom_busy_wait(); 76: e1 99 sbic 0x1c, 1 ; 28 78: fe cf rjmp .-4 ; 0x76 <write_eeprom+0x18> temp=3; eeprom_write_byte (&flag3,temp);//设定标志 7a: a1 e1 ldi r26, 0x11 ; 17 7c: b0 e0 ldi r27, 0x00 ; 0
void eeprom_write_byte (uint8_t *addr,uint8_t value) { __asm__ __volatile__ ( 7e: 83 e0 ldi r24, 0x03 ; 3 80: 08 2e mov r0, r24 82: ab d0 rcall .+342 ; 0x1da <__eeprom_write_byte_1C1D1E> eeprom_busy_wait(); 84: e1 99 sbic 0x1c, 1 ; 28 86: fe cf rjmp .-4 ; 0x84 <write_eeprom+0x26> temp=4; eeprom_write_byte (&flag4,temp);//时限标志 88: a2 e1 ldi r26, 0x12 ; 18 8a: b0 e0 ldi r27, 0x00 ; 0
void eeprom_write_byte (uint8_t *addr,uint8_t value) { __asm__ __volatile__ ( 8c: 84 e0 ldi r24, 0x04 ; 4 8e: 08 2e mov r0, r24 90: a4 d0 rcall .+328 ; 0x1da <__eeprom_write_byte_1C1D1E> eeprom_busy_wait(); 92: e1 99 sbic 0x1c, 1 ; 28 94: fe cf rjmp .-4 ; 0x92 <write_eeprom+0x34>
void eeprom_write_word (uint16_t *addr,uint16_t value) { __asm__ __volatile__ ( 96: 8b e0 ldi r24, 0x0B ; 11 98: 90 e0 ldi r25, 0x00 ; 0 9a: a7 e0 ldi r26, 0x07 ; 7 9c: b0 e0 ldi r27, 0x00 ; 0 9e: 0c 01 movw r0, r24 a0: a8 d0 rcall .+336 ; 0x1f2 <__eeprom_write_word_1C1D1E> l=11; eeprom_write_word (&battery_high,l);//电池电压上限 eeprom_busy_wait(); a2: e1 99 sbic 0x1c, 1 ; 28 a4: fe cf rjmp .-4 ; 0xa2 <write_eeprom+0x44>
void eeprom_write_word (uint16_t *addr,uint16_t value) { __asm__ __volatile__ ( a6: 8c e0 ldi r24, 0x0C ; 12 a8: 90 e0 ldi r25, 0x00 ; 0 aa: a9 e0 ldi r26, 0x09 ; 9 ac: b0 e0 ldi r27, 0x00 ; 0 ae: 0c 01 movw r0, r24 b0: a0 d0 rcall .+320 ; 0x1f2 <__eeprom_write_word_1C1D1E> l=12; eeprom_write_word (&battery_low,l);//电池电压下限 eeprom_busy_wait(); b2: e1 99 sbic 0x1c, 1 ; 28 b4: fe cf rjmp .-4 ; 0xb2 <write_eeprom+0x54>
void eeprom_write_word (uint16_t *addr,uint16_t value) { __asm__ __volatile__ ( b6: 8d e0 ldi r24, 0x0D ; 13 b8: 90 e0 ldi r25, 0x00 ; 0 ba: a5 e0 ldi r26, 0x05 ; 5 bc: b0 e0 ldi r27, 0x00 ; 0 be: 0c 01 movw r0, r24 c0: 98 d0 rcall .+304 ; 0x1f2 <__eeprom_write_word_1C1D1E> l=13; eeprom_write_word (&discharge_cur,l);//放电电流 eeprom_busy_wait(); c2: e1 99 sbic 0x1c, 1 ; 28 c4: fe cf rjmp .-4 ; 0xc2 <write_eeprom+0x64>
void eeprom_write_word (uint16_t *addr,uint16_t value) { __asm__ __volatile__ ( c6: 8e e0 ldi r24, 0x0E ; 14 c8: 90 e0 ldi r25, 0x00 ; 0 ca: ab e0 ldi r26, 0x0B ; 11 cc: b0 e0 ldi r27, 0x00 ; 0 ce: 0c 01 movw r0, r24 d0: 90 d0 rcall .+288 ; 0x1f2 <__eeprom_write_word_1C1D1E> l=14; eeprom_write_word (&diplay_vol_xs,l);//电压显示系数 eeprom_busy_wait(); d2: e1 99 sbic 0x1c, 1 ; 28 d4: fe cf rjmp .-4 ; 0xd2 <write_eeprom+0x74>
void eeprom_write_word (uint16_t *addr,uint16_t value) { __asm__ __volatile__ ( d6: 8f e0 ldi r24, 0x0F ; 15 d8: 90 e0 ldi r25, 0x00 ; 0 da: ad e0 ldi r26, 0x0D ; 13 dc: b0 e0 ldi r27, 0x00 ; 0 de: 0c 01 movw r0, r24 e0: 88 d0 rcall .+272 ; 0x1f2 <__eeprom_write_word_1C1D1E> l=15; eeprom_write_word (&diplay_cur_xs,l);//电流显示系数 eeprom_busy_wait(); e2: e1 99 sbic 0x1c, 1 ; 28 e4: fe cf rjmp .-4 ; 0xe2 <write_eeprom+0x84>
void eeprom_write_word (uint16_t *addr,uint16_t value) { __asm__ __volatile__ ( e6: 85 e0 ldi r24, 0x05 ; 5 e8: 90 e0 ldi r25, 0x00 ; 0 ea: af e0 ldi r26, 0x0F ; 15 ec: b0 e0 ldi r27, 0x00 ; 0 ee: 0c 01 movw r0, r24 f0: 80 d0 rcall .+256 ; 0x1f2 <__eeprom_write_word_1C1D1E> temp=5; eeprom_write_word (&password,temp);//密码 eeprom_busy_wait(); f2: e1 99 sbic 0x1c, 1 ; 28 f4: fe cf rjmp .-4 ; 0xf2 <write_eeprom+0x94>
void eeprom_write_byte (uint8_t *addr,uint8_t value) { __asm__ __volatile__ ( f6: 86 e0 ldi r24, 0x06 ; 6 f8: a0 e0 ldi r26, 0x00 ; 0 fa: b0 e0 ldi r27, 0x00 ; 0 fc: 08 2e mov r0, r24 fe: 6d d0 rcall .+218 ; 0x1da <__eeprom_write_byte_1C1D1E> temp=6; eeprom_write_byte (&year_sx,temp);//年时限 eeprom_busy_wait(); 100: e1 99 sbic 0x1c, 1 ; 28 102: fe cf rjmp .-4 ; 0x100 <write_eeprom+0xa2>
void eeprom_write_byte (uint8_t *addr,uint8_t value) { __asm__ __volatile__ ( 104: 87 e0 ldi r24, 0x07 ; 7 106: a1 e0 ldi r26, 0x01 ; 1 108: b0 e0 ldi r27, 0x00 ; 0 10a: 08 2e mov r0, r24 10c: 66 d0 rcall .+204 ; 0x1da <__eeprom_write_byte_1C1D1E> temp=7; eeprom_write_byte (&month_sx,temp);//月时限 eeprom_busy_wait(); 10e: e1 99 sbic 0x1c, 1 ; 28 110: fe cf rjmp .-4 ; 0x10e <write_eeprom+0xb0>
void eeprom_write_byte (uint8_t *addr,uint8_t value) { __asm__ __volatile__ ( 112: 88 e0 ldi r24, 0x08 ; 8 114: a2 e0 ldi r26, 0x02 ; 2 116: b0 e0 ldi r27, 0x00 ; 0 118: 08 2e mov r0, r24 11a: 5f d0 rcall .+190 ; 0x1da <__eeprom_write_byte_1C1D1E> 11c: 08 95 ret
0000011e <read_eeprom>: temp=8; eeprom_write_byte (&day_sx,temp);//日时限
// eeprom_busy_wait(); }
//**********读eeprom******************************* void read_eeprom(void) { uint8_t temp = 0; uint16_t l = 0; eeprom_busy_wait(); //等待EEPROM 读写就绪 11e: e1 99 sbic 0x1c, 1 ; 28 120: fe cf rjmp .-4 ; 0x11e <read_eeprom> uint8_t eeprom_read_byte (const uint8_t *addr) { uint8_t result; __asm__ __volatile__ 122: a3 e0 ldi r26, 0x03 ; 3 124: b0 e0 ldi r27, 0x00 ; 0 126: 4c d0 rcall .+152 ; 0x1c0 <__eeprom_read_byte_1C1D1E> 128: 80 2d mov r24, r0 temp = eeprom_read_byte (&type);//装置类型 eeprom_busy_wait(); 12a: e1 99 sbic 0x1c, 1 ; 28 12c: fe cf rjmp .-4 ; 0x12a <read_eeprom+0xc> uint8_t eeprom_read_byte (const uint8_t *addr) { uint8_t result; __asm__ __volatile__ 12e: a4 e0 ldi r26, 0x04 ; 4 130: b0 e0 ldi r27, 0x00 ; 0 132: 46 d0 rcall .+140 ; 0x1c0 <__eeprom_read_byte_1C1D1E> 134: 80 2d mov r24, r0 temp = eeprom_read_byte (&tx_id);//通讯地址 eeprom_busy_wait(); 136: e1 99 sbic 0x1c, 1 ; 28 138: fe cf rjmp .-4 ; 0x136 <read_eeprom+0x18> temp = eeprom_read_byte (&flag3);//设定标志 13a: a1 e1 ldi r26, 0x11 ; 17 13c: b0 e0 ldi r27, 0x00 ; 0 uint8_t eeprom_read_byte (const uint8_t *addr) { uint8_t result; __asm__ __volatile__ 13e: 40 d0 rcall .+128 ; 0x1c0 <__eeprom_read_byte_1C1D1E> 140: 80 2d mov r24, r0 eeprom_busy_wait(); 142: e1 99 sbic 0x1c, 1 ; 28 144: fe cf rjmp .-4 ; 0x142 <read_eeprom+0x24> temp = eeprom_read_byte (&flag4);//时限标志 146: a2 e1 ldi r26, 0x12 ; 18 148: b0 e0 ldi r27, 0x00 ; 0 uint8_t eeprom_read_byte (const uint8_t *addr) { uint8_t result; __asm__ __volatile__ 14a: 3a d0 rcall .+116 ; 0x1c0 <__eeprom_read_byte_1C1D1E> 14c: 80 2d mov r24, r0 eeprom_busy_wait(); 14e: e1 99 sbic 0x1c, 1 ; 28 150: fe cf rjmp .-4 ; 0x14e <read_eeprom+0x30> eeprom_read_word (const uint16_t *addr) { uint16_t result;
__asm__ __volatile__ ( 152: a7 e0 ldi r26, 0x07 ; 7 154: b0 e0 ldi r27, 0x00 ; 0 156: 3c d0 rcall .+120 ; 0x1d0 <__eeprom_read_word_1C1D1E> l = eeprom_read_word (&battery_high);//电池电压上限 eeprom_busy_wait(); 158: e1 99 sbic 0x1c, 1 ; 28 15a: fe cf rjmp .-4 ; 0x158 <read_eeprom+0x3a> eeprom_read_word (const uint16_t *addr) { uint16_t result;
__asm__ __volatile__ ( 15c: a9 e0 ldi r26, 0x09 ; 9 15e: b0 e0 ldi r27, 0x00 ; 0 160: 37 d0 rcall .+110 ; 0x1d0 <__eeprom_read_word_1C1D1E> l = eeprom_read_word (&battery_low);//电池电压下限 eeprom_busy_wait(); 162: e1 99 sbic 0x1c, 1 ; 28 164: fe cf rjmp .-4 ; 0x162 <read_eeprom+0x44> eeprom_read_word (const uint16_t *addr) { uint16_t result;
__asm__ __volatile__ ( 166: a5 e0 ldi r26, 0x05 ; 5 168: b0 e0 ldi r27, 0x00 ; 0 16a: 32 d0 rcall .+100 ; 0x1d0 <__eeprom_read_word_1C1D1E> l = eeprom_read_word (&discharge_cur);//放电电流 eeprom_busy_wait(); 16c: e1 99 sbic 0x1c, 1 ; 28 16e: fe cf rjmp .-4 ; 0x16c <read_eeprom+0x4e> eeprom_read_word (const uint16_t *addr) { uint16_t result;
__asm__ __volatile__ ( 170: ab e0 ldi r26, 0x0B ; 11 172: b0 e0 ldi r27, 0x00 ; 0 174: 2d d0 rcall .+90 ; 0x1d0 <__eeprom_read_word_1C1D1E> l = eeprom_read_word (&diplay_vol_xs);//电压显示系数 eeprom_busy_wait(); 176: e1 99 sbic 0x1c, 1 ; 28 178: fe cf rjmp .-4 ; 0x176 <read_eeprom+0x58> eeprom_read_word (const uint16_t *addr) { uint16_t result;
__asm__ __volatile__ ( 17a: ad e0 ldi r26, 0x0D ; 13 17c: b0 e0 ldi r27, 0x00 ; 0 17e: 28 d0 rcall .+80 ; 0x1d0 <__eeprom_read_word_1C1D1E> l = eeprom_read_word (&diplay_cur_xs);//电流显示系数 eeprom_busy_wait(); 180: e1 99 sbic 0x1c, 1 ; 28 182: fe cf rjmp .-4 ; 0x180 <read_eeprom+0x62> eeprom_read_word (const uint16_t *addr) { uint16_t result;
__asm__ __volatile__ ( 184: af e0 ldi r26, 0x0F ; 15 186: b0 e0 ldi r27, 0x00 ; 0 188: 23 d0 rcall .+70 ; 0x1d0 <__eeprom_read_word_1C1D1E> l = eeprom_read_word (&password);//密码 eeprom_busy_wait(); 18a: e1 99 sbic 0x1c, 1 ; 28 18c: fe cf rjmp .-4 ; 0x18a <read_eeprom+0x6c> uint8_t eeprom_read_byte (const uint8_t *addr) { uint8_t result; __asm__ __volatile__ 18e: a0 e0 ldi r26, 0x00 ; 0 190: b0 e0 ldi r27, 0x00 ; 0 192: 16 d0 rcall .+44 ; 0x1c0 <__eeprom_read_byte_1C1D1E> 194: 80 2d mov r24, r0 temp = eeprom_read_byte (&year_sx);//年时限 eeprom_busy_wait(); 196: e1 99 sbic 0x1c, 1 ; 28 198: fe cf rjmp .-4 ; 0x196 <read_eeprom+0x78> uint8_t eeprom_read_byte (const uint8_t *addr) { uint8_t result; __asm__ __volatile__ 19a: a1 e0 ldi r26, 0x01 ; 1 19c: b0 e0 ldi r27, 0x00 ; 0 19e: 10 d0 rcall .+32 ; 0x1c0 <__eeprom_read_byte_1C1D1E> 1a0: 80 2d mov r24, r0 temp = eeprom_read_byte (&month_sx);//月时限 eeprom_busy_wait(); 1a2: e1 99 sbic 0x1c, 1 ; 28 1a4: fe cf rjmp .-4 ; 0x1a2 <read_eeprom+0x84> uint8_t eeprom_read_byte (const uint8_t *addr) { uint8_t result; __asm__ __volatile__ 1a6: a2 e0 ldi r26, 0x02 ; 2 1a8: b0 e0 ldi r27, 0x00 ; 0 1aa: 0a d0 rcall .+20 ; 0x1c0 <__eeprom_read_byte_1C1D1E> 1ac: 80 2d mov r24, r0 1ae: 08 95 ret
000001b0 <main>: temp = eeprom_read_byte (&day_sx);//日时限
}
int main(void) {
unsigned int a,b,c; unsigned char buf; write_eeprom(); 1b0: 56 df rcall .-340 ; 0x5e <write_eeprom> read_eeprom(); 1b2: b5 df rcall .-150 ; 0x11e <read_eeprom> DDRD =0xff; 1b4: 8f ef ldi r24, 0xFF ; 255 1b6: 81 bb out 0x11, r24 ; 17 1b8: 80 e0 ldi r24, 0x00 ; 0 a=100; b=200; c=300; buf=0; while(1) { buf++; 1ba: 8f 5f subi r24, 0xFF ; 255 PORTD =buf; 1bc: 82 bb out 0x12, r24 ; 18 1be: fd cf rjmp .-6 ; 0x1ba <main+0xa>
000001c0 <__eeprom_read_byte_1C1D1E>: 1c0: e1 99 sbic 0x1c, 1 ; 28 1c2: fe cf rjmp .-4 ; 0x1c0 <__eeprom_read_byte_1C1D1E> 1c4: bf bb out 0x1f, r27 ; 31 1c6: ae bb out 0x1e, r26 ; 30 1c8: e0 9a sbi 0x1c, 0 ; 28 1ca: 11 96 adiw r26, 0x01 ; 1 1cc: 0d b2 in r0, 0x1d ; 29 1ce: 08 95 ret
000001d0 <__eeprom_read_word_1C1D1E>: 1d0: f7 df rcall .-18 ; 0x1c0 <__eeprom_read_byte_1C1D1E> 1d2: e0 2d mov r30, r0 1d4: f5 df rcall .-22 ; 0x1c0 <__eeprom_read_byte_1C1D1E> 1d6: f0 2d mov r31, r0 1d8: 08 95 ret
000001da <__eeprom_write_byte_1C1D1E>: 1da: e1 99 sbic 0x1c, 1 ; 28 1dc: fe cf rjmp .-4 ; 0x1da <__eeprom_write_byte_1C1D1E> 1de: bf bb out 0x1f, r27 ; 31 1e0: ae bb out 0x1e, r26 ; 30 1e2: 0d ba out 0x1d, r0 ; 29 1e4: 11 96 adiw r26, 0x01 ; 1 1e6: 0f b6 in r0, 0x3f ; 63 1e8: f8 94 cli 1ea: e2 9a sbi 0x1c, 2 ; 28 1ec: e1 9a sbi 0x1c, 1 ; 28 1ee: 0f be out 0x3f, r0 ; 63 1f0: 08 95 ret
000001f2 <__eeprom_write_word_1C1D1E>: 1f2: f3 df rcall .-26 ; 0x1da <__eeprom_write_byte_1C1D1E> 1f4: 01 2c mov r0, r1 1f6: f1 df rcall .-30 ; 0x1da <__eeprom_write_byte_1C1D1E> 1f8: 11 24 eor r1, r1 1fa: 08 95 ret
000001fc <_exit>: 1fc: ff cf rjmp .-2 ; 0x1fc <_exit> |