今天拿ICC写了个空工程弄来看启动函数的反汇编代码,C语言源程序如下:
#include <iom8v.h> #include <macros.h>
void main (void) { while(1); }
AVRSTUDIO给出的反汇编代码如下(直接对HEX文件反汇编):
+00000000: C019 RJMP PC+0x001A Relative jump +00000001: FFFF ??? Data or unknown opcode +00000002: FFFF ??? Data or unknown opcode +00000003: FFFF ??? Data or unknown opcode +00000004: FFFF ??? Data or unknown opcode +00000005: FFFF ??? Data or unknown opcode +00000006: FFFF ??? Data or unknown opcode +00000007: FFFF ??? Data or unknown opcode +00000008: FFFF ??? Data or unknown opcode +00000009: FFFF ??? Data or unknown opcode +0000000A: FFFF ??? Data or unknown opcode +0000000B: FFFF ??? Data or unknown opcode +0000000C: FFFF ??? Data or unknown opcode +0000000D: FFFF ??? Data or unknown opcode +0000000E: FFFF ??? Data or unknown opcode +0000000F: FFFF ??? Data or unknown opcode +00000010: FFFF ??? Data or unknown opcode +00000011: FFFF ??? Data or unknown opcode +00000012: FFFF ??? Data or unknown opcode +00000013: FFFF ??? Data or unknown opcode +00000014: FFFF ??? Data or unknown opcode +00000015: FFFF ??? Data or unknown opcode +00000016: FFFF ??? Data or unknown opcode +00000017: FFFF ??? Data or unknown opcode +00000018: FFFF ??? Data or unknown opcode +00000019: FFFF ??? Data or unknown opcode +0000001A: EFCF SER R28 Set Register +0000001B: E0D2 LDI R29,0x02 Load immediate +0000001C: BFCD OUT 0x3D,R28 Out to I/O location +0000001D: BFDE OUT 0x3E,R29 Out to I/O location +0000001E: 51C0 SUBI R28,0x10 Subtract immediate +0000001F: 40D0 SBCI R29,0x00 Subtract immediate with carry +00000020: EA0A LDI R16,0xAA Load immediate +00000021: 8308 STD Y+0,R16 Store indirect with displacement +00000022: 2400 CLR R0 Clear Register +00000023: E0E0 LDI R30,0x00 Load immediate +00000024: E0F1 LDI R31,0x01 Load immediate +00000025: E011 LDI R17,0x01 Load immediate +00000026: 30E0 CPI R30,0x00 Compare with immediate +00000027: 07F1 CPC R31,R17 Compare with carry +00000028: F011 BREQ PC+0x03 Branch if equal +00000029: 9201 ST Z+,R0 Store indirect and postincrement +0000002A: CFFB RJMP PC-0x0004 Relative jump +0000002B: 8300 STD Z+0,R16 Store indirect with displacement +0000002C: E3E4 LDI R30,0x34 Load immediate +0000002D: E0F0 LDI R31,0x00 Load immediate +0000002E: E0A0 LDI R26,0x00 Load immediate +0000002F: E0B1 LDI R27,0x01 Load immediate +00000030: E010 LDI R17,0x00 Load immediate +00000031: 33E4 CPI R30,0x34 Compare with immediate +00000032: 07F1 CPC R31,R17 Compare with carry +00000033: F021 BREQ PC+0x05 Branch if equal +00000034: 95C8 LPM Load program memory +00000035: 9631 ADIW R30,0x01 Add immediate to word +00000036: 920D ST X+,R0 Store indirect and postincrement +00000037: CFF9 RJMP PC-0x0006 Relative jump +00000038: D001 RCALL PC+0x0002 Relative call subroutine +00000039: CFFF RJMP PC-0x0000 Relative jump +0000003A: CFFF RJMP PC-0x0000 Relative jump +0000003B: 9508 RET Subroutine return +0000003C: FFFF ??? Data or unknown opcode
发现清除数据区和拷贝初始化数据两个循环居然都没有被执行,程序直接调用了main函数,难不成是我在ICC里面哪个勾勾没有打?郁闷ing…… |