Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
wwsmg1
rt-thread
提交
710f82d4
R
rt-thread
项目概览
wwsmg1
/
rt-thread
与 Fork 源项目一致
Fork自
RT-Thread / rt-thread
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
rt-thread
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
710f82d4
编写于
12月 28, 2018
作者:
S
SummerGift
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[bsp][stm32] optimize falsh && eth driver
上级
d43facef
变更
15
隐藏空白更改
内联
并排
Showing
15 changed file
with
347 addition
and
185 deletion
+347
-185
bsp/stm32/libraries/HAL_Drivers/drv_eth.c
bsp/stm32/libraries/HAL_Drivers/drv_eth.c
+15
-15
bsp/stm32/libraries/HAL_Drivers/drv_eth.h
bsp/stm32/libraries/HAL_Drivers/drv_eth.h
+8
-0
bsp/stm32/libraries/HAL_Drivers/drv_flash/drv_flash.h
bsp/stm32/libraries/HAL_Drivers/drv_flash/drv_flash.h
+3
-3
bsp/stm32/libraries/HAL_Drivers/drv_flash/drv_flash_f0.c
bsp/stm32/libraries/HAL_Drivers/drv_flash/drv_flash_f0.c
+25
-7
bsp/stm32/libraries/HAL_Drivers/drv_flash/drv_flash_f1.c
bsp/stm32/libraries/HAL_Drivers/drv_flash/drv_flash_f1.c
+25
-7
bsp/stm32/libraries/HAL_Drivers/drv_flash/drv_flash_f4.c
bsp/stm32/libraries/HAL_Drivers/drv_flash/drv_flash_f4.c
+59
-7
bsp/stm32/libraries/HAL_Drivers/drv_flash/drv_flash_f7.c
bsp/stm32/libraries/HAL_Drivers/drv_flash/drv_flash_f7.c
+89
-101
bsp/stm32/libraries/HAL_Drivers/drv_flash/drv_flash_l4.c
bsp/stm32/libraries/HAL_Drivers/drv_flash/drv_flash_l4.c
+25
-7
bsp/stm32/stm32f407-atk-explorer/board/ports/fal_cfg.h
bsp/stm32/stm32f407-atk-explorer/board/ports/fal_cfg.h
+16
-6
bsp/stm32/stm32f429-armfly-v6/board/Kconfig
bsp/stm32/stm32f429-armfly-v6/board/Kconfig
+2
-2
bsp/stm32/stm32f429-armfly-v6/board/ports/fal_cfg.h
bsp/stm32/stm32f429-armfly-v6/board/ports/fal_cfg.h
+16
-6
bsp/stm32/stm32f429-atk-apollo/board/ports/fal_cfg.h
bsp/stm32/stm32f429-atk-apollo/board/ports/fal_cfg.h
+16
-6
bsp/stm32/stm32f429-fire-challenger/board/ports/fal_cfg.h
bsp/stm32/stm32f429-fire-challenger/board/ports/fal_cfg.h
+16
-6
bsp/stm32/stm32f767-atk-apollo/board/ports/fal_cfg.h
bsp/stm32/stm32f767-atk-apollo/board/ports/fal_cfg.h
+16
-6
bsp/stm32/stm32f767-fire-challenger/board/ports/fal_cfg.h
bsp/stm32/stm32f767-fire-challenger/board/ports/fal_cfg.h
+16
-6
未找到文件。
bsp/stm32/libraries/HAL_Drivers/drv_eth.c
浏览文件 @
710f82d4
...
...
@@ -86,7 +86,7 @@ static rt_err_t rt_stm32_eth_init(rt_device_t dev)
/* ETHERNET Configuration */
EthHandle
.
Instance
=
ETH
;
EthHandle
.
Init
.
MACAddr
=
(
rt_uint8_t
*
)
&
stm32_eth_device
.
dev_addr
[
0
];
EthHandle
.
Init
.
AutoNegotiation
=
ETH_AUTONEGOTIATION_
EN
ABLE
;
EthHandle
.
Init
.
AutoNegotiation
=
ETH_AUTONEGOTIATION_
DIS
ABLE
;
EthHandle
.
Init
.
Speed
=
ETH_SPEED_100M
;
EthHandle
.
Init
.
DuplexMode
=
ETH_MODE_FULLDUPLEX
;
EthHandle
.
Init
.
MediaInterface
=
ETH_MEDIA_INTERFACE_RMII
;
...
...
@@ -96,9 +96,16 @@ static rt_err_t rt_stm32_eth_init(rt_device_t dev)
HAL_ETH_DeInit
(
&
EthHandle
);
/* configure ethernet peripheral (GPIOs, clocks, MAC, DMA) */
HAL_ETH_Init
(
&
EthHandle
);
LOG_D
(
"eth hardware init finished"
);
if
(
HAL_ETH_Init
(
&
EthHandle
)
!=
HAL_OK
)
{
LOG_E
(
"eth hardware init failed"
);
return
-
RT_ERROR
;
}
else
{
LOG_D
(
"eth hardware init success"
);
}
/* Initialize Tx Descriptors list: Chain Mode */
HAL_ETH_DMATxDescListInit
(
&
EthHandle
,
DMATxDscrTab
,
Tx_Buff
,
ETH_TXBUFNB
);
...
...
@@ -252,7 +259,6 @@ rt_err_t rt_stm32_eth_tx(rt_device_t dev, struct pbuf *p)
/* Prepare transmit descriptors to give to DMA */
/* TODO Optimize data send speed*/
LOG_D
(
"transmit frame lenth :%d"
,
framelength
);
rt_thread_mdelay
(
1
);
state
=
HAL_ETH_TransmitFrame
(
&
EthHandle
,
framelength
);
if
(
state
!=
HAL_OK
)
...
...
@@ -420,7 +426,7 @@ static void phy_monitor_thread_entry(void *parameter)
HAL_ETH_ReadPHYRegister
(
&
EthHandle
,
PHY_ID1_REG
,
(
uint32_t
*
)
&
temp
);
if
(
temp
!=
0xFFFF
)
if
(
temp
!=
0xFFFF
&&
temp
!=
0x00
)
{
phy_addr
=
i
;
break
;
...
...
@@ -503,15 +509,9 @@ static void phy_monitor_thread_entry(void *parameter)
stm32_eth_device
.
ETH_Mode
=
ETH_MODE_HALFDUPLEX
;
}
if
(
rt_stm32_eth_init
((
rt_device_t
)
&
stm32_eth_device
)
!=
RT_EOK
)
{
break
;
}
else
{
/* send link up. */
eth_device_linkchange
(
&
stm32_eth_device
.
parent
,
RT_TRUE
);
}
/* send link up. */
eth_device_linkchange
(
&
stm32_eth_device
.
parent
,
RT_TRUE
);
}
/* link up. */
else
{
...
...
bsp/stm32/libraries/HAL_Drivers/drv_eth.h
浏览文件 @
710f82d4
...
...
@@ -50,4 +50,12 @@
#define PHY_FULL_DUPLEX_MASK (1<<4)
#endif
/* PHY_USING_LAN8720A */
#ifdef PHY_USING_DM9161CEP
#define PHY_Status_REG 0x11U
#define PHY_10M_MASK ((1<<12) || (1<<13))
#define PHY_100M_MASK ((1<<14) || (1<<15))
#define PHY_FULL_DUPLEX_MASK ((1<<15) || (1<<13))
#endif
/* PHY_USING_DM9161CEP */
#endif
/* __DRV_ETH_H__ */
bsp/stm32/libraries/HAL_Drivers/drv_flash/drv_flash.h
浏览文件 @
710f82d4
...
...
@@ -16,8 +16,8 @@
#include <rthw.h>
#include <drv_common.h>
int
stm32_flash_read
(
long
offset
,
rt_uint8_t
*
buf
,
size_t
size
);
int
stm32_flash_write
(
long
offset
,
const
rt_uint8_t
*
buf
,
size_t
size
);
int
stm32_flash_erase
(
long
offset
,
size_t
size
);
int
stm32_flash_read
(
rt_uint32_t
addr
,
rt_uint8_t
*
buf
,
size_t
size
);
int
stm32_flash_write
(
rt_uint32_t
addr
,
const
rt_uint8_t
*
buf
,
size_t
size
);
int
stm32_flash_erase
(
rt_uint32_t
addr
,
size_t
size
);
#endif
/* __DRV_FLASH_H__ */
bsp/stm32/libraries/HAL_Drivers/drv_flash/drv_flash_f0.c
浏览文件 @
710f82d4
...
...
@@ -44,10 +44,9 @@ static uint32_t GetPage(uint32_t addr)
*
* @return result
*/
int
stm32_flash_read
(
long
offset
,
rt_uint8_t
*
buf
,
size_t
size
)
int
stm32_flash_read
(
rt_uint32_t
addr
,
rt_uint8_t
*
buf
,
size_t
size
)
{
size_t
i
;
rt_uint32_t
addr
=
STM32_FLASH_START_ADRESS
+
offset
;
if
((
addr
+
size
)
>
STM32_FLASH_END_ADDRESS
)
{
...
...
@@ -74,10 +73,9 @@ int stm32_flash_read(long offset, rt_uint8_t *buf, size_t size)
*
* @return result
*/
int
stm32_flash_write
(
long
offset
,
const
rt_uint8_t
*
buf
,
size_t
size
)
int
stm32_flash_write
(
rt_uint32_t
addr
,
const
rt_uint8_t
*
buf
,
size_t
size
)
{
rt_err_t
result
=
RT_EOK
;
rt_uint32_t
addr
=
STM32_FLASH_START_ADRESS
+
offset
;
rt_uint32_t
end_addr
=
addr
+
size
;
if
(
addr
%
4
!=
0
)
...
...
@@ -139,10 +137,9 @@ int stm32_flash_write(long offset, const rt_uint8_t *buf, size_t size)
*
* @return result
*/
int
stm32_flash_erase
(
long
offset
,
size_t
size
)
int
stm32_flash_erase
(
rt_uint32_t
addr
,
size_t
size
)
{
rt_err_t
result
=
RT_EOK
;
rt_uint32_t
addr
=
STM32_FLASH_START_ADRESS
+
offset
;
uint32_t
PAGEError
=
0
;
/*Variable used for Erase procedure*/
...
...
@@ -180,6 +177,27 @@ __exit:
}
#if defined(PKG_USING_FAL)
const
struct
fal_flash_dev
stm32_onchip_flash
=
{
"onchip_flash"
,
STM32_FLASH_START_ADRESS
,
STM32_FLASH_SIZE
,
FLASH_PAGE_SIZE
,
{
NULL
,
stm32_flash_read
,
stm32_flash_write
,
stm32_flash_erase
}
};
static
int
fal_flash_read
(
long
offset
,
rt_uint8_t
*
buf
,
size_t
size
);
static
int
fal_flash_write
(
long
offset
,
const
rt_uint8_t
*
buf
,
size_t
size
);
static
int
fal_flash_erase
(
long
offset
,
size_t
size
);
const
struct
fal_flash_dev
stm32_onchip_flash
=
{
"onchip_flash"
,
STM32_FLASH_START_ADRESS
,
STM32_FLASH_SIZE
,
FLASH_PAGE_SIZE
,
{
NULL
,
fal_flash_read
,
fal_flash_write
,
fal_flash_erase
}
};
static
int
fal_flash_read
(
long
offset
,
rt_uint8_t
*
buf
,
size_t
size
)
{
return
stm32_flash_read
(
stm32_onchip_flash
.
addr
+
offset
,
buf
,
size
);
}
static
int
fal_flash_write
(
long
offset
,
const
rt_uint8_t
*
buf
,
size_t
size
)
{
return
stm32_flash_write
(
stm32_onchip_flash
.
addr
+
offset
,
buf
,
size
);
}
static
int
fal_flash_erase
(
long
offset
,
size_t
size
)
{
return
stm32_flash_erase
(
stm32_onchip_flash
.
addr
+
offset
,
size
);
}
#endif
#endif
/* BSP_USING_ON_CHIP_FLASH */
bsp/stm32/libraries/HAL_Drivers/drv_flash/drv_flash_f1.c
浏览文件 @
710f82d4
...
...
@@ -44,10 +44,9 @@ static uint32_t GetPage(uint32_t addr)
*
* @return result
*/
int
stm32_flash_read
(
long
offset
,
rt_uint8_t
*
buf
,
size_t
size
)
int
stm32_flash_read
(
rt_uint32_t
addr
,
rt_uint8_t
*
buf
,
size_t
size
)
{
size_t
i
;
rt_uint32_t
addr
=
STM32_FLASH_START_ADRESS
+
offset
;
if
((
addr
+
size
)
>
STM32_FLASH_END_ADDRESS
)
{
...
...
@@ -74,10 +73,9 @@ int stm32_flash_read(long offset, rt_uint8_t *buf, size_t size)
*
* @return result
*/
int
stm32_flash_write
(
long
offset
,
const
rt_uint8_t
*
buf
,
size_t
size
)
int
stm32_flash_write
(
rt_uint32_t
addr
,
const
rt_uint8_t
*
buf
,
size_t
size
)
{
rt_err_t
result
=
RT_EOK
;
rt_uint32_t
addr
=
STM32_FLASH_START_ADRESS
+
offset
;
rt_uint32_t
end_addr
=
addr
+
size
;
if
(
addr
%
4
!=
0
)
...
...
@@ -139,10 +137,9 @@ int stm32_flash_write(long offset, const rt_uint8_t *buf, size_t size)
*
* @return result
*/
int
stm32_flash_erase
(
long
offset
,
size_t
size
)
int
stm32_flash_erase
(
rt_uint32_t
addr
,
size_t
size
)
{
rt_err_t
result
=
RT_EOK
;
rt_uint32_t
addr
=
STM32_FLASH_START_ADRESS
+
offset
;
uint32_t
PAGEError
=
0
;
/*Variable used for Erase procedure*/
...
...
@@ -180,6 +177,27 @@ __exit:
}
#if defined(PKG_USING_FAL)
const
struct
fal_flash_dev
stm32_onchip_flash
=
{
"onchip_flash"
,
STM32_FLASH_START_ADRESS
,
STM32_FLASH_SIZE
,
FLASH_PAGE_SIZE
,
{
NULL
,
stm32_flash_read
,
stm32_flash_write
,
stm32_flash_erase
}
};
static
int
fal_flash_read
(
long
offset
,
rt_uint8_t
*
buf
,
size_t
size
);
static
int
fal_flash_write
(
long
offset
,
const
rt_uint8_t
*
buf
,
size_t
size
);
static
int
fal_flash_erase
(
long
offset
,
size_t
size
);
const
struct
fal_flash_dev
stm32_onchip_flash
=
{
"onchip_flash"
,
STM32_FLASH_START_ADRESS
,
STM32_FLASH_SIZE
,
FLASH_PAGE_SIZE
,
{
NULL
,
fal_flash_read
,
fal_flash_write
,
fal_flash_erase
}
};
static
int
fal_flash_read
(
long
offset
,
rt_uint8_t
*
buf
,
size_t
size
)
{
return
stm32_flash_read
(
stm32_onchip_flash
.
addr
+
offset
,
buf
,
size
);
}
static
int
fal_flash_write
(
long
offset
,
const
rt_uint8_t
*
buf
,
size_t
size
)
{
return
stm32_flash_write
(
stm32_onchip_flash
.
addr
+
offset
,
buf
,
size
);
}
static
int
fal_flash_erase
(
long
offset
,
size_t
size
)
{
return
stm32_flash_erase
(
stm32_onchip_flash
.
addr
+
offset
,
size
);
}
#endif
#endif
/* BSP_USING_ON_CHIP_FLASH */
bsp/stm32/libraries/HAL_Drivers/drv_flash/drv_flash_f4.c
浏览文件 @
710f82d4
...
...
@@ -178,10 +178,9 @@ static rt_uint32_t GetSector(rt_uint32_t Address)
*
* @return result
*/
int
stm32_flash_read
(
long
offset
,
rt_uint8_t
*
buf
,
size_t
size
)
int
stm32_flash_read
(
rt_uint32_t
addr
,
rt_uint8_t
*
buf
,
size_t
size
)
{
size_t
i
;
rt_uint32_t
addr
=
STM32_FLASH_START_ADRESS
+
offset
;
if
((
addr
+
size
)
>
STM32_FLASH_END_ADDRESS
)
{
...
...
@@ -208,10 +207,9 @@ int stm32_flash_read(long offset, rt_uint8_t *buf, size_t size)
*
* @return result
*/
int
stm32_flash_write
(
long
offset
,
const
rt_uint8_t
*
buf
,
size_t
size
)
int
stm32_flash_write
(
rt_uint32_t
addr
,
const
rt_uint8_t
*
buf
,
size_t
size
)
{
rt_err_t
result
=
RT_EOK
;
rt_uint32_t
addr
=
STM32_FLASH_START_ADRESS
+
offset
;
rt_uint32_t
end_addr
=
addr
+
size
;
if
((
end_addr
)
>
STM32_FLASH_END_ADDRESS
)
...
...
@@ -267,10 +265,9 @@ int stm32_flash_write(long offset, const rt_uint8_t *buf, size_t size)
*
* @return result
*/
int
stm32_flash_erase
(
long
offset
,
size_t
size
)
int
stm32_flash_erase
(
rt_uint32_t
addr
,
size_t
size
)
{
rt_err_t
result
=
RT_EOK
;
rt_uint32_t
addr
=
STM32_FLASH_START_ADRESS
+
offset
;
rt_uint32_t
FirstSector
=
0
,
NbOfSectors
=
0
;
rt_uint32_t
SECTORError
=
0
;
...
...
@@ -317,6 +314,61 @@ __exit:
}
#if defined(PKG_USING_FAL)
const
struct
fal_flash_dev
stm32_onchip_flash
=
{
"onchip_flash"
,
STM32_FLASH_START_ADRESS
,
STM32_FLASH_SIZE
,
(
128
*
1024
),
{
NULL
,
stm32_flash_read
,
stm32_flash_write
,
stm32_flash_erase
}
};
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
,
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_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
}
};
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
);
}
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
);
}
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
);
}
static
int
fal_flash_erase_128k
(
long
offset
,
size_t
size
)
{
return
stm32_flash_erase
(
stm32_onchip_flash_128k
.
addr
+
offset
,
size
);
}
#endif
#endif
/* BSP_USING_ON_CHIP_FLASH */
bsp/stm32/libraries/HAL_Drivers/drv_flash/drv_flash_f7.c
浏览文件 @
710f82d4
...
...
@@ -22,33 +22,18 @@
#define LOG_TAG "drv.flash"
#include <drv_log.h>
/* Base address of the Flash sectors Bank 1 */
#define ADDR_FLASH_SECTOR_0 ((uint32_t)0x08000000)
/* Base @ of Sector 0, 16 Kbytes */
#define ADDR_FLASH_SECTOR_1 ((uint32_t)0x08004000)
/* Base @ of Sector 1, 16 Kbytes */
#define ADDR_FLASH_SECTOR_2 ((uint32_t)0x08008000)
/* Base @ of Sector 2, 16 Kbytes */
#define ADDR_FLASH_SECTOR_3 ((uint32_t)0x0800C000)
/* Base @ of Sector 3, 16 Kbytes */
#define ADDR_FLASH_SECTOR_4 ((uint32_t)0x08010000)
/* Base @ of Sector 4, 64 Kbytes */
#define ADDR_FLASH_SECTOR_5 ((uint32_t)0x08020000)
/* Base @ of Sector 5, 128 Kbytes */
#define ADDR_FLASH_SECTOR_6 ((uint32_t)0x08040000)
/* Base @ of Sector 6, 128 Kbytes */
#define ADDR_FLASH_SECTOR_7 ((uint32_t)0x08060000)
/* Base @ of Sector 7, 128 Kbytes */
#define ADDR_FLASH_SECTOR_8 ((uint32_t)0x08080000)
/* Base @ of Sector 8, 128 Kbytes */
#define ADDR_FLASH_SECTOR_9 ((uint32_t)0x080A0000)
/* Base @ of Sector 9, 128 Kbytes */
#define ADDR_FLASH_SECTOR_10 ((uint32_t)0x080C0000)
/* Base @ of Sector 10, 128 Kbytes */
#define ADDR_FLASH_SECTOR_11 ((uint32_t)0x080E0000)
/* Base @ of Sector 11, 128 Kbytes */
/* Base address of the Flash sectors Bank 2 */
#define ADDR_FLASH_SECTOR_12 ((uint32_t)0x08100000)
/* Base @ of Sector 0, 16 Kbytes */
#define ADDR_FLASH_SECTOR_13 ((uint32_t)0x08104000)
/* Base @ of Sector 1, 16 Kbytes */
#define ADDR_FLASH_SECTOR_14 ((uint32_t)0x08108000)
/* Base @ of Sector 2, 16 Kbytes */
#define ADDR_FLASH_SECTOR_15 ((uint32_t)0x0810C000)
/* Base @ of Sector 3, 16 Kbytes */
#define ADDR_FLASH_SECTOR_16 ((uint32_t)0x08110000)
/* Base @ of Sector 4, 64 Kbytes */
#define ADDR_FLASH_SECTOR_17 ((uint32_t)0x08120000)
/* Base @ of Sector 5, 128 Kbytes */
#define ADDR_FLASH_SECTOR_18 ((uint32_t)0x08140000)
/* Base @ of Sector 6, 128 Kbytes */
#define ADDR_FLASH_SECTOR_19 ((uint32_t)0x08160000)
/* Base @ of Sector 7, 128 Kbytes */
#define ADDR_FLASH_SECTOR_20 ((uint32_t)0x08180000)
/* Base @ of Sector 8, 128 Kbytes */
#define ADDR_FLASH_SECTOR_21 ((uint32_t)0x081A0000)
/* Base @ of Sector 9, 128 Kbytes */
#define ADDR_FLASH_SECTOR_22 ((uint32_t)0x081C0000)
/* Base @ of Sector 10, 128 Kbytes */
#define ADDR_FLASH_SECTOR_23 ((uint32_t)0x081E0000)
/* Base @ of Sector 11, 128 Kbytes */
#define ADDR_FLASH_SECTOR_0 ((rt_uint32_t)0x08000000)
/* Base address of Sector 0, 32 Kbytes */
#define ADDR_FLASH_SECTOR_1 ((rt_uint32_t)0x08008000)
/* Base address of Sector 1, 32 Kbytes */
#define ADDR_FLASH_SECTOR_2 ((rt_uint32_t)0x08010000)
/* Base address of Sector 2, 32 Kbytes */
#define ADDR_FLASH_SECTOR_3 ((rt_uint32_t)0x08018000)
/* Base address of Sector 3, 32 Kbytes */
#define ADDR_FLASH_SECTOR_4 ((rt_uint32_t)0x08020000)
/* Base address of Sector 4, 128 Kbytes */
#define ADDR_FLASH_SECTOR_5 ((rt_uint32_t)0x08040000)
/* Base address of Sector 5, 256 Kbytes */
#define ADDR_FLASH_SECTOR_6 ((rt_uint32_t)0x08080000)
/* Base address of Sector 6, 256 Kbytes */
#define ADDR_FLASH_SECTOR_7 ((rt_uint32_t)0x080C0000)
/* Base address of Sector 7, 256 Kbytes */
#define ADDR_FLASH_SECTOR_8 ((rt_uint32_t)0x08100000)
/* Base address of Sector 8, 256 Kbytes */
#define ADDR_FLASH_SECTOR_9 ((rt_uint32_t)0x08140000)
/* Base address of Sector 9, 256 Kbytes */
#define ADDR_FLASH_SECTOR_10 ((rt_uint32_t)0x08180000)
/* Base address of Sector 10, 256 Kbytes */
#define ADDR_FLASH_SECTOR_11 ((rt_uint32_t)0x081C0000)
/* Base address of Sector 11, 256 Kbytes */
/**
* @brief Gets the sector of a given address
...
...
@@ -59,104 +44,54 @@ static rt_uint32_t GetSector(rt_uint32_t Address)
{
rt_uint32_t
sector
=
0
;
if
((
Address
<
ADDR_FLASH_SECTOR_1
)
&&
(
Address
>=
ADDR_FLASH_SECTOR_0
))
if
((
Address
<
ADDR_FLASH_SECTOR_1
)
&&
(
Address
>=
ADDR_FLASH_SECTOR_0
))
{
sector
=
FLASH_SECTOR_0
;
}
else
if
((
Address
<
ADDR_FLASH_SECTOR_2
)
&&
(
Address
>=
ADDR_FLASH_SECTOR_1
))
else
if
((
Address
<
ADDR_FLASH_SECTOR_2
)
&&
(
Address
>=
ADDR_FLASH_SECTOR_1
))
{
sector
=
FLASH_SECTOR_1
;
}
else
if
((
Address
<
ADDR_FLASH_SECTOR_3
)
&&
(
Address
>=
ADDR_FLASH_SECTOR_2
))
else
if
((
Address
<
ADDR_FLASH_SECTOR_3
)
&&
(
Address
>=
ADDR_FLASH_SECTOR_2
))
{
sector
=
FLASH_SECTOR_2
;
}
else
if
((
Address
<
ADDR_FLASH_SECTOR_4
)
&&
(
Address
>=
ADDR_FLASH_SECTOR_3
))
else
if
((
Address
<
ADDR_FLASH_SECTOR_4
)
&&
(
Address
>=
ADDR_FLASH_SECTOR_3
))
{
sector
=
FLASH_SECTOR_3
;
}
else
if
((
Address
<
ADDR_FLASH_SECTOR_5
)
&&
(
Address
>=
ADDR_FLASH_SECTOR_4
))
else
if
((
Address
<
ADDR_FLASH_SECTOR_5
)
&&
(
Address
>=
ADDR_FLASH_SECTOR_4
))
{
sector
=
FLASH_SECTOR_4
;
}
else
if
((
Address
<
ADDR_FLASH_SECTOR_6
)
&&
(
Address
>=
ADDR_FLASH_SECTOR_5
))
else
if
((
Address
<
ADDR_FLASH_SECTOR_6
)
&&
(
Address
>=
ADDR_FLASH_SECTOR_5
))
{
sector
=
FLASH_SECTOR_5
;
}
else
if
((
Address
<
ADDR_FLASH_SECTOR_7
)
&&
(
Address
>=
ADDR_FLASH_SECTOR_6
))
else
if
((
Address
<
ADDR_FLASH_SECTOR_7
)
&&
(
Address
>=
ADDR_FLASH_SECTOR_6
))
{
sector
=
FLASH_SECTOR_6
;
}
else
if
((
Address
<
ADDR_FLASH_SECTOR_8
)
&&
(
Address
>=
ADDR_FLASH_SECTOR_7
))
else
if
((
Address
<
ADDR_FLASH_SECTOR_8
)
&&
(
Address
>=
ADDR_FLASH_SECTOR_7
))
{
sector
=
FLASH_SECTOR_7
;
}
else
if
((
Address
<
ADDR_FLASH_SECTOR_9
)
&&
(
Address
>=
ADDR_FLASH_SECTOR_8
))
else
if
((
Address
<
ADDR_FLASH_SECTOR_9
)
&&
(
Address
>=
ADDR_FLASH_SECTOR_8
))
{
sector
=
FLASH_SECTOR_8
;
}
else
if
((
Address
<
ADDR_FLASH_SECTOR_10
)
&&
(
Address
>=
ADDR_FLASH_SECTOR_9
))
else
if
((
Address
<
ADDR_FLASH_SECTOR_10
)
&&
(
Address
>=
ADDR_FLASH_SECTOR_9
))
{
sector
=
FLASH_SECTOR_9
;
}
else
if
((
Address
<
ADDR_FLASH_SECTOR_11
)
&&
(
Address
>=
ADDR_FLASH_SECTOR_10
))
else
if
((
Address
<
ADDR_FLASH_SECTOR_11
)
&&
(
Address
>=
ADDR_FLASH_SECTOR_10
))
{
sector
=
FLASH_SECTOR_10
;
}
else
if
((
Address
<
ADDR_FLASH_SECTOR_12
)
&&
(
Address
>=
ADDR_FLASH_SECTOR_11
))
else
/* (Address < FLASH_END_ADDR) && (Address >= ADDR_FLASH_SECTOR_11) */
{
sector
=
FLASH_SECTOR_11
;
}
#if defined(STM32F765xx) || defined(STM32F767xx) || defined(STM32F769xx)|| defined(STM32F777xx) || defined(STM32F779xx)
else
if
((
Address
<
ADDR_FLASH_SECTOR_13
)
&&
(
Address
>=
ADDR_FLASH_SECTOR_12
))
{
sector
=
FLASH_SECTOR_12
;
}
else
if
((
Address
<
ADDR_FLASH_SECTOR_14
)
&&
(
Address
>=
ADDR_FLASH_SECTOR_13
))
{
sector
=
FLASH_SECTOR_13
;
}
else
if
((
Address
<
ADDR_FLASH_SECTOR_15
)
&&
(
Address
>=
ADDR_FLASH_SECTOR_14
))
{
sector
=
FLASH_SECTOR_14
;
}
else
if
((
Address
<
ADDR_FLASH_SECTOR_16
)
&&
(
Address
>=
ADDR_FLASH_SECTOR_15
))
{
sector
=
FLASH_SECTOR_15
;
}
else
if
((
Address
<
ADDR_FLASH_SECTOR_17
)
&&
(
Address
>=
ADDR_FLASH_SECTOR_16
))
{
sector
=
FLASH_SECTOR_16
;
}
else
if
((
Address
<
ADDR_FLASH_SECTOR_18
)
&&
(
Address
>=
ADDR_FLASH_SECTOR_17
))
{
sector
=
FLASH_SECTOR_17
;
}
else
if
((
Address
<
ADDR_FLASH_SECTOR_19
)
&&
(
Address
>=
ADDR_FLASH_SECTOR_18
))
{
sector
=
FLASH_SECTOR_18
;
}
else
if
((
Address
<
ADDR_FLASH_SECTOR_20
)
&&
(
Address
>=
ADDR_FLASH_SECTOR_19
))
{
sector
=
FLASH_SECTOR_19
;
}
else
if
((
Address
<
ADDR_FLASH_SECTOR_21
)
&&
(
Address
>=
ADDR_FLASH_SECTOR_20
))
{
sector
=
FLASH_SECTOR_20
;
}
else
if
((
Address
<
ADDR_FLASH_SECTOR_22
)
&&
(
Address
>=
ADDR_FLASH_SECTOR_21
))
{
sector
=
FLASH_SECTOR_21
;
}
else
if
((
Address
<
ADDR_FLASH_SECTOR_23
)
&&
(
Address
>=
ADDR_FLASH_SECTOR_22
))
{
sector
=
FLASH_SECTOR_22
;
}
else
/* (Address < FLASH_END_ADDR) && (Address >= ADDR_FLASH_SECTOR_23) */
{
sector
=
FLASH_SECTOR_23
;
}
#endif
return
sector
;
}
...
...
@@ -170,14 +105,13 @@ static rt_uint32_t GetSector(rt_uint32_t Address)
*
* @return result
*/
int
stm32_flash_read
(
long
offset
,
rt_uint8_t
*
buf
,
size_t
size
)
int
stm32_flash_read
(
rt_uint32_t
addr
,
rt_uint8_t
*
buf
,
size_t
size
)
{
size_t
i
;
rt_uint32_t
addr
=
STM32_FLASH_START_ADRESS
+
offset
;
if
((
addr
+
size
)
>
STM32_FLASH_END_ADDRESS
)
{
LOG_E
(
"read outrange flash size! addr is (0x%p)"
,
(
void
*
)(
addr
+
size
));
LOG_E
(
"read outrange flash size! addr is (0x%p)"
,
(
void
*
)(
addr
+
size
));
return
-
1
;
}
...
...
@@ -200,15 +134,14 @@ int stm32_flash_read(long offset, rt_uint8_t *buf, size_t size)
*
* @return result
*/
int
stm32_flash_write
(
long
offset
,
const
rt_uint8_t
*
buf
,
size_t
size
)
int
stm32_flash_write
(
rt_uint32_t
addr
,
const
rt_uint8_t
*
buf
,
size_t
size
)
{
rt_err_t
result
=
RT_EOK
;
rt_uint32_t
addr
=
STM32_FLASH_START_ADRESS
+
offset
;
rt_uint32_t
end_addr
=
addr
+
size
;
if
((
end_addr
)
>
STM32_FLASH_END_ADDRESS
)
{
LOG_E
(
"write outrange flash size! addr is (0x%p)"
,
(
void
*
)(
addr
+
size
));
LOG_E
(
"write outrange flash size! addr is (0x%p)"
,
(
void
*
)(
addr
+
size
));
return
-
RT_EINVAL
;
}
...
...
@@ -217,8 +150,8 @@ int stm32_flash_write(long offset, const rt_uint8_t *buf, size_t size)
return
-
RT_EINVAL
;
}
/* Unlock the Flash to enable the flash control register access */
HAL_FLASH_Unlock
();
__HAL_FLASH_CLEAR_FLAG
(
FLASH_FLAG_EOP
|
FLASH_FLAG_OPERR
|
FLASH_FLAG_WRPERR
|
FLASH_FLAG_PGAERR
|
FLASH_FLAG_PGPERR
|
FLASH_FLAG_ERSERR
);
for
(
size_t
i
=
0
;
i
<
size
;
i
++
,
addr
++
,
buf
++
)
...
...
@@ -259,16 +192,15 @@ int stm32_flash_write(long offset, const rt_uint8_t *buf, size_t size)
*
* @return result
*/
int
stm32_flash_erase
(
long
offset
,
size_t
size
)
int
stm32_flash_erase
(
rt_uint32_t
addr
,
size_t
size
)
{
rt_err_t
result
=
RT_EOK
;
rt_uint32_t
addr
=
STM32_FLASH_START_ADRESS
+
offset
;
rt_uint32_t
FirstSector
=
0
,
NbOfSectors
=
0
;
rt_uint32_t
SECTORError
=
0
;
if
((
addr
+
size
)
>
STM32_FLASH_END_ADDRESS
)
{
LOG_E
(
"ERROR: erase outrange flash size! addr is (0x%p)
\n
"
,
(
void
*
)(
addr
+
size
));
LOG_E
(
"ERROR: erase outrange flash size! addr is (0x%p)
\n
"
,
(
void
*
)(
addr
+
size
));
return
-
RT_EINVAL
;
}
...
...
@@ -295,6 +227,7 @@ int stm32_flash_erase(long offset, size_t size)
}
__exit:
HAL_FLASH_Lock
();
if
(
result
!=
RT_EOK
)
...
...
@@ -302,11 +235,66 @@ __exit:
return
result
;
}
LOG_D
(
"erase done: addr (0x%p), size %d"
,
(
void
*
)
addr
,
size
);
LOG_D
(
"erase done: addr (0x%p), size %d"
,
(
void
*
)
addr
,
size
);
return
result
;
}
#if defined(PKG_USING_FAL)
const
struct
fal_flash_dev
stm32_onchip_flash
=
{
"onchip_flash"
,
STM32_FLASH_START_ADRESS
,
STM32_FLASH_SIZE
,
(
128
*
1024
),
{
NULL
,
stm32_flash_read
,
stm32_flash_write
,
stm32_flash_erase
}
};
static
int
fal_flash_read_32k
(
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_read_256k
(
long
offset
,
rt_uint8_t
*
buf
,
size_t
size
);
static
int
fal_flash_write_32k
(
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_write_256k
(
long
offset
,
const
rt_uint8_t
*
buf
,
size_t
size
);
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_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_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_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
}
};
static
int
fal_flash_read_32k
(
long
offset
,
rt_uint8_t
*
buf
,
size_t
size
)
{
return
stm32_flash_read
(
stm32_onchip_flash_32k
.
addr
+
offset
,
buf
,
size
);
}
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_read_256k
(
long
offset
,
rt_uint8_t
*
buf
,
size_t
size
)
{
return
stm32_flash_read
(
stm32_onchip_flash_256k
.
addr
+
offset
,
buf
,
size
);
}
static
int
fal_flash_write_32k
(
long
offset
,
const
rt_uint8_t
*
buf
,
size_t
size
)
{
return
stm32_flash_write
(
stm32_onchip_flash_32k
.
addr
+
offset
,
buf
,
size
);
}
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_write_256k
(
long
offset
,
const
rt_uint8_t
*
buf
,
size_t
size
)
{
return
stm32_flash_write
(
stm32_onchip_flash_256k
.
addr
+
offset
,
buf
,
size
);
}
static
int
fal_flash_erase_32k
(
long
offset
,
size_t
size
)
{
return
stm32_flash_erase
(
stm32_onchip_flash_32k
.
addr
+
offset
,
size
);
}
static
int
fal_flash_erase_128k
(
long
offset
,
size_t
size
)
{
return
stm32_flash_erase
(
stm32_onchip_flash_128k
.
addr
+
offset
,
size
);
}
static
int
fal_flash_erase_256k
(
long
offset
,
size_t
size
)
{
return
stm32_flash_erase
(
stm32_onchip_flash_256k
.
addr
+
offset
,
size
);
}
#endif
#endif
/* BSP_USING_ON_CHIP_FLASH */
bsp/stm32/libraries/HAL_Drivers/drv_flash/drv_flash_l4.c
浏览文件 @
710f82d4
...
...
@@ -92,10 +92,9 @@ static uint32_t GetBank(uint32_t Addr)
*
* @return result
*/
int
stm32_flash_read
(
long
offset
,
rt_uint8_t
*
buf
,
size_t
size
)
int
stm32_flash_read
(
rt_uint32_t
addr
,
rt_uint8_t
*
buf
,
size_t
size
)
{
size_t
i
;
rt_uint32_t
addr
=
STM32_FLASH_START_ADRESS
+
offset
;
if
((
addr
+
size
)
>
STM32_FLASH_END_ADDRESS
)
{
...
...
@@ -123,12 +122,11 @@ int stm32_flash_read(long offset, rt_uint8_t *buf, size_t size)
* @return result
*/
int
stm32_flash_write
(
long
offset
,
const
uint8_t
*
buf
,
size_t
size
)
int
stm32_flash_write
(
rt_uint32_t
addr
,
const
uint8_t
*
buf
,
size_t
size
)
{
size_t
i
,
j
;
rt_err_t
result
=
0
;
rt_uint64_t
write_data
=
0
,
temp_data
=
0
;
rt_uint32_t
addr
=
STM32_FLASH_START_ADRESS
+
offset
;
if
((
addr
+
size
)
>
STM32_FLASH_END_ADDRESS
)
{
...
...
@@ -221,10 +219,9 @@ __exit:
*
* @return result
*/
int
stm32_flash_erase
(
long
offset
,
size_t
size
)
int
stm32_flash_erase
(
rt_uint32_t
addr
,
size_t
size
)
{
rt_err_t
result
=
RT_EOK
;
uint32_t
addr
=
STM32_FLASH_START_ADRESS
+
offset
;
uint32_t
FirstPage
=
0
,
NbOfPages
=
0
,
BankNumber
=
0
;
uint32_t
PAGEError
=
0
;
...
...
@@ -272,6 +269,27 @@ __exit:
}
#if defined(PKG_USING_FAL)
const
struct
fal_flash_dev
stm32_onchip_flash
=
{
"onchip_flash"
,
STM32_FLASH_START_ADRESS
,
STM32_FLASH_SIZE
,
2048
,
{
NULL
,
stm32_flash_read
,
stm32_flash_write
,
stm32_flash_erase
}
};
static
int
fal_flash_read
(
long
offset
,
rt_uint8_t
*
buf
,
size_t
size
);
static
int
fal_flash_write
(
long
offset
,
const
rt_uint8_t
*
buf
,
size_t
size
);
static
int
fal_flash_erase
(
long
offset
,
size_t
size
);
const
struct
fal_flash_dev
stm32_onchip_flash
=
{
"onchip_flash"
,
STM32_FLASH_START_ADRESS
,
STM32_FLASH_SIZE
,
2048
,
{
NULL
,
fal_flash_read
,
fal_flash_write
,
fal_flash_erase
}
};
static
int
fal_flash_read
(
long
offset
,
rt_uint8_t
*
buf
,
size_t
size
)
{
return
stm32_flash_read
(
stm32_onchip_flash
.
addr
+
offset
,
buf
,
size
);
}
static
int
fal_flash_write
(
long
offset
,
const
rt_uint8_t
*
buf
,
size_t
size
)
{
return
stm32_flash_write
(
stm32_onchip_flash
.
addr
+
offset
,
buf
,
size
);
}
static
int
fal_flash_erase
(
long
offset
,
size_t
size
)
{
return
stm32_flash_erase
(
stm32_onchip_flash
.
addr
+
offset
,
size
);
}
#endif
#endif
/* BSP_USING_ON_CHIP_FLASH */
bsp/stm32/stm32f407-atk-explorer/board/ports/fal_cfg.h
浏览文件 @
710f82d4
...
...
@@ -14,21 +14,31 @@
#include <rtthread.h>
#include <board.h>
extern
const
struct
fal_flash_dev
stm32_onchip_flash
;
#define FLASH_SIZE_GRANULARITY_16K (4 * 16 * 1024)
#define FLASH_SIZE_GRANULARITY_64K (FLASH_SIZE_GRANULARITY_16K + 64 * 1024)
#define FLASH_SIZE_GRANULARITY_128K (FLASH_SIZE_GRANULARITY_64K + 7 * 128 * 1024)
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_128k
;
/* flash device table */
#define FAL_FLASH_DEV_TABLE \
{ \
&stm32_onchip_flash, \
&stm32_onchip_flash_16k, \
&stm32_onchip_flash_64k, \
&stm32_onchip_flash_128k, \
}
/* ====================== Partition Configuration ========================== */
#ifdef FAL_PART_HAS_TABLE_CFG
/* partition table */
#define FAL_PART_TABLE \
{ \
{FAL_PART_MAGIC_WROD, "app", "onchip_flash", 0, 1008 * 1024, 0},\
{FAL_PART_MAGIC_WROD, "param", "onchip_flash", 1008* 1024 , 16 * 1024, 0}, \
#define FAL_PART_TABLE \
{ \
{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, "app", "onchip_flash_128k", FLASH_SIZE_GRANULARITY_64K, FLASH_SIZE_GRANULARITY_128K, 0}, \
}
#endif
/* FAL_PART_HAS_TABLE_CFG */
#endif
/* _FAL_CFG_H_ */
bsp/stm32/stm32f429-armfly-v6/board/Kconfig
浏览文件 @
710f82d4
...
...
@@ -34,14 +34,14 @@ menu "Onboard Peripheral Drivers"
select RT_USING_DFS_ELMFAT
default n
config PHY_USING_
LAN8720A
config PHY_USING_
DM9161CEP
bool
config BSP_USING_ETH
bool "Enable Ethernet"
default n
select RT_USING_LWIP
select PHY_USING_
LAN8720A
select PHY_USING_
DM9161CEP
config BSP_USING_MPU6050
bool "Enable MPU6050(i2c1)"
...
...
bsp/stm32/stm32f429-armfly-v6/board/ports/fal_cfg.h
浏览文件 @
710f82d4
...
...
@@ -14,21 +14,31 @@
#include <rtthread.h>
#include <board.h>
extern
const
struct
fal_flash_dev
stm32_onchip_flash
;
#define FLASH_SIZE_GRANULARITY_16K (4 * 16 * 1024)
#define FLASH_SIZE_GRANULARITY_64K (FLASH_SIZE_GRANULARITY_16K + 64 * 1024)
#define FLASH_SIZE_GRANULARITY_128K (FLASH_SIZE_GRANULARITY_64K + 7 * 128 * 1024)
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_128k
;
/* flash device table */
#define FAL_FLASH_DEV_TABLE \
{ \
&stm32_onchip_flash, \
&stm32_onchip_flash_16k, \
&stm32_onchip_flash_64k, \
&stm32_onchip_flash_128k, \
}
/* ====================== Partition Configuration ========================== */
#ifdef FAL_PART_HAS_TABLE_CFG
/* partition table */
#define FAL_PART_TABLE \
{ \
{FAL_PART_MAGIC_WROD, "app", "onchip_flash", 0, 2032 * 1024, 0},\
{FAL_PART_MAGIC_WROD, "param", "onchip_flash", 2032* 1024 , 16 * 1024, 0},\
#define FAL_PART_TABLE \
{ \
{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, "app", "onchip_flash_128k", FLASH_SIZE_GRANULARITY_64K, FLASH_SIZE_GRANULARITY_128K, 0}, \
}
#endif
/* FAL_PART_HAS_TABLE_CFG */
#endif
/* _FAL_CFG_H_ */
bsp/stm32/stm32f429-atk-apollo/board/ports/fal_cfg.h
浏览文件 @
710f82d4
...
...
@@ -14,21 +14,31 @@
#include <rtthread.h>
#include <board.h>
extern
const
struct
fal_flash_dev
stm32_onchip_flash
;
#define FLASH_SIZE_GRANULARITY_16K (4 * 16 * 1024)
#define FLASH_SIZE_GRANULARITY_64K (FLASH_SIZE_GRANULARITY_16K + 64 * 1024)
#define FLASH_SIZE_GRANULARITY_128K (FLASH_SIZE_GRANULARITY_64K + 7 * 128 * 1024)
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_128k
;
/* flash device table */
#define FAL_FLASH_DEV_TABLE \
{ \
&stm32_onchip_flash, \
&stm32_onchip_flash_16k, \
&stm32_onchip_flash_64k, \
&stm32_onchip_flash_128k, \
}
/* ====================== Partition Configuration ========================== */
#ifdef FAL_PART_HAS_TABLE_CFG
/* partition table */
#define FAL_PART_TABLE \
{ \
{FAL_PART_MAGIC_WROD, "app", "onchip_flash", 0, 1008 * 1024, 0},\
{FAL_PART_MAGIC_WROD, "param", "onchip_flash", 1008* 1024 , 16 * 1024, 0},\
#define FAL_PART_TABLE \
{ \
{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, "app", "onchip_flash_128k", FLASH_SIZE_GRANULARITY_64K, FLASH_SIZE_GRANULARITY_128K, 0}, \
}
#endif
/* FAL_PART_HAS_TABLE_CFG */
#endif
/* _FAL_CFG_H_ */
bsp/stm32/stm32f429-fire-challenger/board/ports/fal_cfg.h
浏览文件 @
710f82d4
...
...
@@ -14,21 +14,31 @@
#include <rtthread.h>
#include <board.h>
extern
const
struct
fal_flash_dev
stm32_onchip_flash
;
#define FLASH_SIZE_GRANULARITY_16K (4 * 16 * 1024)
#define FLASH_SIZE_GRANULARITY_64K (FLASH_SIZE_GRANULARITY_16K + 64 * 1024)
#define FLASH_SIZE_GRANULARITY_128K (FLASH_SIZE_GRANULARITY_64K + 7 * 128 * 1024)
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_128k
;
/* flash device table */
#define FAL_FLASH_DEV_TABLE \
{ \
&stm32_onchip_flash, \
&stm32_onchip_flash_16k, \
&stm32_onchip_flash_64k, \
&stm32_onchip_flash_128k, \
}
/* ====================== Partition Configuration ========================== */
#ifdef FAL_PART_HAS_TABLE_CFG
/* partition table */
#define FAL_PART_TABLE \
{ \
{FAL_PART_MAGIC_WROD, "app", "onchip_flash", 0, 1008 * 1024, 0},\
{FAL_PART_MAGIC_WROD, "param", "onchip_flash", 1008* 1024 , 16 * 1024, 0},\
#define FAL_PART_TABLE \
{ \
{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, "download", "onchip_flash_128k", FLASH_SIZE_GRANULARITY_64K, FLASH_SIZE_GRANULARITY_128K, 0}, \
}
#endif
/* FAL_PART_HAS_TABLE_CFG */
#endif
/* _FAL_CFG_H_ */
bsp/stm32/stm32f767-atk-apollo/board/ports/fal_cfg.h
浏览文件 @
710f82d4
...
...
@@ -14,21 +14,31 @@
#include <rtthread.h>
#include <board.h>
extern
const
struct
fal_flash_dev
stm32_onchip_flash
;
#define FLASH_SIZE_GRANULARITY_32K (4 * 32 * 1024)
#define FLASH_SIZE_GRANULARITY_128K (FLASH_SIZE_GRANULARITY_32K + 128 * 1024)
#define FLASH_SIZE_GRANULARITY_256K (FLASH_SIZE_GRANULARITY_128K + 3 * 256 * 1024)
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_256k
;
/* flash device table */
#define FAL_FLASH_DEV_TABLE \
{ \
&stm32_onchip_flash, \
&stm32_onchip_flash_32k, \
&stm32_onchip_flash_128k, \
&stm32_onchip_flash_256k, \
}
/* ====================== Partition Configuration ========================== */
#ifdef FAL_PART_HAS_TABLE_CFG
/* partition table */
#define FAL_PART_TABLE \
{ \
{FAL_PART_MAGIC_WROD, "app", "onchip_flash", 0, 1008 * 1024, 0},\
{FAL_PART_MAGIC_WROD, "param", "onchip_flash", 1008* 1024 , 16 * 1024, 0},\
#define FAL_PART_TABLE \
{ \
{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, "app", "onchip_flash_256k", FLASH_SIZE_GRANULARITY_128K, FLASH_SIZE_GRANULARITY_256K, 0}, \
}
#endif
/* FAL_PART_HAS_TABLE_CFG */
#endif
/* _FAL_CFG_H_ */
bsp/stm32/stm32f767-fire-challenger/board/ports/fal_cfg.h
浏览文件 @
710f82d4
...
...
@@ -14,21 +14,31 @@
#include <rtthread.h>
#include <board.h>
extern
const
struct
fal_flash_dev
stm32_onchip_flash
;
#define FLASH_SIZE_GRANULARITY_32K (4 * 32 * 1024)
#define FLASH_SIZE_GRANULARITY_128K (FLASH_SIZE_GRANULARITY_32K + 128 * 1024)
#define FLASH_SIZE_GRANULARITY_256K (FLASH_SIZE_GRANULARITY_128K + 3 * 256 * 1024)
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_256k
;
/* flash device table */
#define FAL_FLASH_DEV_TABLE \
{ \
&stm32_onchip_flash, \
&stm32_onchip_flash_32k, \
&stm32_onchip_flash_128k, \
&stm32_onchip_flash_256k, \
}
/* ====================== Partition Configuration ========================== */
#ifdef FAL_PART_HAS_TABLE_CFG
/* partition table */
#define FAL_PART_TABLE \
{ \
{FAL_PART_MAGIC_WROD, "app", "onchip_flash", 0, 1008 * 1024, 0},\
{FAL_PART_MAGIC_WROD, "param", "onchip_flash", 1008* 1024 , 16 * 1024, 0},\
#define FAL_PART_TABLE \
{ \
{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, "app", "onchip_flash_256k", FLASH_SIZE_GRANULARITY_128K, FLASH_SIZE_GRANULARITY_256K, 0}, \
}
#endif
/* FAL_PART_HAS_TABLE_CFG */
#endif
/* _FAL_CFG_H_ */
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录