From e1c612bf0ac7d912c4fcaa431842acf784c4f467 Mon Sep 17 00:00:00 2001 From: armink Date: Sat, 14 Jul 2018 21:01:38 +0800 Subject: [PATCH] [DeviceDriver][sfud] Fix block erase 0 byte issue when start address is equal end address. --- components/drivers/spi/spi_flash_sfud.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/components/drivers/spi/spi_flash_sfud.c b/components/drivers/spi/spi_flash_sfud.c index 94b9afc9b..5d5da858f 100644 --- a/components/drivers/spi/spi_flash_sfud.c +++ b/components/drivers/spi/spi_flash_sfud.c @@ -76,6 +76,10 @@ static rt_err_t rt_sfud_control(rt_device_t dev, int cmd, void *args) { return -RT_ERROR; } + if (end_addr == start_addr) { + end_addr ++; + } + phy_start_addr = start_addr * rtt_dev->geometry.bytes_per_sector; phy_size = (end_addr - start_addr) * rtt_dev->geometry.bytes_per_sector;