Latest release has a range check bug in DataFlash_GetLongFlash(). Should be checking OutOfRange(Addr, Addr+1).
byte DataFlash_GetLongFlash(DataFlash_TAddress Addr,dword *Data)
{
if (OutOfRange(Addr+1,Addr+1)) /* Check range of address */
return ERR_RANGE;
*Data = readflash(Addr) + (((dword)(readflash(Addr+1)))<<16); /* Read data from FLASH */
return ERR_OK;
}
Hi,
static byte OutOfRange(IFsh1_TAddress addr1,IFsh1_TAddress addr2)
{
return ((addr1>addr2)||(addr1<PROG_FLASH_START)||(addr2>PROG_FLASH_END));
}
I have checked the IFsh1.c and IFsh1.h, but I do not see the body of byte DataFlash_GetLongFlash(DataFlash_TAddress Addr,dword *Data) api function.
Based on the body of OutOfRange(), so it has issue for the calling function code:
if(OutOfRange(Addr+1,Addr+1)) /* Check range of address */
return ERR_RANGE;
Can you tell us where the body of byte DataFlash_GetLongFlash(DataFlash_TAddress Addr,dword *Data) api function is?
BR
XiangJun Rong