projects
/
bertos.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix undefined behaviour.
[bertos.git]
/
bertos
/
cpu
/
cortex-m3
/
drv
/
flash_stm32.c
diff --git
a/bertos/cpu/cortex-m3/drv/flash_stm32.c
b/bertos/cpu/cortex-m3/drv/flash_stm32.c
index 3b3dd79d2d42047da622ecdb9c4feaa6a87461b1..816cdd58f94096f459a240f6a18f386cdc665328 100644
(file)
--- a/
bertos/cpu/cortex-m3/drv/flash_stm32.c
+++ b/
bertos/cpu/cortex-m3/drv/flash_stm32.c
@@
-112,6
+112,8
@@
static bool stm32_erasePage(struct KBlock *blk, uint32_t page_add)
return true;
}
return true;
}
+#if 0
+// not used for now
static bool stm32_eraseAll(struct KBlock *blk)
{
EMB_FLASH->CR |= CR_MER_SET;
static bool stm32_eraseAll(struct KBlock *blk)
{
EMB_FLASH->CR |= CR_MER_SET;
@@
-124,6
+126,7
@@
static bool stm32_eraseAll(struct KBlock *blk)
return true;
}
return true;
}
+#endif
static int stm32_flash_error(struct KBlock *blk)
{
static int stm32_flash_error(struct KBlock *blk)
{
@@
-139,10
+142,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)
{
static size_t stm32_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(buf, (void *)(idx * blk->blk_size), size);
+ memcpy(buf, (void *)(idx * blk->blk_size + offset), size);
return size;
}
return size;
}
@@
-234,11
+234,11
@@
static void common_init(Flash *fls)
}
}
-void flash_hw_init(Flash *fls,
int flags
)
+void flash_hw_init(Flash *fls,
UNUSED_ARG(int, flags)
)
{
common_init(fls);
fls->blk.priv.vt = &flash_stm32_buffered_vt;
{
common_init(fls);
fls->blk.priv.vt = &flash_stm32_buffered_vt;
- fls->blk.priv.flags |= KB_BUFFERED | KB_PARTIAL_WRITE
| flags
;
+ fls->blk.priv.flags |= KB_BUFFERED | KB_PARTIAL_WRITE;
fls->blk.priv.buf = flash_buf;
/* Load the first block in the cache */
fls->blk.priv.buf = flash_buf;
/* Load the first block in the cache */
@@
-246,9
+246,8
@@
void flash_hw_init(Flash *fls, int flags)
memcpy(fls->blk.priv.buf, flash_start, fls->blk.blk_size);
}
memcpy(fls->blk.priv.buf, flash_start, fls->blk.blk_size);
}
-void flash_hw_initUnbuffered(Flash *fls,
int flags
)
+void flash_hw_initUnbuffered(Flash *fls,
UNUSED_ARG(int, flags)
)
{
common_init(fls);
fls->blk.priv.vt = &flash_stm32_unbuffered_vt;
{
common_init(fls);
fls->blk.priv.vt = &flash_stm32_unbuffered_vt;
- fls->blk.priv.flags |= flags;
}
}