From e49a29f2dc306213a73a4f3c68d1ac9a34f49d9a Mon Sep 17 00:00:00 2001 From: aozima Date: Mon, 2 Jul 2018 09:56:12 +0800 Subject: [PATCH 1/3] [shell] add re-initial check. --- components/finsh/shell.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/components/finsh/shell.c b/components/finsh/shell.c index 6bdb418120..66a0141de2 100644 --- a/components/finsh/shell.c +++ b/components/finsh/shell.c @@ -726,6 +726,12 @@ int finsh_system_init(void) rt_err_t result = RT_EOK; rt_thread_t tid; + if(shell) + { + rt_kprintf("finsh shell already init.\n"); + return RT_EOK; + } + #ifdef FINSH_USING_SYMTAB #ifdef __CC_ARM /* ARM C Compiler */ extern const int FSymTab$$Base; From 000fe93b9f416be3d08805b71b8d1eb51b9818fe Mon Sep 17 00:00:00 2001 From: aozima Date: Mon, 2 Jul 2018 10:02:16 +0800 Subject: [PATCH 2/3] [lwip] add re-initial check. --- components/net/lwip-2.0.2/src/arch/sys_arch.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/components/net/lwip-2.0.2/src/arch/sys_arch.c b/components/net/lwip-2.0.2/src/arch/sys_arch.c index c8e1fe1d33..316b970048 100644 --- a/components/net/lwip-2.0.2/src/arch/sys_arch.c +++ b/components/net/lwip-2.0.2/src/arch/sys_arch.c @@ -136,11 +136,19 @@ static void tcpip_init_done_callback(void *arg) * LwIP system initialization */ extern int eth_system_device_init_private(void); +static volatile uint8_t init_ok = 0; int lwip_system_init(void) { rt_err_t rc; struct rt_semaphore done_sem; - + + if(init_ok) + { + rt_kprintf("lwip system already init.\n"); + return 0; + } + init_ok = 1; + eth_system_device_init_private(); /* set default netif to NULL */ From f3fc141f5f9a99a0f1bb7cd731ee4410b43f32f8 Mon Sep 17 00:00:00 2001 From: aozima Date: Mon, 2 Jul 2018 16:57:19 +0800 Subject: [PATCH 3/3] [dfs] add re-initial check. --- components/dfs/src/dfs.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/components/dfs/src/dfs.c b/components/dfs/src/dfs.c index fbc0899d36..459ab52793 100644 --- a/components/dfs/src/dfs.c +++ b/components/dfs/src/dfs.c @@ -55,8 +55,16 @@ static int fd_alloc(struct dfs_fdtable *fdt, int startfd); /** * this function will initialize device file system. */ +static volatile uint8_t init_ok = 0; int dfs_init(void) { + if(init_ok) + { + rt_kprintf("dfs already init.\n"); + return 0; + } + init_ok = 1; + /* clear filesystem operations table */ memset((void *)filesystem_operation_table, 0, sizeof(filesystem_operation_table)); /* clear filesystem table */