From: asterix Date: Wed, 11 Aug 2010 13:02:35 +0000 (+0000) Subject: Add missing assert. Clean up. X-Git-Tag: 2.6.0~227 X-Git-Url: https://codewiz.org/gitweb?a=commitdiff_plain;h=48777db5747246fa0fda4dc98316415a1f0ac96c;p=bertos.git Add missing assert. Clean up. git-svn-id: https://src.develer.com/svnoss/bertos/trunk@4163 38d2e660-2303-0410-9eaa-f027e97ec537 --- diff --git a/bertos/cpu/cortex-m3/drv/flash_lm3s.c b/bertos/cpu/cortex-m3/drv/flash_lm3s.c index dbabc08a..563b2229 100644 --- a/bertos/cpu/cortex-m3/drv/flash_lm3s.c +++ b/bertos/cpu/cortex-m3/drv/flash_lm3s.c @@ -107,7 +107,10 @@ static int lm3s_writeWord(struct KBlock *blk, uint32_t addr, uint32_t data) static size_t lm3s_flash_readDirect(struct KBlock *blk, block_idx_t idx, void *buf, size_t offset, size_t size) { - memcpy(buf, (void *)(idx * blk->blk_size + offset), size); + ASSERT(offest == 0); + ASSERT(size == blk->blk_size); + + memcpy(buf, (void *)(idx * blk->blk_size), size); return size; } diff --git a/bertos/cpu/cortex-m3/drv/flash_stm32.c b/bertos/cpu/cortex-m3/drv/flash_stm32.c index fc1805e2..a90bc95c 100644 --- a/bertos/cpu/cortex-m3/drv/flash_stm32.c +++ b/bertos/cpu/cortex-m3/drv/flash_stm32.c @@ -146,8 +146,10 @@ 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 + offset), size); + ASSERT(offest == 0); + ASSERT(size == blk->blk_size); + memcpy(buf, (void *)(idx * blk->blk_size), size); return size; } @@ -173,7 +175,7 @@ static size_t stm32_flash_writeDirect(struct KBlock *blk, block_idx_t idx, const if (!stm32_erasePage(blk, (idx * blk->blk_size))) return 0; - uint32_t addr = idx * blk->blk_size + offset; + uint32_t addr = idx * blk->blk_size; const uint8_t *buf = (const uint8_t *)_buf; while (size)