Consider the offset when read directly into flash memory.
[bertos.git] / bertos / cpu / avr / drv / flash_avr.c
index 50e2a6cf6c494fd47377369f0236ab0e546f7862..7584200ea449a6988fc90ed6fc32bb076502ada1 100644 (file)
@@ -71,10 +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)
 {
-       ASSERT(offset == 0);
-       ASSERT(size == blk->blk_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;
 }