Consider the offset when read directly into flash memory.
[bertos.git] / bertos / cpu / arm / drv / flash_at91.c
index d501102a63d413b77bd3e014d173f11584a28d8e..1cdf6b788e0e8678ea6a7a5fc6609aa640a6c72e 100644 (file)
@@ -139,7 +139,7 @@ static bool flash_getStatus(struct KBlock *blk)
 
 static size_t at91_flash_readDirect(struct KBlock *blk, block_idx_t idx, void *buf, size_t offset, size_t size)
 {
-       memcpy(buf, (void *)(idx * blk->blk_size +  FLASH_BASE), size);
+       memcpy(buf, (void *)(idx * blk->blk_size +  FLASH_BASE + offset), size);
        return size;
 }