Skip to content

Commit 2589d24

Browse files
authored
Merge branch 'master' into tz
2 parents 19c5088 + 56d3abe commit 2589d24

40 files changed

+540
-294
lines changed
Binary file not shown.

bsp/stm32/stm32f407-atk-explorer/.config

Lines changed: 220 additions & 20 deletions
Large diffs are not rendered by default.

bsp/stm32/stm32f407-atk-explorer/board/Kconfig

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -71,18 +71,26 @@ menu "Onboard Peripheral Drivers"
7171
select BSP_USING_I2C1
7272
select PKG_USING_MPU6XXX
7373

74-
config BSP_USING_SDCARD
75-
bool "Enable SDCARD (sdio)"
76-
select BSP_USING_SDIO
74+
menuconfig BSP_USING_FS
75+
bool "Enable filesystem"
7776
select RT_USING_DFS
78-
select RT_USING_DFS_ELMFAT
77+
select RT_USING_DFS_ROMFS
7978
default n
8079

81-
config SDIO_MAX_FREQ
82-
int "sdio max freq"
83-
range 0 24000000
84-
depends on BSP_USING_SDCARD
85-
default 1000000
80+
if BSP_USING_FS
81+
config BSP_USING_SDCARD
82+
bool "Enable SDCARD (FATFS)"
83+
select BSP_USING_SDIO
84+
select RT_USING_DFS
85+
select RT_USING_DFS_ELMFAT
86+
default n
87+
88+
config SDIO_MAX_FREQ
89+
int "sdio max freq"
90+
range 0 24000000
91+
depends on BSP_USING_SDCARD
92+
default 1000000
93+
endif
8694

8795
endmenu
8896

bsp/stm32/stm32f407-atk-explorer/board/SConscript

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ if GetDepend(['BSP_USING_ETH']):
1818
if GetDepend(['BSP_USING_SPI_FLASH']):
1919
src += Glob('ports/spi_flash_init.c')
2020

21-
if GetDepend(['BSP_USING_SDCARD']):
22-
src += Glob('ports/drv_sdcard.c')
21+
if GetDepend(['BSP_USING_FS']):
22+
src += Glob('ports/drv_filesystem.c')
2323

2424
if GetDepend(['BSP_USING_SRAM']):
2525
src += Glob('ports/drv_sram.c')
Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
/*
2+
* Copyright (c) 2006-2021, RT-Thread Development Team
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*
6+
* Change Logs:
7+
* Date Author Notes
8+
* 2018-12-13 balanceTWK add sdcard port file
9+
* 2021-05-10 Meco Man fix a bug that cannot use fatfs in the main thread at starting up
10+
* 2021-07-28 Meco Man implement romfs as the root filesystem
11+
*/
12+
13+
#include <rtthread.h>
14+
15+
#ifdef BSP_USING_FS
16+
#include <dfs_romfs.h>
17+
#include <dfs_fs.h>
18+
#include <dfs_posix.h>
19+
20+
#if DFS_FILESYSTEMS_MAX < 4
21+
#error "Please define DFS_FILESYSTEMS_MAX more than 4"
22+
#endif
23+
#if DFS_FILESYSTEM_TYPES_MAX < 4
24+
#error "Please define DFS_FILESYSTEM_TYPES_MAX more than 4"
25+
#endif
26+
27+
#define DBG_TAG "app.filesystem"
28+
#define DBG_LVL DBG_INFO
29+
#include <rtdbg.h>
30+
31+
#ifdef BSP_USING_SDCARD
32+
static void sd_mount(void *parameter)
33+
{
34+
while (1)
35+
{
36+
rt_thread_mdelay(500);
37+
if(rt_device_find("sd0") != RT_NULL)
38+
{
39+
if (dfs_mount("sd0", "/sdcard", "elm", 0, 0) == RT_EOK)
40+
{
41+
LOG_I("sd card mount to '/sdcard'");
42+
break;
43+
}
44+
else
45+
{
46+
LOG_W("sd card mount to '/sdcard' failed!");
47+
}
48+
}
49+
}
50+
}
51+
52+
static int onboard_sdcard_mount(void)
53+
{
54+
rt_thread_t tid;
55+
56+
if (dfs_mount("sd0", "/sdcard", "elm", 0, 0) == RT_EOK)
57+
{
58+
LOG_I("sd card mount to '/sdcard'");
59+
}
60+
else
61+
{
62+
tid = rt_thread_create("sd_mount", sd_mount, RT_NULL,
63+
1024, RT_THREAD_PRIORITY_MAX - 2, 20);
64+
if (tid != RT_NULL)
65+
{
66+
rt_thread_startup(tid);
67+
}
68+
else
69+
{
70+
LOG_E("create sd_mount thread err!");
71+
}
72+
}
73+
74+
return RT_EOK;
75+
}
76+
#endif
77+
78+
static const struct romfs_dirent _romfs_root[] =
79+
{
80+
#ifdef BSP_USING_SDCARD
81+
{ROMFS_DIRENT_DIR, "sdcard", RT_NULL, 0},
82+
#endif
83+
// {ROMFS_DIRENT_DIR, "flash", RT_NULL, 0},
84+
};
85+
86+
const struct romfs_dirent romfs_root =
87+
{
88+
ROMFS_DIRENT_DIR, "/", (rt_uint8_t *)_romfs_root, sizeof(_romfs_root) / sizeof(_romfs_root[0])
89+
};
90+
91+
static int filesystem_mount(void)
92+
{
93+
if (dfs_mount(RT_NULL, "/", "rom", 0, &(romfs_root)) != 0)
94+
{
95+
LOG_E("rom mount to '/' failed!");
96+
}
97+
#ifdef BSP_USING_SDCARD
98+
onboard_sdcard_mount();
99+
#endif
100+
101+
return RT_EOK;
102+
}
103+
INIT_APP_EXPORT(filesystem_mount);
104+
105+
#endif /* BSP_USING_FS */

