Merge pull request #2288 from SummerGGift/add_stm32_new_framework
[bsp][stm32] optimize stm32 series BSP
This commit is contained in:
commit
aa1e41d04f
|
@ -327,9 +327,9 @@ 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_64k(long offset, size_t size);
|
||||||
static int fal_flash_erase_128k(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, FLASH_SIZE_GRANULARITY_16K, (16 * 1024), {NULL, fal_flash_read_16k, fal_flash_write_16k, fal_flash_erase_16k} };
|
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} };
|
||||||
const struct fal_flash_dev stm32_onchip_flash_64k = { "onchip_flash_64k", STM32_FLASH_START_ADRESS, FLASH_SIZE_GRANULARITY_64K, (64 * 1024), {NULL, fal_flash_read_64k, fal_flash_write_64k, fal_flash_erase_64k} };
|
const struct fal_flash_dev stm32_onchip_flash_64k = { "onchip_flash_64k", STM32_FLASH_START_ADRESS_64K, FLASH_SIZE_GRANULARITY_64K, (64 * 1024), {NULL, fal_flash_read_64k, fal_flash_write_64k, fal_flash_erase_64k} };
|
||||||
const struct fal_flash_dev stm32_onchip_flash_128k = { "onchip_flash_128k", STM32_FLASH_START_ADRESS, FLASH_SIZE_GRANULARITY_128K, (128 * 1024), {NULL, fal_flash_read_128k, fal_flash_write_128k, fal_flash_erase_128k} };
|
const struct fal_flash_dev stm32_onchip_flash_128k = { "onchip_flash_128k", STM32_FLASH_START_ADRESS_128K, FLASH_SIZE_GRANULARITY_128K, (128 * 1024), {NULL, fal_flash_read_128k, fal_flash_write_128k, fal_flash_erase_128k} };
|
||||||
|
|
||||||
static int fal_flash_read_16k(long offset, rt_uint8_t *buf, size_t size)
|
static int fal_flash_read_16k(long offset, rt_uint8_t *buf, size_t size)
|
||||||
{
|
{
|
||||||
|
|
|
@ -253,9 +253,9 @@ static int fal_flash_erase_32k(long offset, size_t size);
|
||||||
static int fal_flash_erase_128k(long offset, size_t size);
|
static int fal_flash_erase_128k(long offset, size_t size);
|
||||||
static int fal_flash_erase_256k(long offset, size_t size);
|
static int fal_flash_erase_256k(long offset, size_t size);
|
||||||
|
|
||||||
const struct fal_flash_dev stm32_onchip_flash_32k = { "onchip_flash_32k", STM32_FLASH_START_ADRESS, FLASH_SIZE_GRANULARITY_32K, (32 * 1024), {NULL, fal_flash_read_32k, fal_flash_write_32k, fal_flash_erase_32k} };
|
const struct fal_flash_dev stm32_onchip_flash_32k = { "onchip_flash_32k", STM32_FLASH_START_ADRESS_32K, FLASH_SIZE_GRANULARITY_32K, (32 * 1024), {NULL, fal_flash_read_32k, fal_flash_write_32k, fal_flash_erase_32k} };
|
||||||
const struct fal_flash_dev stm32_onchip_flash_128k = { "onchip_flash_128k", STM32_FLASH_START_ADRESS, FLASH_SIZE_GRANULARITY_128K, (128 * 1024), {NULL, fal_flash_read_128k, fal_flash_write_128k, fal_flash_erase_128k} };
|
const struct fal_flash_dev stm32_onchip_flash_128k = { "onchip_flash_128k", STM32_FLASH_START_ADRESS_128K, FLASH_SIZE_GRANULARITY_128K, (128 * 1024), {NULL, fal_flash_read_128k, fal_flash_write_128k, fal_flash_erase_128k} };
|
||||||
const struct fal_flash_dev stm32_onchip_flash_256k = { "onchip_flash_256k", STM32_FLASH_START_ADRESS, FLASH_SIZE_GRANULARITY_256K, (256 * 1024), {NULL, fal_flash_read_256k, fal_flash_write_256k, fal_flash_erase_256k} };
|
const struct fal_flash_dev stm32_onchip_flash_256k = { "onchip_flash_256k", STM32_FLASH_START_ADRESS_256K, FLASH_SIZE_GRANULARITY_256K, (256 * 1024), {NULL, fal_flash_read_256k, fal_flash_write_256k, fal_flash_erase_256k} };
|
||||||
|
|
||||||
static int fal_flash_read_32k(long offset, rt_uint8_t *buf, size_t size)
|
static int fal_flash_read_32k(long offset, rt_uint8_t *buf, size_t size)
|
||||||
{
|
{
|
||||||
|
|
|
@ -19,7 +19,7 @@ menu "Onboard Peripheral Drivers"
|
||||||
default n
|
default n
|
||||||
|
|
||||||
config BSP_USING_SPI_FLASH
|
config BSP_USING_SPI_FLASH
|
||||||
bool "Enable SPI FLASH (w25q16 spi2)"
|
bool "Enable SPI FLASH (W25Q16 spi2)"
|
||||||
select BSP_USING_SPI
|
select BSP_USING_SPI
|
||||||
select BSP_USING_SPI2
|
select BSP_USING_SPI2
|
||||||
select RT_USING_SFUD
|
select RT_USING_SFUD
|
||||||
|
|
|
@ -19,7 +19,7 @@ menu "Onboard Peripheral Drivers"
|
||||||
default n
|
default n
|
||||||
|
|
||||||
config BSP_USING_SPI_FLASH
|
config BSP_USING_SPI_FLASH
|
||||||
bool "Enable SPI FLASH (w25q64 spi1)"
|
bool "Enable SPI FLASH (W25Q64 spi1)"
|
||||||
select BSP_USING_SPI
|
select BSP_USING_SPI
|
||||||
select BSP_USING_SPI1
|
select BSP_USING_SPI1
|
||||||
select RT_USING_SFUD
|
select RT_USING_SFUD
|
||||||
|
|
|
@ -26,7 +26,7 @@ menu "Onboard Peripheral Drivers"
|
||||||
default n
|
default n
|
||||||
|
|
||||||
config BSP_USING_SPI_FLASH
|
config BSP_USING_SPI_FLASH
|
||||||
bool "Enable SPI FLASH (w25q128 spi1)"
|
bool "Enable SPI FLASH (W25Q128 spi1)"
|
||||||
select BSP_USING_SPI
|
select BSP_USING_SPI
|
||||||
select BSP_USING_SPI1
|
select BSP_USING_SPI1
|
||||||
select RT_USING_SFUD
|
select RT_USING_SFUD
|
||||||
|
|
|
@ -15,8 +15,12 @@
|
||||||
#include <board.h>
|
#include <board.h>
|
||||||
|
|
||||||
#define FLASH_SIZE_GRANULARITY_16K (4 * 16 * 1024)
|
#define FLASH_SIZE_GRANULARITY_16K (4 * 16 * 1024)
|
||||||
#define FLASH_SIZE_GRANULARITY_64K (FLASH_SIZE_GRANULARITY_16K + 64 * 1024)
|
#define FLASH_SIZE_GRANULARITY_64K (64 * 1024)
|
||||||
#define FLASH_SIZE_GRANULARITY_128K (FLASH_SIZE_GRANULARITY_64K + 7 * 128 * 1024)
|
#define FLASH_SIZE_GRANULARITY_128K (7 * 128 * 1024)
|
||||||
|
|
||||||
|
#define STM32_FLASH_START_ADRESS_16K STM32_FLASH_START_ADRESS
|
||||||
|
#define STM32_FLASH_START_ADRESS_64K (STM32_FLASH_START_ADRESS_16K + FLASH_SIZE_GRANULARITY_16K)
|
||||||
|
#define STM32_FLASH_START_ADRESS_128K (STM32_FLASH_START_ADRESS_64K + FLASH_SIZE_GRANULARITY_64K)
|
||||||
|
|
||||||
extern const struct fal_flash_dev stm32_onchip_flash_16k;
|
extern const struct fal_flash_dev stm32_onchip_flash_16k;
|
||||||
extern const struct fal_flash_dev stm32_onchip_flash_64k;
|
extern const struct fal_flash_dev stm32_onchip_flash_64k;
|
||||||
|
@ -35,9 +39,9 @@ extern const struct fal_flash_dev stm32_onchip_flash_128k;
|
||||||
/* partition table */
|
/* partition table */
|
||||||
#define FAL_PART_TABLE \
|
#define FAL_PART_TABLE \
|
||||||
{ \
|
{ \
|
||||||
{FAL_PART_MAGIC_WROD, "bootloader", "onchip_flash_16k", 0 , FLASH_SIZE_GRANULARITY_16K , 0}, \
|
{FAL_PART_MAGIC_WROD, "bootloader", "onchip_flash_16k", 0 , FLASH_SIZE_GRANULARITY_16K , 0}, \
|
||||||
{FAL_PART_MAGIC_WROD, "param", "onchip_flash_64k", FLASH_SIZE_GRANULARITY_16K , FLASH_SIZE_GRANULARITY_64K , 0}, \
|
{FAL_PART_MAGIC_WROD, "param", "onchip_flash_64k", 0 , FLASH_SIZE_GRANULARITY_64K , 0}, \
|
||||||
{FAL_PART_MAGIC_WROD, "app", "onchip_flash_128k", FLASH_SIZE_GRANULARITY_64K, FLASH_SIZE_GRANULARITY_128K, 0}, \
|
{FAL_PART_MAGIC_WROD, "app", "onchip_flash_128k", 0 , FLASH_SIZE_GRANULARITY_128K, 0}, \
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* FAL_PART_HAS_TABLE_CFG */
|
#endif /* FAL_PART_HAS_TABLE_CFG */
|
||||||
|
|
|
@ -24,7 +24,7 @@ menu "Onboard Peripheral Drivers"
|
||||||
default n
|
default n
|
||||||
|
|
||||||
config BSP_USING_SPI_FLASH
|
config BSP_USING_SPI_FLASH
|
||||||
bool "Enable SPI FLASH (w25q64 spi3)"
|
bool "Enable SPI FLASH (W25Q64 spi3)"
|
||||||
select BSP_USING_SPI
|
select BSP_USING_SPI
|
||||||
select BSP_USING_SPI3
|
select BSP_USING_SPI3
|
||||||
select RT_USING_SFUD
|
select RT_USING_SFUD
|
||||||
|
|
|
@ -15,8 +15,12 @@
|
||||||
#include <board.h>
|
#include <board.h>
|
||||||
|
|
||||||
#define FLASH_SIZE_GRANULARITY_16K (4 * 16 * 1024)
|
#define FLASH_SIZE_GRANULARITY_16K (4 * 16 * 1024)
|
||||||
#define FLASH_SIZE_GRANULARITY_64K (FLASH_SIZE_GRANULARITY_16K + 64 * 1024)
|
#define FLASH_SIZE_GRANULARITY_64K (64 * 1024)
|
||||||
#define FLASH_SIZE_GRANULARITY_128K (FLASH_SIZE_GRANULARITY_64K + 7 * 128 * 1024)
|
#define FLASH_SIZE_GRANULARITY_128K (7 * 128 * 1024)
|
||||||
|
|
||||||
|
#define STM32_FLASH_START_ADRESS_16K STM32_FLASH_START_ADRESS
|
||||||
|
#define STM32_FLASH_START_ADRESS_64K (STM32_FLASH_START_ADRESS_16K + FLASH_SIZE_GRANULARITY_16K)
|
||||||
|
#define STM32_FLASH_START_ADRESS_128K (STM32_FLASH_START_ADRESS_64K + FLASH_SIZE_GRANULARITY_64K)
|
||||||
|
|
||||||
extern const struct fal_flash_dev stm32_onchip_flash_16k;
|
extern const struct fal_flash_dev stm32_onchip_flash_16k;
|
||||||
extern const struct fal_flash_dev stm32_onchip_flash_64k;
|
extern const struct fal_flash_dev stm32_onchip_flash_64k;
|
||||||
|
@ -35,9 +39,9 @@ extern const struct fal_flash_dev stm32_onchip_flash_128k;
|
||||||
/* partition table */
|
/* partition table */
|
||||||
#define FAL_PART_TABLE \
|
#define FAL_PART_TABLE \
|
||||||
{ \
|
{ \
|
||||||
{FAL_PART_MAGIC_WROD, "bootloader", "onchip_flash_16k", 0 , FLASH_SIZE_GRANULARITY_16K , 0}, \
|
{FAL_PART_MAGIC_WROD, "bootloader", "onchip_flash_16k", 0 , FLASH_SIZE_GRANULARITY_16K , 0}, \
|
||||||
{FAL_PART_MAGIC_WROD, "param", "onchip_flash_64k", FLASH_SIZE_GRANULARITY_16K , FLASH_SIZE_GRANULARITY_64K , 0}, \
|
{FAL_PART_MAGIC_WROD, "param", "onchip_flash_64k", 0 , FLASH_SIZE_GRANULARITY_64K , 0}, \
|
||||||
{FAL_PART_MAGIC_WROD, "app", "onchip_flash_128k", FLASH_SIZE_GRANULARITY_64K, FLASH_SIZE_GRANULARITY_128K, 0}, \
|
{FAL_PART_MAGIC_WROD, "app", "onchip_flash_128k", 0 , FLASH_SIZE_GRANULARITY_128K, 0}, \
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* FAL_PART_HAS_TABLE_CFG */
|
#endif /* FAL_PART_HAS_TABLE_CFG */
|
||||||
|
|
|
@ -30,7 +30,7 @@ menu "Onboard Peripheral Drivers"
|
||||||
default n
|
default n
|
||||||
|
|
||||||
config BSP_USING_SPI_FLASH
|
config BSP_USING_SPI_FLASH
|
||||||
bool "Enable SPI FLASH (w25q256 spi5)"
|
bool "Enable SPI FLASH (W25Q256 spi5)"
|
||||||
select BSP_USING_SPI
|
select BSP_USING_SPI
|
||||||
select BSP_USING_SPI5
|
select BSP_USING_SPI5
|
||||||
select RT_USING_SFUD
|
select RT_USING_SFUD
|
||||||
|
|
|
@ -15,8 +15,12 @@
|
||||||
#include <board.h>
|
#include <board.h>
|
||||||
|
|
||||||
#define FLASH_SIZE_GRANULARITY_16K (4 * 16 * 1024)
|
#define FLASH_SIZE_GRANULARITY_16K (4 * 16 * 1024)
|
||||||
#define FLASH_SIZE_GRANULARITY_64K (FLASH_SIZE_GRANULARITY_16K + 64 * 1024)
|
#define FLASH_SIZE_GRANULARITY_64K (64 * 1024)
|
||||||
#define FLASH_SIZE_GRANULARITY_128K (FLASH_SIZE_GRANULARITY_64K + 7 * 128 * 1024)
|
#define FLASH_SIZE_GRANULARITY_128K (7 * 128 * 1024)
|
||||||
|
|
||||||
|
#define STM32_FLASH_START_ADRESS_16K STM32_FLASH_START_ADRESS
|
||||||
|
#define STM32_FLASH_START_ADRESS_64K (STM32_FLASH_START_ADRESS_16K + FLASH_SIZE_GRANULARITY_16K)
|
||||||
|
#define STM32_FLASH_START_ADRESS_128K (STM32_FLASH_START_ADRESS_64K + FLASH_SIZE_GRANULARITY_64K)
|
||||||
|
|
||||||
extern const struct fal_flash_dev stm32_onchip_flash_16k;
|
extern const struct fal_flash_dev stm32_onchip_flash_16k;
|
||||||
extern const struct fal_flash_dev stm32_onchip_flash_64k;
|
extern const struct fal_flash_dev stm32_onchip_flash_64k;
|
||||||
|
@ -35,9 +39,9 @@ extern const struct fal_flash_dev stm32_onchip_flash_128k;
|
||||||
/* partition table */
|
/* partition table */
|
||||||
#define FAL_PART_TABLE \
|
#define FAL_PART_TABLE \
|
||||||
{ \
|
{ \
|
||||||
{FAL_PART_MAGIC_WROD, "bootloader", "onchip_flash_16k", 0 , FLASH_SIZE_GRANULARITY_16K , 0}, \
|
{FAL_PART_MAGIC_WROD, "bootloader", "onchip_flash_16k", 0 , FLASH_SIZE_GRANULARITY_16K , 0}, \
|
||||||
{FAL_PART_MAGIC_WROD, "param", "onchip_flash_64k", FLASH_SIZE_GRANULARITY_16K , FLASH_SIZE_GRANULARITY_64K , 0}, \
|
{FAL_PART_MAGIC_WROD, "param", "onchip_flash_64k", 0 , FLASH_SIZE_GRANULARITY_64K , 0}, \
|
||||||
{FAL_PART_MAGIC_WROD, "app", "onchip_flash_128k", FLASH_SIZE_GRANULARITY_64K, FLASH_SIZE_GRANULARITY_128K, 0}, \
|
{FAL_PART_MAGIC_WROD, "app", "onchip_flash_128k", 0 , FLASH_SIZE_GRANULARITY_128K, 0}, \
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* FAL_PART_HAS_TABLE_CFG */
|
#endif /* FAL_PART_HAS_TABLE_CFG */
|
||||||
|
|
|
@ -25,7 +25,7 @@ menu "Onboard Peripheral Drivers"
|
||||||
default n
|
default n
|
||||||
|
|
||||||
config BSP_USING_SPI_FLASH
|
config BSP_USING_SPI_FLASH
|
||||||
bool "Enable SPI FLASH (w25q256 spi5)"
|
bool "Enable SPI FLASH (W25Q128 spi5)"
|
||||||
select BSP_USING_SPI
|
select BSP_USING_SPI
|
||||||
select BSP_USING_SPI5
|
select BSP_USING_SPI5
|
||||||
select RT_USING_SFUD
|
select RT_USING_SFUD
|
||||||
|
|
|
@ -15,8 +15,12 @@
|
||||||
#include <board.h>
|
#include <board.h>
|
||||||
|
|
||||||
#define FLASH_SIZE_GRANULARITY_16K (4 * 16 * 1024)
|
#define FLASH_SIZE_GRANULARITY_16K (4 * 16 * 1024)
|
||||||
#define FLASH_SIZE_GRANULARITY_64K (FLASH_SIZE_GRANULARITY_16K + 64 * 1024)
|
#define FLASH_SIZE_GRANULARITY_64K (64 * 1024)
|
||||||
#define FLASH_SIZE_GRANULARITY_128K (FLASH_SIZE_GRANULARITY_64K + 7 * 128 * 1024)
|
#define FLASH_SIZE_GRANULARITY_128K (7 * 128 * 1024)
|
||||||
|
|
||||||
|
#define STM32_FLASH_START_ADRESS_16K STM32_FLASH_START_ADRESS
|
||||||
|
#define STM32_FLASH_START_ADRESS_64K (STM32_FLASH_START_ADRESS_16K + FLASH_SIZE_GRANULARITY_16K)
|
||||||
|
#define STM32_FLASH_START_ADRESS_128K (STM32_FLASH_START_ADRESS_64K + FLASH_SIZE_GRANULARITY_64K)
|
||||||
|
|
||||||
extern const struct fal_flash_dev stm32_onchip_flash_16k;
|
extern const struct fal_flash_dev stm32_onchip_flash_16k;
|
||||||
extern const struct fal_flash_dev stm32_onchip_flash_64k;
|
extern const struct fal_flash_dev stm32_onchip_flash_64k;
|
||||||
|
@ -35,9 +39,9 @@ extern const struct fal_flash_dev stm32_onchip_flash_128k;
|
||||||
/* partition table */
|
/* partition table */
|
||||||
#define FAL_PART_TABLE \
|
#define FAL_PART_TABLE \
|
||||||
{ \
|
{ \
|
||||||
{FAL_PART_MAGIC_WROD, "bootloader", "onchip_flash_16k", 0 , FLASH_SIZE_GRANULARITY_16K , 0}, \
|
{FAL_PART_MAGIC_WROD, "bootloader", "onchip_flash_16k", 0 , FLASH_SIZE_GRANULARITY_16K , 0}, \
|
||||||
{FAL_PART_MAGIC_WROD, "app", "onchip_flash_64k", FLASH_SIZE_GRANULARITY_16K , FLASH_SIZE_GRANULARITY_64K , 0}, \
|
{FAL_PART_MAGIC_WROD, "param", "onchip_flash_64k", 0 , FLASH_SIZE_GRANULARITY_64K , 0}, \
|
||||||
{FAL_PART_MAGIC_WROD, "download", "onchip_flash_128k", FLASH_SIZE_GRANULARITY_64K, FLASH_SIZE_GRANULARITY_128K, 0}, \
|
{FAL_PART_MAGIC_WROD, "app", "onchip_flash_128k", 0 , FLASH_SIZE_GRANULARITY_128K, 0}, \
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* FAL_PART_HAS_TABLE_CFG */
|
#endif /* FAL_PART_HAS_TABLE_CFG */
|
||||||
|
|
|
@ -24,7 +24,7 @@ menu "Onboard Peripheral Drivers"
|
||||||
default n
|
default n
|
||||||
|
|
||||||
config BSP_USING_QSPI_FLASH
|
config BSP_USING_QSPI_FLASH
|
||||||
bool "Enable QSPI FLASH (W25Q256 qspi)"
|
bool "Enable QSPI FLASH (w25q128 qspi)"
|
||||||
select BSP_USING_QSPI
|
select BSP_USING_QSPI
|
||||||
select RT_USING_SFUD
|
select RT_USING_SFUD
|
||||||
select RT_SFUD_USING_QSPI
|
select RT_SFUD_USING_QSPI
|
||||||
|
|
|
@ -65,7 +65,7 @@ static int rt_hw_qspi_flash_with_sfud_init(void)
|
||||||
stm32_qspi_bus_attach_device("qspi1", "qspi10", RT_NULL, 4, w25qxx_enter_qspi_mode, RT_NULL);
|
stm32_qspi_bus_attach_device("qspi1", "qspi10", RT_NULL, 4, w25qxx_enter_qspi_mode, RT_NULL);
|
||||||
|
|
||||||
/* init w25q128 */
|
/* init w25q128 */
|
||||||
if (RT_NULL == rt_sfud_flash_probe("w25q128", "qspi10"))
|
if (RT_NULL == rt_sfud_flash_probe("W25Q128", "qspi10"))
|
||||||
{
|
{
|
||||||
return -RT_ERROR;
|
return -RT_ERROR;
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,8 +15,12 @@
|
||||||
#include <board.h>
|
#include <board.h>
|
||||||
|
|
||||||
#define FLASH_SIZE_GRANULARITY_32K (4 * 32 * 1024)
|
#define FLASH_SIZE_GRANULARITY_32K (4 * 32 * 1024)
|
||||||
#define FLASH_SIZE_GRANULARITY_128K (FLASH_SIZE_GRANULARITY_32K + 128 * 1024)
|
#define FLASH_SIZE_GRANULARITY_128K (128 * 1024)
|
||||||
#define FLASH_SIZE_GRANULARITY_256K (FLASH_SIZE_GRANULARITY_128K + 3 * 256 * 1024)
|
#define FLASH_SIZE_GRANULARITY_256K (3 * 256 * 1024)
|
||||||
|
|
||||||
|
#define STM32_FLASH_START_ADRESS_32K STM32_FLASH_START_ADRESS
|
||||||
|
#define STM32_FLASH_START_ADRESS_128K (STM32_FLASH_START_ADRESS_32K + FLASH_SIZE_GRANULARITY_32K)
|
||||||
|
#define STM32_FLASH_START_ADRESS_256K (STM32_FLASH_START_ADRESS_128K + FLASH_SIZE_GRANULARITY_128K)
|
||||||
|
|
||||||
extern const struct fal_flash_dev stm32_onchip_flash_32k;
|
extern const struct fal_flash_dev stm32_onchip_flash_32k;
|
||||||
extern const struct fal_flash_dev stm32_onchip_flash_128k;
|
extern const struct fal_flash_dev stm32_onchip_flash_128k;
|
||||||
|
@ -35,9 +39,9 @@ extern const struct fal_flash_dev stm32_onchip_flash_256k;
|
||||||
/* partition table */
|
/* partition table */
|
||||||
#define FAL_PART_TABLE \
|
#define FAL_PART_TABLE \
|
||||||
{ \
|
{ \
|
||||||
{FAL_PART_MAGIC_WROD, "bootloader", "onchip_flash_32k", 0 , FLASH_SIZE_GRANULARITY_32K , 0}, \
|
{FAL_PART_MAGIC_WROD, "bootloader", "onchip_flash_32k", 0 , FLASH_SIZE_GRANULARITY_32K , 0}, \
|
||||||
{FAL_PART_MAGIC_WROD, "param", "onchip_flash_128k", FLASH_SIZE_GRANULARITY_32K , FLASH_SIZE_GRANULARITY_128K, 0}, \
|
{FAL_PART_MAGIC_WROD, "param", "onchip_flash_128k", 0 , FLASH_SIZE_GRANULARITY_128K, 0}, \
|
||||||
{FAL_PART_MAGIC_WROD, "app", "onchip_flash_256k", FLASH_SIZE_GRANULARITY_128K, FLASH_SIZE_GRANULARITY_256K, 0}, \
|
{FAL_PART_MAGIC_WROD, "app", "onchip_flash_256k", 0 , FLASH_SIZE_GRANULARITY_256K, 0}, \
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* FAL_PART_HAS_TABLE_CFG */
|
#endif /* FAL_PART_HAS_TABLE_CFG */
|
||||||
|
|
|
@ -65,7 +65,7 @@ static int rt_hw_qspi_flash_with_sfud_init(void)
|
||||||
stm32_qspi_bus_attach_device("qspi1", "qspi10", RT_NULL, 4, w25qxx_enter_qspi_mode, RT_NULL);
|
stm32_qspi_bus_attach_device("qspi1", "qspi10", RT_NULL, 4, w25qxx_enter_qspi_mode, RT_NULL);
|
||||||
|
|
||||||
/* init w25q128 */
|
/* init w25q128 */
|
||||||
if (RT_NULL == rt_sfud_flash_probe("w25q128", "qspi10"))
|
if (RT_NULL == rt_sfud_flash_probe("W25Q128", "qspi10"))
|
||||||
{
|
{
|
||||||
return -RT_ERROR;
|
return -RT_ERROR;
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,8 +15,12 @@
|
||||||
#include <board.h>
|
#include <board.h>
|
||||||
|
|
||||||
#define FLASH_SIZE_GRANULARITY_32K (4 * 32 * 1024)
|
#define FLASH_SIZE_GRANULARITY_32K (4 * 32 * 1024)
|
||||||
#define FLASH_SIZE_GRANULARITY_128K (FLASH_SIZE_GRANULARITY_32K + 128 * 1024)
|
#define FLASH_SIZE_GRANULARITY_128K (128 * 1024)
|
||||||
#define FLASH_SIZE_GRANULARITY_256K (FLASH_SIZE_GRANULARITY_128K + 3 * 256 * 1024)
|
#define FLASH_SIZE_GRANULARITY_256K (3 * 256 * 1024)
|
||||||
|
|
||||||
|
#define STM32_FLASH_START_ADRESS_32K STM32_FLASH_START_ADRESS
|
||||||
|
#define STM32_FLASH_START_ADRESS_128K (STM32_FLASH_START_ADRESS_32K + FLASH_SIZE_GRANULARITY_32K)
|
||||||
|
#define STM32_FLASH_START_ADRESS_256K (STM32_FLASH_START_ADRESS_128K + FLASH_SIZE_GRANULARITY_128K)
|
||||||
|
|
||||||
extern const struct fal_flash_dev stm32_onchip_flash_32k;
|
extern const struct fal_flash_dev stm32_onchip_flash_32k;
|
||||||
extern const struct fal_flash_dev stm32_onchip_flash_128k;
|
extern const struct fal_flash_dev stm32_onchip_flash_128k;
|
||||||
|
@ -35,9 +39,9 @@ extern const struct fal_flash_dev stm32_onchip_flash_256k;
|
||||||
/* partition table */
|
/* partition table */
|
||||||
#define FAL_PART_TABLE \
|
#define FAL_PART_TABLE \
|
||||||
{ \
|
{ \
|
||||||
{FAL_PART_MAGIC_WROD, "bootloader", "onchip_flash_32k", 0 , FLASH_SIZE_GRANULARITY_32K , 0}, \
|
{FAL_PART_MAGIC_WROD, "bootloader", "onchip_flash_32k", 0 , FLASH_SIZE_GRANULARITY_32K , 0}, \
|
||||||
{FAL_PART_MAGIC_WROD, "param", "onchip_flash_128k", FLASH_SIZE_GRANULARITY_32K , FLASH_SIZE_GRANULARITY_128K, 0}, \
|
{FAL_PART_MAGIC_WROD, "param", "onchip_flash_128k", 0 , FLASH_SIZE_GRANULARITY_128K, 0}, \
|
||||||
{FAL_PART_MAGIC_WROD, "app", "onchip_flash_256k", FLASH_SIZE_GRANULARITY_128K, FLASH_SIZE_GRANULARITY_256K, 0}, \
|
{FAL_PART_MAGIC_WROD, "app", "onchip_flash_256k", 0 , FLASH_SIZE_GRANULARITY_256K, 0}, \
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* FAL_PART_HAS_TABLE_CFG */
|
#endif /* FAL_PART_HAS_TABLE_CFG */
|
||||||
|
|
|
@ -14,7 +14,7 @@ menu "Onboard Peripheral Drivers"
|
||||||
default y
|
default y
|
||||||
|
|
||||||
config BSP_USING_QSPI_FLASH
|
config BSP_USING_QSPI_FLASH
|
||||||
bool "Enable QSPI FLASH"
|
bool "Enable QSPI FLASH (W25Q128 qspi1)"
|
||||||
select BSP_USING_QSPI
|
select BSP_USING_QSPI
|
||||||
select RT_USING_SFUD
|
select RT_USING_SFUD
|
||||||
select RT_SFUD_USING_QSPI
|
select RT_SFUD_USING_QSPI
|
||||||
|
|
|
@ -65,7 +65,7 @@ static int rt_hw_qspi_flash_with_sfud_init(void)
|
||||||
stm32_qspi_bus_attach_device("qspi1", "qspi10", RT_NULL, 4, w25qxx_enter_qspi_mode, RT_NULL);
|
stm32_qspi_bus_attach_device("qspi1", "qspi10", RT_NULL, 4, w25qxx_enter_qspi_mode, RT_NULL);
|
||||||
|
|
||||||
/* init w25q128 */
|
/* init w25q128 */
|
||||||
if (RT_NULL == rt_sfud_flash_probe("w25q128", "qspi10"))
|
if (RT_NULL == rt_sfud_flash_probe("W25Q128", "qspi10"))
|
||||||
{
|
{
|
||||||
return -RT_ERROR;
|
return -RT_ERROR;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue