2017-06-02 08:31 AM
Hi,
I am implementing a routine to verify my programmed flash image on a byte-per-byte basis against a master file on a byte-by-byte basis. I'm having problem reading from the flash at certain memory addresses. When I breakpoint I can read from the address fine, and I can even move the PC and manually step over the instruction to see it succeed. When I run at full speed it fails.
In the example below, flashAddress is declared as a 'volatile unsigned char *'. I added the FreeRTOS vTaskDelay(0) to see if that would reload the program cache, but no luck.
I *think* I'm running into a buffering problem with the read-ahead cache, but the current PC is around 0x801ecaa and the memory address that always fail is 0x8001f90, so that doesn't make sense.
while(true)
{ numRead = fread(compareBuffer, READ_BUFFER_SIZE, 1, fp); if(numRead == 0) { break; } for(i=0;i<numRead;i++) { if(*flashAddress != compareBuffer[i]) { vTaskDelay(0); if(*flashAddress != compareBuffer[i]) { ASSERT(false) } } flashAddress++; }}
Thanks for the help...Keith Rhodes
2017-06-03 06:29 AM
I changed the logic to compare on a 32-bit boundary and it still fails, but at a different address. At first the value that failed when read was 0, now it is non-zero and the upper 16 bits match and the lower 16 bits are different.