bsp/stm32/stm32f407-atk-explorer/board/ports/drv_sdcard.c

Lines changed: 0 additions & 70 deletions
This file was deleted.

bsp/stm32/stm32f407-atk-explorer/rtconfig.h

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@
1616
#define RT_USING_IDLE_HOOK
1717
#define RT_IDLE_HOOK_LIST_SIZE 4
1818
#define IDLE_THREAD_STACK_SIZE 1024
19+
20+
/* kservice optimization */
21+
1922
#define RT_DEBUG
2023
#define RT_DEBUG_COLOR
2124

@@ -39,7 +42,7 @@
3942
#define RT_USING_CONSOLE
4043
#define RT_CONSOLEBUF_SIZE 128
4144
#define RT_CONSOLE_DEVICE_NAME "uart1"
42-
#define RT_VER_NUM 0x40002
45+
#define RT_VER_NUM 0x40004
4346
#define ARCH_ARM
4447
#define RT_USING_CPU_FFS
4548
#define ARCH_ARM_CORTEX_M
@@ -79,21 +82,18 @@
7982
#define RT_USING_DEVICE_IPC
8083
#define RT_PIPE_BUFSZ 512
8184
#define RT_USING_SERIAL
85+
#define RT_USING_SERIAL_V1
8286
#define RT_SERIAL_USING_DMA
8387
#define RT_SERIAL_RB_BUFSZ 64
8488
#define RT_USING_PIN
8589

86-
/* Using Hardware Crypto drivers */
87-
88-
89-
/* Using WiFi */
90-
91-
9290
/* Using USB */
9391

9492

9593
/* POSIX layer and C standard library */
9694

95+
#define RT_LIBC_USING_TIME
96+
#define RT_LIBC_DEFAULT_TIMEZONE 8
9797

9898
/* Network */
9999

@@ -106,9 +106,6 @@
106106
/* light weight TCP/IP stack */
107107

108108

109-
/* Modbus master and slave stack */
110-
111-
112109
/* AT commands */
113110

114111

@@ -118,6 +115,9 @@
118115
/* Utilities */
119116

120117

118+
/* RT-Thread Utestcases */
119+
120+
121121
/* RT-Thread online packages */
122122

123123
/* IoT - internet of things */
@@ -149,14 +149,23 @@
149149
/* system packages */
150150

151151

152+
/* Micrium: Micrium software products porting for RT-Thread */
153+
154+
152155
/* peripheral libraries and drivers */
153156

154157

158+
/* AI packages */
159+
160+
155161
/* miscellaneous packages */
156162

157163

158164
/* samples: kernel and components samples */
159165

166+
167+
/* entertainment: terminal games and other interesting software packages */
168+
160169
#define SOC_FAMILY_STM32
161170
#define SOC_SERIES_STM32F4
162171

components/dfs/include/dfs_select.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
#ifndef DFS_SELECT_H__
1111
#define DFS_SELECT_H__
1212

13-
#include <libc/libc_fdset.h>
13+
#include <sys/select.h>
1414

1515
#ifdef __cplusplus
1616
extern "C" {

components/drivers/include/ipc/workqueue.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ rt_err_t rt_workqueue_critical_work(struct rt_workqueue *queue, struct rt_work *
6969
#ifdef RT_USING_SYSTEM_WORKQUEUE
7070
rt_err_t rt_work_submit(struct rt_work *work, rt_tick_t time);
7171
rt_err_t rt_work_cancel(struct rt_work *work);
72-
#endif
72+
#endif /* RT_USING_SYSTEM_WORKQUEUE */
7373

7474
rt_inline void rt_work_init(struct rt_work *work, void (*work_func)(struct rt_work *work, void *work_data),
7575
void *work_data)
@@ -85,7 +85,6 @@ rt_inline void rt_work_init(struct rt_work *work, void (*work_func)(struct rt_wo
8585
void rt_delayed_work_init(struct rt_delayed_work *work, void (*work_func)(struct rt_work *work,
8686
void *work_data), void *work_data);
8787

88-
int rt_work_sys_workqueue_init(void);
89-
#endif
88+
#endif /* RT_USING_HEAP */
9089

9190
#endif

components/drivers/src/workqueue.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -358,7 +358,7 @@ rt_err_t rt_work_cancel(struct rt_work *work)
358358
return rt_workqueue_cancel_work(sys_workq, work);
359359
}
360360

361-
int rt_work_sys_workqueue_init(void)
361+
static int rt_work_sys_workqueue_init(void)
362362
{
363363
if (sys_workq != RT_NULL)
364364
return RT_EOK;
@@ -370,5 +370,5 @@ int rt_work_sys_workqueue_init(void)
370370
return RT_EOK;
371371
}
372372
INIT_PREV_EXPORT(rt_work_sys_workqueue_init);
373-
#endif
374-
#endif
373+
#endif /* RT_USING_SYSTEM_WORKQUEUE */
374+
#endif /* RT_USING_HEAP */

0 commit comments

Comments
 (0)