Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
BaiXuePrincess
rt-thread
提交
8d45e7f8
R
rt-thread
项目概览
BaiXuePrincess
/
rt-thread
与 Fork 源项目一致
Fork自
RT-Thread / rt-thread
通知
1
Star
0
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,发现更多精彩内容 >>
提交
8d45e7f8
编写于
5月 22, 2020
作者:
whj123999
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add drv_flash_h7.c
上级
b91f1ab5
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
22 addition
and
28 deletion
+22
-28
bsp/stm32/libraries/HAL_Drivers/SConscript
bsp/stm32/libraries/HAL_Drivers/SConscript
+3
-0
bsp/stm32/libraries/HAL_Drivers/drv_flash/drv_flash_h7.c
bsp/stm32/libraries/HAL_Drivers/drv_flash/drv_flash_h7.c
+16
-24
bsp/stm32/stm32h743-atk-apollo/board/ports/fal_cfg.h
bsp/stm32/stm32h743-atk-apollo/board/ports/fal_cfg.h
+3
-4
未找到文件。
bsp/stm32/libraries/HAL_Drivers/SConscript
浏览文件 @
8d45e7f8
...
...
@@ -73,6 +73,9 @@ if GetDepend(['BSP_USING_ON_CHIP_FLASH', 'SOC_SERIES_STM32F7']):
if
GetDepend
([
'BSP_USING_ON_CHIP_FLASH'
,
'SOC_SERIES_STM32L4'
]):
src
+=
[
'drv_flash/drv_flash_l4.c'
]
if
GetDepend
([
'BSP_USING_ON_CHIP_FLASH'
,
'SOC_SERIES_STM32H7'
]):
src
+=
[
'drv_flash/drv_flash_h7.c'
]
if
GetDepend
(
'RT_USING_HWCRYPTO'
):
src
+=
[
'drv_crypto.c'
]
...
...
bsp/stm32/libraries/HAL_Drivers/drv_flash/drv_flash_h7.c
浏览文件 @
8d45e7f8
...
...
@@ -34,8 +34,6 @@
#define ADDR_FLASH_SECTOR_7 ((rt_uint32_t)0x080E0000)
/* Base address of Sector 7, 128 Kbytes */
#define ADDR_FLASH_SECTOR_8 ((rt_uint32_t)0x08100000)
/* Base address of Sector 8, 128 Kbytes */
#define FLASH_SECTOR_0 0U
/* Sector Number 0 */
#define FLASH_SECTOR_1 1U
/* Sector Number 1 */
#define FLASH_SECTOR_2 2U
/* Sector Number 2 */
...
...
@@ -53,15 +51,14 @@
*/
static
void
GetSector
(
rt_uint32_t
Address
,
uint32_t
*
bank
,
uint32_t
*
sector
)
{
#if defined (FLASH_OPTCR_nDBANK)
FLASH_OBProgramInitTypeDef
OBInit
;
uint32_t
nbank
=
0
;
/
/get duel bank ability:nDBANK(Bit29)
/
* get duel bank ability:nDBANK(Bit29) */
HAL_FLASHEx_OBGetConfig
(
&
OBInit
);
nbank
=
((
OBInit
.
USERConfig
&
0x20000000U
)
>>
29
);
/
/1:single bank mode
/
* 1:single bank mode */
if
(
1
==
nbank
)
{
if
((
Address
<
ADDR_FLASH_SECTOR_1
)
&&
(
Address
>=
ADDR_FLASH_SECTOR_0
))
...
...
@@ -113,25 +110,25 @@ static void GetSector(rt_uint32_t Address,uint32_t* bank,uint32_t* sector)
sector
=
FLASH_SECTOR_11
;
}
}
else
/
/0:dual bank mode
else
/
* 0:dual bank mode */
{
LOG_E
(
"rtthread doesn't support duel bank mode yet!"
);
RT_ASSERT
(
0
);
}
#else //no dual bank ability
*
sector
=
(
Address
&
0xffffff
)
/
FLASH_SIZE_GRANULARITY_128K
;
if
(
*
sector
>
7
)
{
*
bank
=
FLASH_BANK_1
;
*
sector
=
*
sector
/
2
;
}
else
*
bank
=
FLASH_BANK_2
;
#else
/* no dual bank ability */
*
sector
=
(
Address
&
0xffffff
)
/
FLASH_SIZE_GRANULARITY_128K
;
if
(
*
sector
>
7
)
{
*
bank
=
FLASH_BANK_1
;
*
sector
=
*
sector
/
2
;
}
else
{
*
bank
=
FLASH_BANK_2
;
}
#endif
}
/**
* Read data from flash.
* @note This operation's units is word.
...
...
@@ -251,10 +248,10 @@ int stm32_flash_erase(rt_uint32_t addr, size_t size)
/* Get the 1st sector to erase */
GetSector
(
addr
,
&
bank
,
&
FirstSector
);
/* Get the number of sector to erase from 1st sector*/
/* Get the number of sector to erase from 1st sector
*/
GetSector
(
addr
+
size
,
0
,
&
NbOfSectors
);
NbOfSectors
=
NbOfSectors
-
FirstSector
+
1
;
/* Fill EraseInit structure*/
/* Fill EraseInit structure
*/
EraseInitStruct
.
TypeErase
=
FLASH_TYPEERASE_SECTORS
;
EraseInitStruct
.
VoltageRange
=
FLASH_VOLTAGE_RANGE_3
;
EraseInitStruct
.
Sector
=
FirstSector
;
...
...
@@ -281,14 +278,9 @@ __exit:
}
#if defined(PKG_USING_FAL)
static
int
fal_flash_read_128k
(
long
offset
,
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_128k
(
long
offset
,
size_t
size
);
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_128k
(
long
offset
,
rt_uint8_t
*
buf
,
size_t
size
)
...
...
bsp/stm32/stm32h743-atk-apollo/board/ports/fal_cfg.h
浏览文件 @
8d45e7f8
...
...
@@ -9,14 +9,13 @@
* 2020-5-17 yufanyufan77 support H7
*/
#ifndef _
FAL_CFG_H
_
#define _
FAL_CFG_H
_
#ifndef _
_FAL_CFG_H_
_
#define _
_FAL_CFG_H_
_
#include <rtthread.h>
#include <board.h>
#define FLASH_SIZE_GRANULARITY_128K (16 * 128 * 1024)
#define FLASH_SIZE_GRANULARITY_128K (16 * 128 * 1024)
#define STM32_FLASH_START_ADRESS_128K (0x8000000)
extern
const
struct
fal_flash_dev
stm32_onchip_flash_128k
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录