Hi,
I would like to write a code to test the flash erase and write.
Suppose I want to write a byte of data (0x1) to the address (0x00010100).
FlashDestination would be: 0x00010100
buf would be: uint8 buf[1] = {0x1}
data_size would be: 1
imageSize would be: 1
Do you think the following code would be ok for unit test:
// Initialize the Flash Wrapper registers.
oReturnCheck = 0;
oReturnCheck = Fapi_BlockErase(Bank0, FlashDestination, imageSize);
// Return an error if an access violation occurred.
if(oReturnCheck)
{
state = AbortHeader;
}
oReturnCheck = 0;
oReturnCheck = Fapi_BlockProgram(Bank0, FlashDestination, buf, data_size);
if(oReturnCheck)
{
// Indicate that the flash programming failed.
state = AbortHeader;
}
Thanks and regards,
Abrar