This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
ControlSUITE中关于boot_rom的例程中,在"Shared_Boot.c"中有如下代码:
//#################################################
// void CopyData(void)
//-----------------------------------------------------
// This routine copies multiple blocks of data from the host
// to the specified RAM locations. There is no error
// checking on any of the destination addresses.
// That is it is assumed all addresses and block size
// values are correct.
//
// Multiple blocks of data are copied until a block
// size of 00 00 is encountered.
//
//-----------------------------------------------------
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;
}
其中,用红色标记的一行,将接收到的数据直接存到目标地址了。
问题是,固化在ROM里的bootloader接收的升级数据不是要存到FLASH里面吗?
如是,为什么不需要调用FLASH的API呢?FLASH在什么情况下可以直接写呢?
哦,是我没看仔细,多谢了哈!
我想要通过CAN进行在线的固件升级,数据size比RAM大,这个例程就不能直接用了。
正常来说,是要把数据一段一段的转存到FLASH里面吧。
如果是的话,设置多大的”段“比较合适呢?
段太长,会丢数据吗?段太短,会浪费空间吗?(FLASH是按section写的吧?)
请有经验的兄弟/姐妹介绍一下!
如果自己磁轭bootloader程序,可以在程序中不用调用Flash_Erase\Flash_Program\Flash_Verify函数吗,如何做到的,不理解,希望得到帮助解释谢谢!