Consider the offset when read directly into flash memory.
[bertos.git] / bertos / cpu / cortex-m3 / drv / flash_stm32.c
index a11777b75c62544f3e2633a0eac6448930b1bc6e..62e448f3ab35dd9d201ba78756c89b3655247d9f 100644 (file)
@@ -139,7 +139,7 @@ static void stm32_flash_clearerror(struct KBlock *blk)
 
 static size_t stm32_flash_readDirect(struct KBlock *blk, block_idx_t idx, void *buf, size_t offset, size_t size)
 {
-       memcpy(buf, (void *)(idx * blk->blk_size), size);
+       memcpy(buf, (void *)(idx * blk->blk_size + offset), size);
        return size;
 }