搜索
bottom↓
回复: 1

问个简单问题,也是关于马老师例子程序中的

[复制链接]

出0入0汤圆

发表于 2006-5-22 19:36:20 | 显示全部楼层 |阅读模式
void boot_page_ew(long p_address,char code)  

{  

    asm("mov r30,r16
"  

        "mov r31,r17
"  

        "out 0x3b,r18
");            //将页地址放入Z寄存器和RAMPZ的Bit0中  

    SPMCSR = code;                //寄存器SPMCSR中为操作码  

    asm("spm
");                    //对指定Flash页进行操作  

}         

//填充Flash缓冲页中的一个字  

void boot_page_fill(unsigned int address,int data)  

{  

    asm("mov r30,r16
"  

        "mov r31,r17
"             //Z寄存器中为填冲页内地址  

        "mov r0,r18
"  

        "mov r1,r19
");            //R0R1中为一个指令字  

    SPMCSR = 0x01;  

    asm("spm
");  

}  

    这两个方法中怎么没有对address的处理呢,比如将address利用汇编语句写入r30,r31z寄存器呢?也没有将address赋值给r16,r17啊?那么z寄存器怎么就得到address的值呢!

    原来贴在“自引导IAP”那个帖子里边,可惜大家都不回答,呵呵,贴过来了。

    谢谢!

阿莫论坛20周年了!感谢大家的支持与爱护!!

你熬了10碗粥,别人一桶水倒进去,淘走90碗,剩下10碗给你,你看似没亏,其实你那10碗已经没有之前的裹腹了,人家的一桶水换90碗,继续卖。说白了,通货膨胀就是,你的钱是挣来的,他的钱是印来的,掺和在一起,你的钱就贬值了。

出0入0汤圆

发表于 2006-5-26 20:17:38 | 显示全部楼层
以下是ICC HELP的说明:



Argument and Return Registers



The first argument is passed in registers R16/R17 if it is an integer and R16/R17/R18/R19 if it is a long or floating point. The second argument is passed in R18/R19 if available. All other remaining arguments are passed on the software stack.



Integer arguments smaller than ints (i.e. char) are not extended to in IF the function prototype is available. If registers are used to pass byte arguments, it will use both registers but the higher register is undefined. For example, if the first argument is a byte, both R16/R17 will be used with R17 being undefined. Byte arguments passed on the software stack take up only a single byte. In the future release, byte arguments passed in registers will be packed tightly.



If R16/R17 is used to pass the first argument and the second argument is a long or float, the lower half of the second argument is passed in R18/R19 and the upper half is passed on the software stack.



Integer values are returned in R16/R17 and longs and floats are returned in R16/R17/R18/R19. Byte values are returned in R16 with R17 undefined.
回帖提示: 反政府言论将被立即封锁ID 在按“提交”前,请自问一下:我这样表达会给举报吗,会给自己惹麻烦吗? 另外:尽量不要使用Mark、顶等没有意义的回复。不得大量使用大字体和彩色字。【本论坛不允许直接上传手机拍摄图片,浪费大家下载带宽和论坛服务器空间,请压缩后(图片小于1兆)才上传。压缩方法可以在微信里面发给自己(不要勾选“原图),然后下载,就能得到压缩后的图片。注意:要连续压缩2次才能满足要求!!】。另外,手机版只能上传图片,要上传附件需要切换到电脑版(不需要使用电脑,手机上切换到电脑版就行,页面底部)。
您需要登录后才可以回帖 登录 | 注册

本版积分规则

手机版|Archiver|amobbs.com 阿莫电子技术论坛 ( 粤ICP备2022115958号, 版权所有:东莞阿莫电子贸易商行 创办于2004年 (公安交互式论坛备案:44190002001997 ) )

GMT+8, 2024-10-3 02:39

© Since 2004 www.amobbs.com, 原www.ourdev.cn, 原www.ouravr.com

快速回复 返回顶部 返回列表