2021-05-28 04:24 PM
This routeen fails on the line
Flash_End_Address() at flash_page.c:87 0x80004e6
where line 87 is
*DATA_64 = *(__IO uint64_t *)StartPageAddress;
_______________________________________________________________________________________
uint32_t Flash_End_Address (uint32_t StartPageAddress)
{
__IO uint64_t* DATA_64;
while (1){
*DATA_64 = *(__IO uint64_t *)StartPageAddress;
if (*DATA_64 == 0xffffffffffffffff)
{
break;
}
StartPageAddress += 8;
}
return StartPageAddress;
}
___________________________________________________________________
This routeen works
___________________________________________________________________
uint32_t Flash_Read_Data (uint32_t StartPageAddress, __IO uint64_t * DATA_64)
{
while (1)
{
*DATA_64 = *(__IO uint64_t *)StartPageAddress;
if (*DATA_64 == 0xffffffffffffffff)
{
*DATA_64 = '\0';
break;
}
StartPageAddress += 8;
DATA_64++;
}
return StartPageAddress;
}
2021-05-28 07:04 PM
__IO uint64_t* DATA_64;
...
*DATA_64 = *(__IO uint64_t *)StartPageAddress;
You're writing a value to the location of an uninitialized pointer. Seems like you want this instead:
uint32_t Flash_End_Address (uint32_t StartPageAddress)
{
__IO uint64_t DATA_64;
while (1)
{
DATA_64 = *(__IO uint64_t *)StartPageAddress;
if (DATA_64 == 0xffffffffffffffff)
{
break;
}
StartPageAddress += 8;
}
return StartPageAddress;
}
or just:
uint32_t Flash_End_Address (uint32_t StartPageAddress)
{
while (1)
{
if (*(__IO uint64_t *)StartPageAddress == 0xffffffffffffffff)
{
break;
}
StartPageAddress += 8;
}
return StartPageAddress;
}