Consider the offset when read directly into flash memory.
[bertos.git] / bertos / cpu / avr / drv / flash_avr.c
index 231e01ebb941d77f19e0197b64eaa09d09bc6822..7584200ea449a6988fc90ed6fc32bb076502ada1 100644 (file)
@@ -71,7 +71,7 @@ struct FlashHardware;
 
 static size_t avr_flash_readDirect(struct KBlock *blk, block_idx_t idx, void *buf, size_t offset, size_t size)
 {
-       memcpy_P(buf, (const void *)(uint16_t)(idx * blk->blk_size), size);
+       memcpy_P(buf, (const void *)(uint16_t)(idx * blk->blk_size + offset), size);
        return blk->blk_size;
 }