Hi there,
I'm facing a problem with flash write and it seems to me that read returns the value from cache and not from the actual flash when i use read() write() calls.
fd = open("/dev/mtd1", O_RDWR)
ioctl(fd, MEMERASE, &erase_info)
lseek(fd, 0, SEEK_SET)
read(fd, (void*)&tVerifyHeader, 12) <= does not return 0xFFFFFFFF 0xFFFFFFFF 0xFFFFFFFF but
instead returns the old values
lseek(fd, 0, SEEK_SET)
write(fd, (void*)&tHeader, 12)
lseek(fd, 0, SEEK_SET)
read(fd, (void*)&tVerifyHeader, 12) <= does not return new values but old values
But on reboot the written values are correctly updated and i can see this by printing with the uboot, 'md' command.
But from the function which updates this i got a verify check which is where i use the read to read back but it only returns the old value and my check fails
But if i use the utils 'mtd write /tmp/header.bin header_partition' and use 'mtd verify /tmp/header.bin header_partition'
it returns success and the md5sum matches as expected.
Can someone tell me what is going wrong here, why the cache values are returned instead of the last written value.
I assume the read call would use volatile variable to read from device and return the correct value.
fflush(fd) throws a segmentation fault.