We chose our GPIO pins wrong, rx=9, tx=84, which is not one of the pairs allowed. Thus I am trying to emulate what that code does. The serial flash programmer tries to download the flash kernel and SCI_Boot() receives it. After checking the keyword and stripping off the 16 reserved bytes CopyData() is called to receive the file. The file is sent in 11 blocks but what I do not understand is why all blocks have the same destination as there is no apparent processing between blocks.
BlockSize:2 destination:29184 BlockSize:24 destination:29184 BlockSize:1188 destination:29184 BlockSize:2 destination:29184 BlockSize:24 destination:29184 BlockSize:1188 destination:29184 BlockSize:307 destination:29184 BlockSize:4 destination:29184 BlockSize:4096 destination:29184 BlockSize:4096 destination:29184 BlockSize:1943 destination:29184
x
Here is the code from bootloader_shared_funcs.c
void CopyData(void)
{
struct HEADER {
uint32_t DestAddr;
uint16_t BlockSize;
} BlockHeader;
uint16_t wordData;
uint16_t 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_t)0x0000U)
{
BlockHeader.DestAddr = GetLongData();
// Added for debugging
printf("\r\nBlockSize:%d destination:%d", BlockHeader.BlockSize, BlockHeader.DestAddr);
for(i = 1; i <= BlockHeader.BlockSize; i++)
{
wordData = (*GetWordData)();
*(uint16_t *)BlockHeader.DestAddr = wordData;
BlockHeader.DestAddr+=1U;
}
//
// Get the size of the next block
//
BlockHeader.BlockSize = (*GetWordData)();
}
return;
}