Skip to content

Commit 8b54890

Browse files
committed
bsp: k230: mount sdcard and run init
Signed-off-by: Wang Chen <[email protected]>
1 parent ab59764 commit 8b54890

File tree

3 files changed

+25
-4
lines changed

3 files changed

+25
-4
lines changed

bsp/k230/applications/main.c

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,31 @@
1111
#include <rthw.h>
1212
#include <stdio.h>
1313
#include <string.h>
14+
#include <dfs_fs.h>
15+
#include "msh.h"
16+
17+
#ifndef RT_SHELL_PATH
18+
#define RT_SHELL_PATH "/bin/init.sh"
19+
#endif
1420

1521
int main(void)
1622
{
17-
printf("Hello RISC-V\n");
23+
int result;
24+
struct statfs buffer;
25+
printf("RT-SMART Hello RISC-V.\n");
26+
27+
char path[64];
28+
strcpy(path, RT_SHELL_PATH);
29+
strrchr(path, '/')[0] = 0;
30+
if(!strcmp(path, "/sdcard") || !strcmp(path, "/sharefs"))
31+
{
32+
while(dfs_statfs(path, &buffer) != 0)
33+
{
34+
rt_thread_delay(RT_TICK_PER_SECOND);
35+
}
36+
}
37+
38+
msh_exec(RT_SHELL_PATH, strlen(RT_SHELL_PATH)+1);
1839

1940
return 0;
2041
}

bsp/k230/applications/mnt.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,9 @@ int mnt_init(void)
4444
while (mmcsd_wait_cd_changed(100) != MMCSD_HOST_PLUGED)
4545
;
4646

47-
if (dfs_mount(BSP_SD_MNT_DEVNAME, "/mnt", "elm", 0, 0) != 0)
47+
if (dfs_mount(BSP_SD_MNT_DEVNAME, "/sdcard", "elm", 0, 0) != 0)
4848
{
49-
rt_kprintf("Dir /mnt mount failed!\n");
49+
rt_kprintf("Dir /sdcard mount failed!\n");
5050
}
5151
#endif
5252

bsp/k230/board/Kconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ menu "Drivers Configuration"
3131

3232
config BSP_SD_MNT_DEVNAME
3333
string "The name of the SD-BlkDev to be mounted"
34-
default "sd13"
34+
default "sd1"
3535
endif
3636

3737

0 commit comments

Comments
 (0)