TI提供的bootloader的Demo是直接写FLASH,但是FLASH在写之前一定要先擦除啊,而且我做过实验直接指定一个FLASH地址,往这个地址里面写数据根本写不进去,往RAM中写数据是可以的。如下代码:void CopyData()
{
struct HEADER {
Uint16 BlockSize;
Uint32 DestAddr;
} BlockHeader;
Uint16 wordData;
Uint16 i;
// Get the size in words of the first block
BlockHeader.BlockSize = (*GetWordData)();
// While the block size is > 0 copy the data
// to the DestAddr. There is no error checking
// as it is assumed the DestAddr is a valid
// memory location
while(BlockHeader.BlockSize != (Uint16)0x0000)
{
BlockHeader.DestAddr = GetLongData();
for(i = 1; i <= BlockHeader.BlockSize; i++)
{
wordData = (*GetWordData)();
*(Uint16 *)BlockHeader.DestAddr++ = wordData;
}
// Get the size of the next block
BlockHeader.BlockSize = (*GetWordData)();
}
return;
}
这样操作FLASH怎么会成功???不解
|