File tree Expand file tree Collapse file tree 6 files changed +832
-151
lines changed
libraries/HAL_Drivers/drv_flash Expand file tree Collapse file tree 6 files changed +832
-151
lines changed Original file line number Diff line number Diff line change @@ -52,6 +52,7 @@ static rt_uint32_t GetSector(rt_uint32_t Address)
5252 {
5353 sector = FLASH_SECTOR_1 ;
5454 }
55+ #if (FLASH_SECTOR_TOTAL >= 4 )
5556 else if ((Address < ADDR_FLASH_SECTOR_3 ) && (Address >= ADDR_FLASH_SECTOR_2 ))
5657 {
5758 sector = FLASH_SECTOR_2 ;
@@ -60,6 +61,7 @@ static rt_uint32_t GetSector(rt_uint32_t Address)
6061 {
6162 sector = FLASH_SECTOR_3 ;
6263 }
64+ #elif (FLASH_SECTOR_TOTAL >= 8)
6365 else if ((Address < ADDR_FLASH_SECTOR_5 ) && (Address >= ADDR_FLASH_SECTOR_4 ))
6466 {
6567 sector = FLASH_SECTOR_4 ;
@@ -76,6 +78,7 @@ static rt_uint32_t GetSector(rt_uint32_t Address)
7678 {
7779 sector = FLASH_SECTOR_7 ;
7880 }
81+ #elif (FLASH_SECTOR_TOTAL >= 24)
7982 else if ((Address < ADDR_FLASH_SECTOR_9 ) && (Address >= ADDR_FLASH_SECTOR_8 ))
8083 {
8184 sector = FLASH_SECTOR_8 ;
@@ -88,10 +91,18 @@ static rt_uint32_t GetSector(rt_uint32_t Address)
8891 {
8992 sector = FLASH_SECTOR_10 ;
9093 }
91- else /* (Address < FLASH_END_ADDR) && (Address >= ADDR_FLASH_SECTOR_11) */
94+ #else
95+ else
9296 {
97+ #if (FLASH_SECTOR_TOTAL == 4 )
98+ sector = FLASH_SECTOR_4 ;
99+ #elif (FLASH_SECTOR_TOTAL == 8 )
100+ sector = FLASH_SECTOR_8 ;
101+ #elif (FLASH_SECTOR_TOTAL == 24 )
93102 sector = FLASH_SECTOR_11 ;
103+ #endif
94104 }
105+ #endif
95106 return sector ;
96107}
97108
Original file line number Diff line number Diff line change @@ -320,6 +320,7 @@ CONFIG_BSP_USING_GPIO=y
320320CONFIG_BSP_USING_UART=y
321321CONFIG_BSP_USING_UART1=y
322322# CONFIG_BSP_UART1_RX_USING_DMA is not set
323+ # CONFIG_BSP_USING_ON_CHIP_FLASH is not set
323324# CONFIG_BSP_USING_QSPI is not set
324325# CONFIG_BSP_USING_SDIO is not set
325326
Original file line number Diff line number Diff line change @@ -53,7 +53,7 @@ STM32F746-disco 是 ST 推出的一款基于 ARM Cortex-M7 内核的开发板,
5353| SPI | 暂不支持 | 即将支持 |
5454| QSPI | 支持 | QSPI1 |
5555| I2C | 暂不支持 | 即将支持 |
56- | FLASH | 暂不支持 | 即将支持 |
56+ | FLASH | 支持 | |
5757| WDT | 暂不支持 | 即将支持 |
5858| SDIO | 支持 | 支持 |
5959| USB Device | 暂不支持 | 即将支持 |
Original file line number Diff line number Diff line change @@ -61,6 +61,9 @@ menu "On-chip Peripheral Drivers"
6161 depends on BSP_USING_UART1 && RT_SERIAL_USING_DMA
6262 default n
6363 endif
64+ config BSP_USING_ON_CHIP_FLASH
65+ bool "Enable on-chip FLASH"
66+ default n
6467 config BSP_USING_QSPI
6568 bool "Enable QSPI BUS"
6669 select RT_USING_QSPI
You can’t perform that action at this time.
0 commit comments