How can I read flash memory per page? I have not been able to read it by sector.
I have to read 2 memory sectors (2*16kbytes).
I am under FreeRtos and I am using STM32F401RE.
I am using pointer, I just need to read two sectors of memory flash.
uint32_t data_store0[4096] = {0};
uint32_t data_store1[4096] = {0};
uint32_t *words0 = (uint32_t *) BASE_ADDR_SECTOR_0;
uint32_t *words1 = (uint32_t *) BASE_ADDR_SECTOR_1;
unsigned int buffer_firmware[8192] = {0};
unsigned char firmware[32768] = {0};
int k, m, i, j = 0;
int count_time = 0;
for(int i=0; i<4096; i++)
{
data_store0[i] += words0[i];
buffer_firmware[i] = data_store0[i];
}
for(int j=0; j<4096; j++)
{
data_store1[j] += words1[j];
}
for(m = 0, k = 4096; k < 8192 && m < 4096; m++, k++)
{
buffer_firmware[k] = data_store1[m];
}
SHA256Input(&ctx, (const uint8_t *) buffer_firmware, 8192);