调整 flash 驱动, 预备 iap bootloader

Signed-off-by: a1012112796 <1012112796@qq.com>
This commit is contained in:
2022-12-26 09:23:27 +08:00
parent 518f13b9cb
commit 0401a1f32f
3 changed files with 5 additions and 36 deletions

View File

@@ -361,37 +361,20 @@ __exit:
#if defined(RT_USING_FAL)
static int fal_flash_read_16k(long offset, rt_uint8_t *buf, size_t size);
static int fal_flash_read_64k(long offset, rt_uint8_t *buf, size_t size);
static int fal_flash_read_128k(long offset, rt_uint8_t *buf, size_t size);
static int fal_flash_write_16k(long offset, const rt_uint8_t *buf, size_t size);
static int fal_flash_write_64k(long offset, const rt_uint8_t *buf, size_t size);
static int fal_flash_write_128k(long offset, const rt_uint8_t *buf, size_t size);
static int fal_flash_erase_16k(long offset, size_t size);
static int fal_flash_erase_64k(long offset, size_t size);
static int fal_flash_erase_128k(long offset, size_t size);
const struct fal_flash_dev stm32_onchip_flash_16k =
{
"onchip_flash_16k",
STM32_FLASH_START_ADRESS_16K,
FLASH_SIZE_GRANULARITY_16K,
(16 * 1024),
{
NULL,
fal_flash_read_16k,
fal_flash_write_16k,
fal_flash_erase_16k,
},
8,
};
const struct fal_flash_dev stm32_onchip_flash_64k =
{
"onchip_flash_64k",
STM32_FLASH_START_ADRESS_64K,
FLASH_SIZE_GRANULARITY_64K,
STM32_FLASH_START_ADRESS_16K,
FLASH_SIZE_GRANULARITY_64K + FLASH_SIZE_GRANULARITY_16K,
(64 * 1024),
{
NULL,
@@ -416,10 +399,6 @@ const struct fal_flash_dev stm32_onchip_flash_128k =
8,
};
static int fal_flash_read_16k(long offset, rt_uint8_t *buf, size_t size)
{
return stm32_flash_read(stm32_onchip_flash_16k.addr + offset, buf, size);
}
static int fal_flash_read_64k(long offset, rt_uint8_t *buf, size_t size)
{
return stm32_flash_read(stm32_onchip_flash_64k.addr + offset, buf, size);
@@ -429,10 +408,6 @@ static int fal_flash_read_128k(long offset, rt_uint8_t *buf, size_t size)
return stm32_flash_read(stm32_onchip_flash_128k.addr + offset, buf, size);
}
static int fal_flash_write_16k(long offset, const rt_uint8_t *buf, size_t size)
{
return stm32_flash_write(stm32_onchip_flash_16k.addr + offset, buf, size);
}
static int fal_flash_write_64k(long offset, const rt_uint8_t *buf, size_t size)
{
return stm32_flash_write(stm32_onchip_flash_64k.addr + offset, buf, size);
@@ -442,10 +417,6 @@ static int fal_flash_write_128k(long offset, const rt_uint8_t *buf, size_t size)
return stm32_flash_write(stm32_onchip_flash_128k.addr + offset, buf, size);
}
static int fal_flash_erase_16k(long offset, size_t size)
{
return stm32_flash_erase(stm32_onchip_flash_16k.addr + offset, size);
}
static int fal_flash_erase_64k(long offset, size_t size)
{
return stm32_flash_erase(stm32_onchip_flash_64k.addr + offset, size);