打印
[AVR单片机]

ICC启动函数反汇编,怎么看不懂呢

[复制链接]
3999|2
手机看帖
扫描二维码
随时随地手机跟帖
跳转到指定楼层
楼主
NE5532|  楼主 | 2007-3-11 20:08 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
今天拿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……

相关帖子

沙发
NE5532|  楼主 | 2007-3-11 20:10 | 只看该作者

忘了说程序版本了

ICC:6.31A
AVRSTUDIO:4.12

使用特权

评论回复
板凳
NE5532|  楼主 | 2007-3-12 12:20 | 只看该作者

米有人响应?

是不是汇编太乱了没人看,稍微整理一下

+00000026:   30E0        CPI     R30,0x00         Compare with immediate
+00000027:   07F1        CPC     R31,R17          Compare with carry



+00000031:   33E4        CPI     R30,0x34         Compare with immediate
+00000032:   07F1        CPC     R31,R17          Compare with carry

两个循环似乎没有执行。

使用特权

评论回复
发新帖 我要提问
您需要登录后才可以回帖 登录 | 注册

本版积分规则

159

主题

13769

帖子

586

粉丝