[ZLG-ARM] 求助周工,关于__align(4) uint8 SendData[512];

[复制链接]
2241|2
 楼主| Ice_River 发表于 2007-8-1 13:06 | 显示全部楼层 |阅读模式
int&nbsp;main&nbsp;(void)<br />{<br />__align(4)&nbsp;uint8&nbsp;SendData[512];&nbsp;//&nbsp;定义变量区<br />uint32&nbsp;i;<br />for(i&nbsp;=&nbsp;0;&nbsp;i&nbsp;&lt&nbsp;512;&nbsp;i++)&nbsp;//&nbsp;初始化变量区数据<br />{<br />SendData&nbsp;=&nbsp;i;<br />}<br />SelSector(7,&nbsp;7);&nbsp;//&nbsp;选择扇区<br />EraseSector(7,7);&nbsp;//&nbsp;擦除扇区<br />SelSector(7,&nbsp;7);&nbsp;//&nbsp;选择扇区<br />RamToFlash(DestAddr,&nbsp;(uint32)SendData,&nbsp;512);&nbsp;//&nbsp;写数据到FLASH<br />while(1);<br />return&nbsp;0;<br />}<br />EasyARM2200自带的IAP测试程序可以通过,可是用上面的函数做实验不成功。<br />请教__align(4)&nbsp;uint8&nbsp;SendData[512];&nbsp;<br />这个数组占多大空间?(cpu&nbsp;lpc2292&nbsp;&nbsp;内部RAM&nbsp;16k)<br />256字对齐如果起始地址为0x0000放第一个数据(8bit),那么第二个数据(8bit)存放的地址是0x0001&nbsp;还是0x0100?&nbsp;
zlgARM 发表于 2007-8-1 14:34 | 显示全部楼层

Ice_River

您好:<br />&nbsp;&nbsp;&nbsp;&nbsp;请您做一个实验,观察__align(4)&nbsp;uint8&nbsp;SendData[10]的情况。SendData[10]您自己初始化。&nbsp;公司停电,没法实地调试,十分抱歉!
 楼主| Ice_River 发表于 2007-8-1 15:50 | 显示全部楼层

好的!多谢!

int&nbsp;main&nbsp;(void)<br />{<br />//__align(4)&nbsp;uint8&nbsp;SendData[512];&nbsp;//&nbsp;定义变量区<br />uint32&nbsp;i;<br />for(i&nbsp;=&nbsp;0;&nbsp;i&nbsp;&lt&nbsp;512;&nbsp;i++)&nbsp;//&nbsp;初始化变量区数据<br />{<br />SendData&nbsp;=&nbsp;i;<br />}<br />SelSector(1,&nbsp;1);&nbsp;//&nbsp;选择扇区<br />EraseSector(1,1);&nbsp;//&nbsp;擦除扇区<br />SelSector(1,&nbsp;1);&nbsp;//&nbsp;选择扇区<br />RamToFlash(0x00002000,&nbsp;0x40000300,&nbsp;512);&nbsp;//&nbsp;写数据到FLASH<br />while(1);<br />return&nbsp;0;<br />}<br />这个函数外部RAM仿真的时候可以运行,数据正确,写入内部就死了<br />SelSector(1,&nbsp;1);&nbsp;死在这个函数上面,如果在内部运行的话,需要注意些什么问题呢?
您需要登录后才可以回帖 登录 | 注册

本版积分规则

149

主题

1882

帖子

0

粉丝
快速回复 在线客服 返回列表 返回顶部