Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
2301_76519099
rt-thread
提交
b3ea49c8
R
rt-thread
项目概览
2301_76519099
/
rt-thread
与 Fork 源项目一致
Fork自
RT-Thread / rt-thread
通知
3
Star
1
Fork
1
代码
文件
提交
分支
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,发现更多精彩内容 >>
未验证
提交
b3ea49c8
编写于
8月 08, 2021
作者:
G
guo
提交者:
GitHub
8月 08, 2021
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #4930 from mysterywolf/littlefs-check
[stm32f407-explorer] 优化FAL相关设置
上级
d92dcb59
f8f9a304
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
91 addition
and
12 deletion
+91
-12
bsp/stm32/stm32f407-atk-explorer/board/Kconfig
bsp/stm32/stm32f407-atk-explorer/board/Kconfig
+2
-1
bsp/stm32/stm32f407-atk-explorer/board/SConscript
bsp/stm32/stm32f407-atk-explorer/board/SConscript
+2
-0
bsp/stm32/stm32f407-atk-explorer/board/ports/drv_filesystem.c
...stm32/stm32f407-atk-explorer/board/ports/drv_filesystem.c
+2
-0
bsp/stm32/stm32f407-atk-explorer/board/ports/fal_cfg.h
bsp/stm32/stm32f407-atk-explorer/board/ports/fal_cfg.h
+3
-3
bsp/stm32/stm32f407-atk-explorer/board/ports/fal_spi_flash_sfud_port.c
...32f407-atk-explorer/board/ports/fal_spi_flash_sfud_port.c
+80
-0
bsp/stm32/stm32f407-atk-explorer/board/ports/spi_flash_init.c
...stm32/stm32f407-atk-explorer/board/ports/spi_flash_init.c
+2
-8
未找到文件。
bsp/stm32/stm32f407-atk-explorer/board/Kconfig
浏览文件 @
b3ea49c8
...
...
@@ -101,7 +101,8 @@ menu "Onboard Peripheral Drivers"
select BSP_USING_SPI_FLASH
select BSP_USING_FS
select PKG_USING_FAL
select FAL_USING_SFUD_PORT
select FAL_USING_AUTO_INIT
select FAL_PART_HAS_TABLE_CFG
select PKG_USING_LITTLEFS
select RT_USING_SYSTEM_WORKQUEUE
default n
...
...
bsp/stm32/stm32f407-atk-explorer/board/SConscript
浏览文件 @
b3ea49c8
...
...
@@ -20,6 +20,8 @@ if GetDepend(['BSP_USING_SPI_FLASH']):
if
GetDepend
([
'BSP_USING_FS'
]):
src
+=
Glob
(
'ports/drv_filesystem.c'
)
if
GetDepend
([
'BSP_USING_SPI_FLASH_LITTLEFS'
]):
src
+=
Glob
(
'ports/fal_spi_flash_sfud_port.c'
)
if
GetDepend
([
'BSP_USING_SRAM'
]):
src
+=
Glob
(
'ports/drv_sram.c'
)
...
...
bsp/stm32/stm32f407-atk-explorer/board/ports/drv_filesystem.c
浏览文件 @
b3ea49c8
...
...
@@ -83,7 +83,9 @@ static int onboard_spiflash_mount(void)
{
struct
rt_device
*
mtd_dev
=
RT_NULL
;
#ifndef FAL_USING_AUTO_INIT
fal_init
();
#endif
mtd_dev
=
fal_mtd_nor_device_create
(
FS_PARTITION_NAME
);
if
(
!
mtd_dev
)
...
...
bsp/stm32/stm32f407-atk-explorer/board/ports/fal_cfg.h
浏览文件 @
b3ea49c8
...
...
@@ -15,7 +15,7 @@
#include <board.h>
#ifdef BSP_USING_SPI_FLASH_LITTLEFS
extern
struct
fal_flash_dev
nor_flash0
;
extern
struct
fal_flash_dev
w25q128
;
#else
#define FLASH_SIZE_GRANULARITY_16K (4 * 16 * 1024)
#define FLASH_SIZE_GRANULARITY_64K (64 * 1024)
...
...
@@ -34,7 +34,7 @@ extern const struct fal_flash_dev stm32_onchip_flash_128k;
#ifdef BSP_USING_SPI_FLASH_LITTLEFS
#define FAL_FLASH_DEV_TABLE \
{ \
&
nor_flash0
, \
&
w25q128
, \
}
#else
#define FAL_FLASH_DEV_TABLE \
...
...
@@ -52,7 +52,7 @@ extern const struct fal_flash_dev stm32_onchip_flash_128k;
#ifdef BSP_USING_SPI_FLASH_LITTLEFS
#define FAL_PART_TABLE \
{ \
{FAL_PART_MAGIC_WROD, "spiflash0",
FAL_USING_NOR_FLASH_DEV_NAME
, 0 , 16 * 1024 * 1024, 0}, \
{FAL_PART_MAGIC_WROD, "spiflash0",
"W25Q128"
, 0 , 16 * 1024 * 1024, 0}, \
}
#else
#define FAL_PART_TABLE \
...
...
bsp/stm32/stm32f407-atk-explorer/board/ports/fal_spi_flash_sfud_port.c
0 → 100644
浏览文件 @
b3ea49c8
/*
* Copyright (c) 2006-2021, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
* 2021-08-07 Meco Man first version
*/
#include <fal.h>
#include <sfud.h>
#ifdef RT_USING_SFUD
#include <spi_flash_sfud.h>
#endif
static
int
init
(
void
);
static
int
read
(
long
offset
,
uint8_t
*
buf
,
size_t
size
);
static
int
write
(
long
offset
,
const
uint8_t
*
buf
,
size_t
size
);
static
int
erase
(
long
offset
,
size_t
size
);
static
sfud_flash_t
sfud_dev
=
NULL
;
struct
fal_flash_dev
w25q128
=
{
.
name
=
"W25Q128"
,
.
addr
=
0
,
.
len
=
16
*
1024
*
1024
,
.
blk_size
=
4096
,
.
ops
=
{
init
,
read
,
write
,
erase
},
.
write_gran
=
1
};
static
int
init
(
void
)
{
sfud_dev
=
rt_sfud_flash_find_by_dev_name
(
"W25Q128"
);
if
(
RT_NULL
==
sfud_dev
)
{
return
-
1
;
}
/* update the flash chip information */
w25q128
.
blk_size
=
sfud_dev
->
chip
.
erase_gran
;
w25q128
.
len
=
sfud_dev
->
chip
.
capacity
;
return
0
;
}
static
int
read
(
long
offset
,
uint8_t
*
buf
,
size_t
size
)
{
assert
(
sfud_dev
);
assert
(
sfud_dev
->
init_ok
);
sfud_read
(
sfud_dev
,
w25q128
.
addr
+
offset
,
size
,
buf
);
return
size
;
}
static
int
write
(
long
offset
,
const
uint8_t
*
buf
,
size_t
size
)
{
assert
(
sfud_dev
);
assert
(
sfud_dev
->
init_ok
);
if
(
sfud_write
(
sfud_dev
,
w25q128
.
addr
+
offset
,
size
,
buf
)
!=
SFUD_SUCCESS
)
{
return
-
1
;
}
return
size
;
}
static
int
erase
(
long
offset
,
size_t
size
)
{
assert
(
sfud_dev
);
assert
(
sfud_dev
->
init_ok
);
if
(
sfud_erase
(
sfud_dev
,
w25q128
.
addr
+
offset
,
size
)
!=
SFUD_SUCCESS
)
{
return
-
1
;
}
return
size
;
}
bsp/stm32/stm32f407-atk-explorer/board/ports/spi_flash_init.c
浏览文件 @
b3ea49c8
...
...
@@ -15,21 +15,15 @@
#if defined(BSP_USING_SPI_FLASH)
#ifdef FAL_USING_NOR_FLASH_DEV_NAME
#define _SPI_FLASH_NAME FAL_USING_NOR_FLASH_DEV_NAME
#else
#define _SPI_FLASH_NAME "W25Q128"
#endif
static
int
rt_hw_spi_flash_init
(
void
)
{
__HAL_RCC_GPIOB_CLK_ENABLE
();
rt_hw_spi_device_attach
(
"spi1"
,
"spi10"
,
GPIOB
,
GPIO_PIN_14
);
if
(
RT_NULL
==
rt_sfud_flash_probe
(
_SPI_FLASH_NAME
,
"spi10"
))
if
(
RT_NULL
==
rt_sfud_flash_probe
(
"W25Q128"
,
"spi10"
))
{
return
-
RT_ERROR
;
}
;
}
return
RT_EOK
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录