From 991c25dd5d4a0edde574865215d0742e1e5b1cdd Mon Sep 17 00:00:00 2001 From: tangyuxin <462747508@qq.com> Date: Sat, 30 Jan 2021 16:31:03 +0800 Subject: [PATCH 1/6] [finsh] add mount/umount cmd --- components/finsh/msh_file.c | 106 +++++++++++++++++++++++++++++++----- 1 file changed, 93 insertions(+), 13 deletions(-) diff --git a/components/finsh/msh_file.c b/components/finsh/msh_file.c index 1368838b94..aa182ff9b3 100644 --- a/components/finsh/msh_file.c +++ b/components/finsh/msh_file.c @@ -101,7 +101,7 @@ int msh_exec_script(const char *cmd_line, int size) int length; line_buf = (char *) rt_malloc(RT_CONSOLEBUF_SIZE); - if (line_buf == RT_NULL) + if (line_buf == RT_NULL) { close(fd); return -RT_ENOMEM; @@ -295,7 +295,7 @@ static void directory_delete_for_msh(const char *pathname, char f, char v) if (dirent == RT_NULL) break; if (rt_strcmp(".", dirent->d_name) != 0 && - rt_strcmp("..", dirent->d_name) != 0) + rt_strcmp("..", dirent->d_name) != 0) { rt_sprintf(full_path, "%s/%s", pathname, dirent->d_name); if (dirent->d_type == DT_REG) @@ -347,13 +347,20 @@ int cmd_rm(int argc, char **argv) { switch (argv[1][n]) { - case 'f': f = 1; break; - case 'r': r = 1; break; - case 'v': v = 1; break; - case '-': break; - default: - rt_kprintf("Error: Bad option: %c\n", argv[1][n]); - return 0; + case 'f': + f = 1; + break; + case 'r': + r = 1; + break; + case 'v': + v = 1; + break; + case '-': + break; + default: + rt_kprintf("Error: Bad option: %c\n", argv[1][n]); + return 0; } } argc -= 1; @@ -363,7 +370,7 @@ int cmd_rm(int argc, char **argv) for (index = 1; index < argc; index ++) { struct stat s; - if (stat (argv[index], &s) == 0) + if (stat(argv[index], &s) == 0) { if (s.st_mode & S_IFDIR) { @@ -469,8 +476,81 @@ int cmd_mkfs(int argc, char **argv) } FINSH_FUNCTION_EXPORT_ALIAS(cmd_mkfs, __cmd_mkfs, format disk with file system); +extern struct dfs_filesystem filesystem_table[]; +int cmd_mount(int argc, char *argv[]) +{ + if (argc == 1) + { + struct dfs_filesystem *iter; + + /* display the mount history */ + rt_kprintf("filesystem device mountpoint\n"); + rt_kprintf("---------- ------ ----------\n"); + for (iter = &filesystem_table[0]; + iter < &filesystem_table[DFS_FILESYSTEMS_MAX]; iter++) + { + if ((iter != NULL) && (iter->path != NULL)) + { + rt_kprintf("%-10s %-6s %-s\n", + iter->ops->name, iter->dev_id->parent.name, iter->path); + } + } + return 0; + } + else if (argc == 4) + { + char *device = argv[1]; + char *path = argv[2]; + char *fstype = argv[3]; + + /* mount a filesystem to the specified directory */ + rt_kprintf("mount device %s(%s) onto %s ... ", device, fstype, path); + if (dfs_mount(device, path, fstype, 0, 0) == 0) + { + rt_kprintf("succeed!\n"); + return 0; + } + else + { + rt_kprintf("failed!\n"); + return -1; + } + } + else + { + rt_kprintf("Usage: mount .\n"); + return -1; + } +} +FINSH_FUNCTION_EXPORT_ALIAS(cmd_mount, __cmd_mount, mount ); + +/* unmount the filesystem from the specified mountpoint */ +int cmd_umount(int argc, char *argv[]) +{ + char *path = argv[1]; + + if (argc != 2) + { + rt_kprintf("Usage: unmount .\n"); + return -1; + } + + rt_kprintf("unmount %s ... ", path); + if (dfs_unmount(path) < 0) + { + rt_kprintf("failed!\n"); + return -1; + } + else + { + rt_kprintf("succeed!\n"); + return 0; + } +} +FINSH_FUNCTION_EXPORT_ALIAS(cmd_umount, __cmd_umount, Unmount device from file system); + extern int df(const char *path); -int cmd_df(int argc, char** argv) +int cmd_df(int argc, char **argv) { if (argc != 2) { @@ -492,7 +572,7 @@ int cmd_df(int argc, char** argv) } FINSH_FUNCTION_EXPORT_ALIAS(cmd_df, __cmd_df, disk free); -int cmd_echo(int argc, char** argv) +int cmd_echo(int argc, char **argv) { if (argc == 2) { @@ -505,7 +585,7 @@ int cmd_echo(int argc, char** argv) fd = open(argv[2], O_RDWR | O_APPEND | O_CREAT, 0); if (fd >= 0) { - write (fd, argv[1], strlen(argv[1])); + write(fd, argv[1], strlen(argv[1])); close(fd); } else From da43448fab06cbf5bc17ec995279a2b174268c73 Mon Sep 17 00:00:00 2001 From: yangjie Date: Thu, 4 Mar 2021 13:51:39 +0800 Subject: [PATCH 2/6] [bsp][samrtfusion2]add C99 support and update project files --- bsp/smartfusion2/project.uvopt | 772 +++++++++++++++--------------- bsp/smartfusion2/project.uvoptx | 616 ++++++++++++------------ bsp/smartfusion2/project.uvproj | 238 ++++----- bsp/smartfusion2/project.uvprojx | 252 +++++----- bsp/smartfusion2/template.uvopt | 4 +- bsp/smartfusion2/template.uvproj | 8 +- bsp/smartfusion2/template.uvprojx | 20 +- 7 files changed, 971 insertions(+), 939 deletions(-) diff --git a/bsp/smartfusion2/project.uvopt b/bsp/smartfusion2/project.uvopt index 99ce043dfe..51eba0e604 100644 --- a/bsp/smartfusion2/project.uvopt +++ b/bsp/smartfusion2/project.uvopt @@ -110,10 +110,10 @@ 1 0 1 - 1 + 0 1 1 - 0 + 1 0 0 6 @@ -177,7 +177,7 @@ - Kernel + Applications 0 0 0 @@ -193,8 +193,8 @@ 0 0 0 - ..\..\src\clock.c - clock.c + applications\main.c + main.c 0 0 @@ -209,246 +209,14 @@ 0 0 0 - ..\..\src\components.c - components.c - 0 - 0 - - - 1 - 3 - 1 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - ..\..\src\device.c - device.c - 0 - 0 - - - 1 - 4 - 1 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - ..\..\src\idle.c - idle.c - 0 - 0 - - - 1 - 5 - 1 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - ..\..\src\ipc.c - ipc.c - 0 - 0 - - - 1 - 6 - 1 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - ..\..\src\irq.c - irq.c - 0 - 0 - - - 1 - 7 - 1 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - ..\..\src\kservice.c - kservice.c - 0 - 0 - - - 1 - 8 - 1 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - ..\..\src\mem.c - mem.c - 0 - 0 - - - 1 - 9 - 1 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - ..\..\src\mempool.c - mempool.c - 0 - 0 - - - 1 - 10 - 1 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - ..\..\src\object.c - object.c - 0 - 0 - - - 1 - 11 - 1 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - ..\..\src\scheduler.c - scheduler.c - 0 - 0 - - - 1 - 12 - 1 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - ..\..\src\signal.c - signal.c - 0 - 0 - - - 1 - 13 - 1 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - ..\..\src\thread.c - thread.c - 0 - 0 - - - 1 - 14 - 1 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - ..\..\src\timer.c - timer.c - 0 - 0 - - - - - Applications - 1 - 0 - 0 - 0 - - 2 - 15 - 1 - 0 - 0 - 14 - 0 - 1 - 16 - 0 - applications\main.c - main.c - 0 - 0 - - - 2 - 16 - 1 - 0 - 0 - 0 - 0 - 0 - 0 - 0 board\board.c board.c 0 0 - 2 - 17 + 1 + 3 1 0 0 @@ -471,8 +239,8 @@ 0 0 - 3 - 18 + 2 + 4 1 0 0 @@ -487,8 +255,8 @@ 0 - 3 - 19 + 2 + 5 1 0 0 @@ -503,8 +271,8 @@ 0 - 3 - 20 + 2 + 6 2 0 0 @@ -521,110 +289,14 @@ - Drivers - 1 - 0 - 0 - 0 - - 4 - 21 - 1 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - drivers\drv_uart.c - drv_uart.c - 0 - 0 - - - 4 - 22 - 1 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - drivers\drv_gpio.c - drv_gpio.c - 0 - 0 - - - - - Libraries - 1 - 0 - 0 - 0 - - 5 - 23 - 1 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - libraries\sys_config\sys_config.c - sys_config.c - 0 - 0 - - - 5 - 24 - 1 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - libraries\mss_gpio\mss_gpio.c - mss_gpio.c - 0 - 0 - - - 5 - 25 - 1 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - libraries\mss_uart\mss_uart.c - mss_uart.c - 0 - 0 - - - - - cpu + CPU 0 0 0 0 - 6 - 26 + 3 + 7 1 0 0 @@ -639,8 +311,8 @@ 0 - 6 - 27 + 3 + 8 1 0 0 @@ -655,8 +327,8 @@ 0 - 6 - 28 + 3 + 9 1 0 0 @@ -671,8 +343,8 @@ 0 - 6 - 29 + 3 + 10 1 0 0 @@ -687,8 +359,8 @@ 0 - 6 - 30 + 3 + 11 2 0 0 @@ -711,8 +383,8 @@ 0 0 - 7 - 31 + 4 + 12 1 0 0 @@ -727,8 +399,8 @@ 0 - 7 - 32 + 4 + 13 1 0 0 @@ -743,8 +415,8 @@ 0 - 7 - 33 + 4 + 14 1 0 0 @@ -759,8 +431,8 @@ 0 - 7 - 34 + 4 + 15 1 0 0 @@ -775,8 +447,8 @@ 0 - 7 - 35 + 4 + 16 1 0 0 @@ -791,8 +463,8 @@ 0 - 7 - 36 + 4 + 17 1 0 0 @@ -807,8 +479,8 @@ 0 - 7 - 37 + 4 + 18 1 0 0 @@ -823,8 +495,8 @@ 0 - 7 - 38 + 4 + 19 1 0 0 @@ -839,8 +511,8 @@ 0 - 7 - 39 + 4 + 20 1 0 0 @@ -856,6 +528,46 @@ + + Drivers + 0 + 0 + 0 + 0 + + 5 + 21 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + drivers\drv_uart.c + drv_uart.c + 0 + 0 + + + 5 + 22 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + drivers\drv_gpio.c + drv_gpio.c + 0 + 0 + + + finsh 0 @@ -863,8 +575,8 @@ 0 0 - 8 - 40 + 6 + 23 1 0 0 @@ -879,8 +591,8 @@ 0 - 8 - 41 + 6 + 24 1 0 0 @@ -895,8 +607,8 @@ 0 - 8 - 42 + 6 + 25 1 0 0 @@ -912,6 +624,222 @@ + + Kernel + 0 + 0 + 0 + 0 + + 7 + 26 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + ..\..\src\clock.c + clock.c + 0 + 0 + + + 7 + 27 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + ..\..\src\components.c + components.c + 0 + 0 + + + 7 + 28 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + ..\..\src\device.c + device.c + 0 + 0 + + + 7 + 29 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + ..\..\src\idle.c + idle.c + 0 + 0 + + + 7 + 30 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + ..\..\src\ipc.c + ipc.c + 0 + 0 + + + 7 + 31 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + ..\..\src\irq.c + irq.c + 0 + 0 + + + 7 + 32 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + ..\..\src\kservice.c + kservice.c + 0 + 0 + + + 7 + 33 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + ..\..\src\mem.c + mem.c + 0 + 0 + + + 7 + 34 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + ..\..\src\mempool.c + mempool.c + 0 + 0 + + + 7 + 35 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + ..\..\src\object.c + object.c + 0 + 0 + + + 7 + 36 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + ..\..\src\scheduler.c + scheduler.c + 0 + 0 + + + 7 + 37 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + ..\..\src\thread.c + thread.c + 0 + 0 + + + 7 + 38 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + ..\..\src\timer.c + timer.c + 0 + 0 + + + libc 0 @@ -919,8 +847,8 @@ 0 0 - 9 - 43 + 8 + 39 1 0 0 @@ -935,8 +863,8 @@ 0 - 9 - 44 + 8 + 40 1 0 0 @@ -951,8 +879,8 @@ 0 - 9 - 45 + 8 + 41 1 0 0 @@ -961,14 +889,30 @@ 0 0 0 - ..\..\components\libc\compilers\armlibc\stubs.c - stubs.c + ..\..\components\libc\compilers\armlibc\syscalls.c + syscalls.c 0 0 - 9 - 46 + 8 + 42 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + ..\..\components\libc\compilers\common\stdlib.c + stdlib.c + 0 + 0 + + + 8 + 43 1 0 0 @@ -984,4 +928,60 @@ + + Libraries + 0 + 0 + 0 + 0 + + 9 + 44 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + libraries\sys_config\sys_config.c + sys_config.c + 0 + 0 + + + 9 + 45 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + libraries\mss_gpio\mss_gpio.c + mss_gpio.c + 0 + 0 + + + 9 + 46 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + libraries\mss_uart\mss_uart.c + mss_uart.c + 0 + 0 + + + diff --git a/bsp/smartfusion2/project.uvoptx b/bsp/smartfusion2/project.uvoptx index a83e5093d3..57f994ae2b 100644 --- a/bsp/smartfusion2/project.uvoptx +++ b/bsp/smartfusion2/project.uvoptx @@ -175,7 +175,7 @@ - Kernel + Applications 0 0 0 @@ -187,8 +187,8 @@ 0 0 0 - ..\..\src\clock.c - clock.c + applications\main.c + main.c 0 0 @@ -199,190 +199,14 @@ 0 0 0 - ..\..\src\components.c - components.c - 0 - 0 - - - 1 - 3 - 1 - 0 - 0 - 0 - ..\..\src\device.c - device.c - 0 - 0 - - - 1 - 4 - 1 - 0 - 0 - 0 - ..\..\src\idle.c - idle.c - 0 - 0 - - - 1 - 5 - 1 - 0 - 0 - 0 - ..\..\src\ipc.c - ipc.c - 0 - 0 - - - 1 - 6 - 1 - 0 - 0 - 0 - ..\..\src\irq.c - irq.c - 0 - 0 - - - 1 - 7 - 1 - 0 - 0 - 0 - ..\..\src\kservice.c - kservice.c - 0 - 0 - - - 1 - 8 - 1 - 0 - 0 - 0 - ..\..\src\mem.c - mem.c - 0 - 0 - - - 1 - 9 - 1 - 0 - 0 - 0 - ..\..\src\mempool.c - mempool.c - 0 - 0 - - - 1 - 10 - 1 - 0 - 0 - 0 - ..\..\src\object.c - object.c - 0 - 0 - - - 1 - 11 - 1 - 0 - 0 - 0 - ..\..\src\scheduler.c - scheduler.c - 0 - 0 - - - 1 - 12 - 1 - 0 - 0 - 0 - ..\..\src\signal.c - signal.c - 0 - 0 - - - 1 - 13 - 1 - 0 - 0 - 0 - ..\..\src\thread.c - thread.c - 0 - 0 - - - 1 - 14 - 1 - 0 - 0 - 0 - ..\..\src\timer.c - timer.c - 0 - 0 - - - - - Applications - 1 - 0 - 0 - 0 - - 2 - 15 - 1 - 0 - 0 - 0 - applications\main.c - main.c - 0 - 0 - - - 2 - 16 - 1 - 0 - 0 - 0 board\board.c board.c 0 0 - 2 - 17 + 1 + 3 1 0 0 @@ -401,8 +225,8 @@ 0 0 - 3 - 18 + 2 + 4 1 0 0 @@ -413,8 +237,8 @@ 0 - 3 - 19 + 2 + 5 1 0 0 @@ -425,8 +249,8 @@ 0 - 3 - 20 + 2 + 6 2 0 0 @@ -439,90 +263,14 @@ - Drivers - 1 - 0 - 0 - 0 - - 4 - 21 - 1 - 0 - 0 - 0 - drivers\drv_uart.c - drv_uart.c - 0 - 0 - - - 4 - 22 - 1 - 0 - 0 - 0 - drivers\drv_gpio.c - drv_gpio.c - 0 - 0 - - - - - Libraries - 1 - 0 - 0 - 0 - - 5 - 23 - 1 - 0 - 0 - 0 - libraries\sys_config\sys_config.c - sys_config.c - 0 - 0 - - - 5 - 24 - 1 - 0 - 0 - 0 - libraries\mss_gpio\mss_gpio.c - mss_gpio.c - 0 - 0 - - - 5 - 25 - 1 - 0 - 0 - 0 - libraries\mss_uart\mss_uart.c - mss_uart.c - 0 - 0 - - - - - cpu + CPU 0 0 0 0 - 6 - 26 + 3 + 7 1 0 0 @@ -533,8 +281,8 @@ 0 - 6 - 27 + 3 + 8 1 0 0 @@ -545,8 +293,8 @@ 0 - 6 - 28 + 3 + 9 1 0 0 @@ -557,8 +305,8 @@ 0 - 6 - 29 + 3 + 10 1 0 0 @@ -569,8 +317,8 @@ 0 - 6 - 30 + 3 + 11 2 0 0 @@ -589,8 +337,8 @@ 0 0 - 7 - 31 + 4 + 12 1 0 0 @@ -601,8 +349,8 @@ 0 - 7 - 32 + 4 + 13 1 0 0 @@ -613,8 +361,8 @@ 0 - 7 - 33 + 4 + 14 1 0 0 @@ -625,8 +373,8 @@ 0 - 7 - 34 + 4 + 15 1 0 0 @@ -637,8 +385,8 @@ 0 - 7 - 35 + 4 + 16 1 0 0 @@ -649,8 +397,8 @@ 0 - 7 - 36 + 4 + 17 1 0 0 @@ -661,8 +409,8 @@ 0 - 7 - 37 + 4 + 18 1 0 0 @@ -673,8 +421,8 @@ 0 - 7 - 38 + 4 + 19 1 0 0 @@ -685,8 +433,8 @@ 0 - 7 - 39 + 4 + 20 1 0 0 @@ -698,6 +446,38 @@ + + Drivers + 0 + 0 + 0 + 0 + + 5 + 21 + 1 + 0 + 0 + 0 + drivers\drv_uart.c + drv_uart.c + 0 + 0 + + + 5 + 22 + 1 + 0 + 0 + 0 + drivers\drv_gpio.c + drv_gpio.c + 0 + 0 + + + finsh 0 @@ -705,8 +485,8 @@ 0 0 - 8 - 40 + 6 + 23 1 0 0 @@ -717,8 +497,8 @@ 0 - 8 - 41 + 6 + 24 1 0 0 @@ -729,8 +509,8 @@ 0 - 8 - 42 + 6 + 25 1 0 0 @@ -742,6 +522,170 @@ + + Kernel + 0 + 0 + 0 + 0 + + 7 + 26 + 1 + 0 + 0 + 0 + ..\..\src\clock.c + clock.c + 0 + 0 + + + 7 + 27 + 1 + 0 + 0 + 0 + ..\..\src\components.c + components.c + 0 + 0 + + + 7 + 28 + 1 + 0 + 0 + 0 + ..\..\src\device.c + device.c + 0 + 0 + + + 7 + 29 + 1 + 0 + 0 + 0 + ..\..\src\idle.c + idle.c + 0 + 0 + + + 7 + 30 + 1 + 0 + 0 + 0 + ..\..\src\ipc.c + ipc.c + 0 + 0 + + + 7 + 31 + 1 + 0 + 0 + 0 + ..\..\src\irq.c + irq.c + 0 + 0 + + + 7 + 32 + 1 + 0 + 0 + 0 + ..\..\src\kservice.c + kservice.c + 0 + 0 + + + 7 + 33 + 1 + 0 + 0 + 0 + ..\..\src\mem.c + mem.c + 0 + 0 + + + 7 + 34 + 1 + 0 + 0 + 0 + ..\..\src\mempool.c + mempool.c + 0 + 0 + + + 7 + 35 + 1 + 0 + 0 + 0 + ..\..\src\object.c + object.c + 0 + 0 + + + 7 + 36 + 1 + 0 + 0 + 0 + ..\..\src\scheduler.c + scheduler.c + 0 + 0 + + + 7 + 37 + 1 + 0 + 0 + 0 + ..\..\src\thread.c + thread.c + 0 + 0 + + + 7 + 38 + 1 + 0 + 0 + 0 + ..\..\src\timer.c + timer.c + 0 + 0 + + + libc 0 @@ -749,8 +693,8 @@ 0 0 - 9 - 43 + 8 + 39 1 0 0 @@ -761,8 +705,8 @@ 0 - 9 - 44 + 8 + 40 1 0 0 @@ -773,20 +717,32 @@ 0 - 9 - 45 + 8 + 41 1 0 0 0 - ..\..\components\libc\compilers\armlibc\stubs.c - stubs.c + ..\..\components\libc\compilers\armlibc\syscalls.c + syscalls.c 0 0 - 9 - 46 + 8 + 42 + 1 + 0 + 0 + 0 + ..\..\components\libc\compilers\common\stdlib.c + stdlib.c + 0 + 0 + + + 8 + 43 1 0 0 @@ -798,4 +754,48 @@ + + Libraries + 0 + 0 + 0 + 0 + + 9 + 44 + 1 + 0 + 0 + 0 + libraries\sys_config\sys_config.c + sys_config.c + 0 + 0 + + + 9 + 45 + 1 + 0 + 0 + 0 + libraries\mss_gpio\mss_gpio.c + mss_gpio.c + 0 + 0 + + + 9 + 46 + 1 + 0 + 0 + 0 + libraries\mss_uart\mss_uart.c + mss_uart.c + 0 + 0 + + + diff --git a/bsp/smartfusion2/project.uvproj b/bsp/smartfusion2/project.uvproj index 34dc365986..2ee7c71eee 100644 --- a/bsp/smartfusion2/project.uvproj +++ b/bsp/smartfusion2/project.uvproj @@ -139,9 +139,9 @@ 1 0 1 - 1 + 0 1 - 0 + 1 0 6 @@ -170,7 +170,7 @@ 0 -1 - 1 + 0 BIN\UL2CM3.DLL @@ -356,13 +356,13 @@ 0 0 0 - 0 + 1 0 - RT_USING_ARM_LIBC + RT_USING_ARM_LIBC, __RTTHREAD__, __CLK_TCK=RT_TICK_PER_SECOND - .;..\..\include;applications;board;CMSIS;drivers;libraries\sys_config;libraries\mss_gpio;libraries\mss_uart;..\..\libcpu\arm\common;..\..\libcpu\arm\cortex-m3;..\..\components\drivers\include;..\..\components\drivers\include;..\..\components\drivers\include;..\..\components\finsh;..\..\components\libc\compilers\armlibc;..\..\components\libc\compilers\common + applications;board;CMSIS;..\..\libcpu\arm\common;..\..\libcpu\arm\cortex-m3;..\..\components\drivers\include;..\..\components\drivers\include;..\..\components\drivers\include;drivers;..\..\components\finsh;.;..\..\include;..\..\components\libc\compilers\armlibc;..\..\components\libc\compilers\common;libraries\sys_config;libraries\mss_gpio;libraries\mss_uart @@ -402,81 +402,6 @@ - - Kernel - - - clock.c - 1 - ..\..\src\clock.c - - - components.c - 1 - ..\..\src\components.c - - - device.c - 1 - ..\..\src\device.c - - - idle.c - 1 - ..\..\src\idle.c - - - ipc.c - 1 - ..\..\src\ipc.c - - - irq.c - 1 - ..\..\src\irq.c - - - kservice.c - 1 - ..\..\src\kservice.c - - - mem.c - 1 - ..\..\src\mem.c - - - mempool.c - 1 - ..\..\src\mempool.c - - - object.c - 1 - ..\..\src\object.c - - - scheduler.c - 1 - ..\..\src\scheduler.c - - - signal.c - 1 - ..\..\src\signal.c - - - thread.c - 1 - ..\..\src\thread.c - - - timer.c - 1 - ..\..\src\timer.c - - - Applications @@ -518,42 +443,7 @@ - Drivers - - - drv_uart.c - 1 - drivers\drv_uart.c - - - drv_gpio.c - 1 - drivers\drv_gpio.c - - - - - Libraries - - - sys_config.c - 1 - libraries\sys_config\sys_config.c - - - mss_gpio.c - 1 - libraries\mss_gpio\mss_gpio.c - - - mss_uart.c - 1 - libraries\mss_uart\mss_uart.c - - - - - cpu + CPU backtrace.c @@ -632,6 +522,21 @@ + + Drivers + + + drv_uart.c + 1 + drivers\drv_uart.c + + + drv_gpio.c + 1 + drivers\drv_gpio.c + + + finsh @@ -652,6 +557,76 @@ + + Kernel + + + clock.c + 1 + ..\..\src\clock.c + + + components.c + 1 + ..\..\src\components.c + + + device.c + 1 + ..\..\src\device.c + + + idle.c + 1 + ..\..\src\idle.c + + + ipc.c + 1 + ..\..\src\ipc.c + + + irq.c + 1 + ..\..\src\irq.c + + + kservice.c + 1 + ..\..\src\kservice.c + + + mem.c + 1 + ..\..\src\mem.c + + + mempool.c + 1 + ..\..\src\mempool.c + + + object.c + 1 + ..\..\src\object.c + + + scheduler.c + 1 + ..\..\src\scheduler.c + + + thread.c + 1 + ..\..\src\thread.c + + + timer.c + 1 + ..\..\src\timer.c + + + libc @@ -666,9 +641,14 @@ ..\..\components\libc\compilers\armlibc\mem_std.c - stubs.c + syscalls.c 1 - ..\..\components\libc\compilers\armlibc\stubs.c + ..\..\components\libc\compilers\armlibc\syscalls.c + + + stdlib.c + 1 + ..\..\components\libc\compilers\common\stdlib.c time.c @@ -677,6 +657,26 @@ + + Libraries + + + sys_config.c + 1 + libraries\sys_config\sys_config.c + + + mss_gpio.c + 1 + libraries\mss_gpio\mss_gpio.c + + + mss_uart.c + 1 + libraries\mss_uart\mss_uart.c + + + diff --git a/bsp/smartfusion2/project.uvprojx b/bsp/smartfusion2/project.uvprojx index 16914df12d..738524c6cb 100644 --- a/bsp/smartfusion2/project.uvprojx +++ b/bsp/smartfusion2/project.uvprojx @@ -10,7 +10,7 @@ project 0x4 ARM-ADS - 5060750::V5.06 update 6 (build 750)::ARMCC + 5060750::V5.06 update 6 (build 750)::.\ARMCC 0 @@ -185,6 +185,7 @@ 0 0 0 + 0 0 0 8 @@ -324,7 +325,7 @@ 2 0 0 - 0 + 1 0 0 1 @@ -336,9 +337,9 @@ 0 - RT_USING_ARM_LIBC + RT_USING_ARM_LIBC, __RTTHREAD__, __CLK_TCK=RT_TICK_PER_SECOND - .;..\..\include;applications;board;CMSIS;drivers;libraries\sys_config;libraries\mss_gpio;libraries\mss_uart;..\..\libcpu\arm\common;..\..\libcpu\arm\cortex-m3;..\..\components\drivers\include;..\..\components\drivers\include;..\..\components\drivers\include;..\..\components\finsh;..\..\components\libc\compilers\armlibc;..\..\components\libc\compilers\common + applications;board;CMSIS;..\..\libcpu\arm\common;..\..\libcpu\arm\cortex-m3;..\..\components\drivers\include;..\..\components\drivers\include;..\..\components\drivers\include;drivers;..\..\components\finsh;.;..\..\include;..\..\components\libc\compilers\armlibc;..\..\components\libc\compilers\common;libraries\sys_config;libraries\mss_gpio;libraries\mss_uart @@ -351,7 +352,7 @@ 0 0 0 - 0 + 4 @@ -379,81 +380,6 @@ - - Kernel - - - clock.c - 1 - ..\..\src\clock.c - - - components.c - 1 - ..\..\src\components.c - - - device.c - 1 - ..\..\src\device.c - - - idle.c - 1 - ..\..\src\idle.c - - - ipc.c - 1 - ..\..\src\ipc.c - - - irq.c - 1 - ..\..\src\irq.c - - - kservice.c - 1 - ..\..\src\kservice.c - - - mem.c - 1 - ..\..\src\mem.c - - - mempool.c - 1 - ..\..\src\mempool.c - - - object.c - 1 - ..\..\src\object.c - - - scheduler.c - 1 - ..\..\src\scheduler.c - - - signal.c - 1 - ..\..\src\signal.c - - - thread.c - 1 - ..\..\src\thread.c - - - timer.c - 1 - ..\..\src\timer.c - - - Applications @@ -495,42 +421,7 @@ - Drivers - - - drv_uart.c - 1 - drivers\drv_uart.c - - - drv_gpio.c - 1 - drivers\drv_gpio.c - - - - - Libraries - - - sys_config.c - 1 - libraries\sys_config\sys_config.c - - - mss_gpio.c - 1 - libraries\mss_gpio\mss_gpio.c - - - mss_uart.c - 1 - libraries\mss_uart\mss_uart.c - - - - - cpu + CPU backtrace.c @@ -609,6 +500,21 @@ + + Drivers + + + drv_uart.c + 1 + drivers\drv_uart.c + + + drv_gpio.c + 1 + drivers\drv_gpio.c + + + finsh @@ -629,6 +535,76 @@ + + Kernel + + + clock.c + 1 + ..\..\src\clock.c + + + components.c + 1 + ..\..\src\components.c + + + device.c + 1 + ..\..\src\device.c + + + idle.c + 1 + ..\..\src\idle.c + + + ipc.c + 1 + ..\..\src\ipc.c + + + irq.c + 1 + ..\..\src\irq.c + + + kservice.c + 1 + ..\..\src\kservice.c + + + mem.c + 1 + ..\..\src\mem.c + + + mempool.c + 1 + ..\..\src\mempool.c + + + object.c + 1 + ..\..\src\object.c + + + scheduler.c + 1 + ..\..\src\scheduler.c + + + thread.c + 1 + ..\..\src\thread.c + + + timer.c + 1 + ..\..\src\timer.c + + + libc @@ -643,9 +619,14 @@ ..\..\components\libc\compilers\armlibc\mem_std.c - stubs.c + syscalls.c 1 - ..\..\components\libc\compilers\armlibc\stubs.c + ..\..\components\libc\compilers\armlibc\syscalls.c + + + stdlib.c + 1 + ..\..\components\libc\compilers\common\stdlib.c time.c @@ -654,6 +635,26 @@ + + Libraries + + + sys_config.c + 1 + libraries\sys_config\sys_config.c + + + mss_gpio.c + 1 + libraries\mss_gpio\mss_gpio.c + + + mss_uart.c + 1 + libraries\mss_uart\mss_uart.c + + + @@ -664,4 +665,19 @@ + + + + <Project Info> + + + + + + 0 + 1 + + + + diff --git a/bsp/smartfusion2/template.uvopt b/bsp/smartfusion2/template.uvopt index 70eae785e9..8735ccdd69 100644 --- a/bsp/smartfusion2/template.uvopt +++ b/bsp/smartfusion2/template.uvopt @@ -110,10 +110,10 @@ 1 0 1 - 1 + 0 1 1 - 0 + 1 0 0 6 diff --git a/bsp/smartfusion2/template.uvproj b/bsp/smartfusion2/template.uvproj index 99fded24dc..356db37361 100644 --- a/bsp/smartfusion2/template.uvproj +++ b/bsp/smartfusion2/template.uvproj @@ -139,9 +139,9 @@ 1 0 1 - 1 + 0 1 - 0 + 1 0 6 @@ -170,7 +170,7 @@ 0 -1 - 1 + 0 BIN\UL2CM3.DLL @@ -356,7 +356,7 @@ 0 0 0 - 0 + 1 0 diff --git a/bsp/smartfusion2/template.uvprojx b/bsp/smartfusion2/template.uvprojx index dbfd0815c2..56ef79c76d 100644 --- a/bsp/smartfusion2/template.uvprojx +++ b/bsp/smartfusion2/template.uvprojx @@ -185,6 +185,7 @@ 0 0 0 + 0 0 0 8 @@ -324,7 +325,7 @@ 2 0 0 - 0 + 1 0 0 1 @@ -351,7 +352,7 @@ 0 0 0 - 0 + 4 @@ -392,4 +393,19 @@ + + + + <Project Info> + + + + + + 0 + 1 + + + + From 762427bedc8a0109971456fb8059866e67de867d Mon Sep 17 00:00:00 2001 From: "yaxing.chen" Date: Fri, 5 Mar 2021 17:13:18 +0800 Subject: [PATCH 3/6] bugfix:remove duplicate files in src list before DefineGroup --- tools/building.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tools/building.py b/tools/building.py index ba995af278..00a9f04107 100644 --- a/tools/building.py +++ b/tools/building.py @@ -626,6 +626,8 @@ def DefineGroup(name, src, depend, **parameters): group['name'] = name group['path'] = group_path if type(src) == type([]): + # remove duplicate elements from list + src = list(set(src)) group['src'] = File(src) else: group['src'] = src From bcc318811cf2f3c73ae141169c92a4d67bdc4912 Mon Sep 17 00:00:00 2001 From: supperthomas <78900636@qq.com> Date: Fri, 5 Mar 2021 22:07:05 +0800 Subject: [PATCH 4/6] [bsp/max32660] add the scons --dist --- bsp/maxim/MAX32660_EVSYS/rtconfig.py | 8 ++++++++ bsp/maxim/tools/sdk_dist.py | 21 +++++++++++++++++++++ 2 files changed, 29 insertions(+) create mode 100644 bsp/maxim/tools/sdk_dist.py diff --git a/bsp/maxim/MAX32660_EVSYS/rtconfig.py b/bsp/maxim/MAX32660_EVSYS/rtconfig.py index 97130e34f5..70faf43ff9 100644 --- a/bsp/maxim/MAX32660_EVSYS/rtconfig.py +++ b/bsp/maxim/MAX32660_EVSYS/rtconfig.py @@ -133,3 +133,11 @@ elif PLATFORM == 'iar': EXEC_PATH = EXEC_PATH + '/arm/bin/' POST_ACTION = 'ielftool --bin $TARGET rtthread.bin' + + +def dist_handle(BSP_ROOT, dist_dir): + import sys + cwd_path = os.getcwd() + sys.path.append(os.path.join(os.path.dirname(BSP_ROOT), 'tools')) + from sdk_dist import dist_do_building + dist_do_building(BSP_ROOT, dist_dir) \ No newline at end of file diff --git a/bsp/maxim/tools/sdk_dist.py b/bsp/maxim/tools/sdk_dist.py new file mode 100644 index 0000000000..2bc57c6b95 --- /dev/null +++ b/bsp/maxim/tools/sdk_dist.py @@ -0,0 +1,21 @@ +import os +import sys +import shutil + +cwd_path = os.getcwd() +sys.path.append(os.path.join(os.path.dirname(cwd_path), 'rt-thread', 'tools')) + + +# BSP dist function +def dist_do_building(BSP_ROOT, dist_dir): + from mkdist import bsp_copy_files + import rtconfig + + print("=> copy maxim bsp library") + library_dir = os.path.join(dist_dir, 'libraries') + library_path = os.path.join(os.path.dirname(BSP_ROOT), 'libraries') + + print("=> copy bsp drivers") + bsp_copy_files(os.path.join(library_path, 'HAL_Drivers'), os.path.join(library_dir, 'HAL_Drivers')) + bsp_copy_files(os.path.join(library_path, 'MAX32660PeriphDriver'), os.path.join(library_dir, 'MAX32660PeriphDriver')) + \ No newline at end of file From 32533127584b6bf98754591a168b5f2962d02ee1 Mon Sep 17 00:00:00 2001 From: Meco Man <920369182@qq.com> Date: Fri, 5 Mar 2021 23:09:00 +0800 Subject: [PATCH 5/6] remove difftime() --- components/libc/compilers/common/time.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/components/libc/compilers/common/time.c b/components/libc/compilers/common/time.c index c2fbd6f333..cc135bcfc9 100644 --- a/components/libc/compilers/common/time.c +++ b/components/libc/compilers/common/time.c @@ -12,7 +12,6 @@ * 2021-02-08 Meco Man add settimeofday() stime() * 2021-02-10 Meco Man add ctime_r() and re-implement ctime() * 2021-02-11 Meco Man fix bug #3183 - align days[] and months[] to 4 bytes - * add difftime() * 2021-02-12 Meco Man add errno * 2012-12-08 Bernard fix the issue of _timevalue.tv_usec initialization, * which found by Rob @@ -177,12 +176,6 @@ char* ctime(const time_t *tim_p) } RTM_EXPORT(ctime); -double difftime (time_t tim1, time_t tim2) -{ - return (double)(tim1 - tim2); -} -RTM_EXPORT(difftime); - /** * Returns the current time. * @@ -372,6 +365,9 @@ int settimeofday(const struct timeval *tv, const struct timezone *tz) } RTM_EXPORT(settimeofday); +RTM_EXPORT(difftime); /* inherent in libc */ +RTM_EXPORT(strftime); /* inherent in libc*/ + #ifdef RT_USING_POSIX static struct timeval _timevalue; static int clock_time_system_init() From ff9210a84d39be7a6860d3fbf89a0a8837a9aba0 Mon Sep 17 00:00:00 2001 From: Meco Man <920369182@qq.com> Date: Fri, 5 Mar 2021 23:13:57 +0800 Subject: [PATCH 6/6] revise comment --- components/libc/compilers/common/time.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/components/libc/compilers/common/time.c b/components/libc/compilers/common/time.c index cc135bcfc9..ed72cc1f3f 100644 --- a/components/libc/compilers/common/time.c +++ b/components/libc/compilers/common/time.c @@ -365,8 +365,9 @@ int settimeofday(const struct timeval *tv, const struct timezone *tz) } RTM_EXPORT(settimeofday); -RTM_EXPORT(difftime); /* inherent in libc */ -RTM_EXPORT(strftime); /* inherent in libc*/ +/* inherent in the toolchain */ +RTM_EXPORT(difftime); +RTM_EXPORT(strftime); #ifdef RT_USING_POSIX static struct timeval _timevalue;