Merge pull request #2233 from zhaojuntao/fix-bsp-flash-drv
[bsp][stm32/libraries] 移除 flash 驱动中 flash write 函数对 size 对齐的限制
This commit is contained in:
commit
0889bafda8
|
@ -84,12 +84,6 @@ int stm32_flash_write(rt_uint32_t addr, const rt_uint8_t *buf, size_t size)
|
|||
return -RT_EINVAL;
|
||||
}
|
||||
|
||||
if (size % 4 != 0)
|
||||
{
|
||||
LOG_E("write size must be 4-byte alignment");
|
||||
return -RT_EINVAL;
|
||||
}
|
||||
|
||||
if ((end_addr) > STM32_FLASH_END_ADDRESS)
|
||||
{
|
||||
LOG_E("write outrange flash size! addr is (0x%p)", (void *)(addr + size));
|
||||
|
|
|
@ -84,12 +84,6 @@ int stm32_flash_write(rt_uint32_t addr, const rt_uint8_t *buf, size_t size)
|
|||
return -RT_EINVAL;
|
||||
}
|
||||
|
||||
if (size % 4 != 0)
|
||||
{
|
||||
LOG_E("write size must be 4-byte alignment");
|
||||
return -RT_EINVAL;
|
||||
}
|
||||
|
||||
if ((end_addr) > STM32_FLASH_END_ADDRESS)
|
||||
{
|
||||
LOG_E("write outrange flash size! addr is (0x%p)", (void *)(addr + size));
|
||||
|
|
|
@ -140,12 +140,6 @@ int stm32_flash_write(rt_uint32_t addr, const uint8_t *buf, size_t size)
|
|||
return -RT_EINVAL;
|
||||
}
|
||||
|
||||
if(size % 8 != 0)
|
||||
{
|
||||
LOG_E("write size must be 8-byte alignment");
|
||||
return -RT_EINVAL;
|
||||
}
|
||||
|
||||
HAL_FLASH_Unlock();
|
||||
|
||||
__HAL_FLASH_CLEAR_FLAG(FLASH_FLAG_EOP | FLASH_FLAG_OPERR | FLASH_FLAG_WRPERR | FLASH_FLAG_PGAERR | FLASH_FLAG_PGSERR);
|
||||
|
|
Loading…
Reference in New Issue