Skip to content

Commit 0889baf

Browse files
authored
Merge pull request #2233 from zhaojuntao/fix-bsp-flash-drv
[bsp][stm32/libraries] 移除 flash 驱动中 flash write 函数对 size 对齐的限制
2 parents e78eeb8 + bc2ee99 commit 0889baf

File tree

3 files changed

+0
-18
lines changed

3 files changed

+0
-18
lines changed

bsp/stm32/libraries/HAL_Drivers/drv_flash/drv_flash_f0.c

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -84,12 +84,6 @@ int stm32_flash_write(rt_uint32_t addr, const rt_uint8_t *buf, size_t size)
8484
return -RT_EINVAL;
8585
}
8686

87-
if (size % 4 != 0)
88-
{
89-
LOG_E("write size must be 4-byte alignment");
90-
return -RT_EINVAL;
91-
}
92-
9387
if ((end_addr) > STM32_FLASH_END_ADDRESS)
9488
{
9589
LOG_E("write outrange flash size! addr is (0x%p)", (void *)(addr + size));

bsp/stm32/libraries/HAL_Drivers/drv_flash/drv_flash_f1.c

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -84,12 +84,6 @@ int stm32_flash_write(rt_uint32_t addr, const rt_uint8_t *buf, size_t size)
8484
return -RT_EINVAL;
8585
}
8686

87-
if (size % 4 != 0)
88-
{
89-
LOG_E("write size must be 4-byte alignment");
90-
return -RT_EINVAL;
91-
}
92-
9387
if ((end_addr) > STM32_FLASH_END_ADDRESS)
9488
{
9589
LOG_E("write outrange flash size! addr is (0x%p)", (void *)(addr + size));

bsp/stm32/libraries/HAL_Drivers/drv_flash/drv_flash_l4.c

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -140,12 +140,6 @@ int stm32_flash_write(rt_uint32_t addr, const uint8_t *buf, size_t size)
140140
return -RT_EINVAL;
141141
}
142142

143-
if(size % 8 != 0)
144-
{
145-
LOG_E("write size must be 8-byte alignment");
146-
return -RT_EINVAL;
147-
}
148-
149143
HAL_FLASH_Unlock();
150144

151145
__HAL_FLASH_CLEAR_FLAG(FLASH_FLAG_EOP | FLASH_FLAG_OPERR | FLASH_FLAG_WRPERR | FLASH_FLAG_PGAERR | FLASH_FLAG_PGSERR);

0 commit comments

Comments
 (0)