diff --git a/bsp/beaglebone/am335x_sk.ewp b/bsp/beaglebone/am335x_sk.ewp
index c71c566b05..a898b36242 100644
--- a/bsp/beaglebone/am335x_sk.ewp
+++ b/bsp/beaglebone/am335x_sk.ewp
@@ -1099,9 +1099,6 @@
$PROJ_DIR$\..\..\src\mempool.c
-
- $PROJ_DIR$\..\..\src\module.c
-
$PROJ_DIR$\..\..\src\object.c
diff --git a/bsp/bf533/vdsp/bf533.dpj b/bsp/bf533/vdsp/bf533.dpj
index 621aa26ddb..f8b61a5d78 100644
--- a/bsp/bf533/vdsp/bf533.dpj
+++ b/bsp/bf533/vdsp/bf533.dpj
@@ -453,24 +453,6 @@
-
-
-
-
-
- .\Debug
- .\Debug
-
-
-
-
- .\Release
- .\Release
-
-
-
-
-
diff --git a/bsp/bf533/vdsp/bf533.mak b/bsp/bf533/vdsp/bf533.mak
index eeeefbf2ec..fbefd9858e 100644
--- a/bsp/bf533/vdsp/bf533.mak
+++ b/bsp/bf533/vdsp/bf533.mak
@@ -138,10 +138,6 @@ bf533_Debug : ./Debug/bf533.ldr
@echo "..\..\..\src\mempool.c"
$(VDSP)/ccblkfn.exe -c ..\..\..\src\mempool.c -file-attr ProjectName=bf533 -g -structs-do-not-overlap -no-multiline -I ../../../include -I ../ -I ../../../components/finsh -I ../../../libcpu/blackfin/bf53x -I ../../../src -double-size-64 -decls-strong -warn-protos -proc ADSP-BF533 -o .\Debug\mempool.doj -MM
-./Debug/module.doj :../../../src/module.c ../../../include/rthw.h ../../../include/rtthread.h ../../../include/rtdef.h ../rtconfig.h $(VDSP)/Blackfin/include/stdarg.h $(VDSP)/Blackfin/include/yvals.h ../../../include/rtdebug.h ../../../include/rtservice.h ../../../include/rtm.h $(VDSP)/Blackfin/include/string.h
- @echo "..\..\..\src\module.c"
- $(VDSP)/ccblkfn.exe -c ..\..\..\src\module.c -file-attr ProjectName=bf533 -g -structs-do-not-overlap -no-multiline -I ../../../include -I ../ -I ../../../components/finsh -I ../../../libcpu/blackfin/bf53x -I ../../../src -double-size-64 -decls-strong -warn-protos -proc ADSP-BF533 -o .\Debug\module.doj -MM
-
./Debug/object.doj :../../../src/object.c ../../../include/rtthread.h ../../../include/rtdef.h ../rtconfig.h $(VDSP)/Blackfin/include/stdarg.h $(VDSP)/Blackfin/include/yvals.h ../../../include/rtdebug.h ../../../include/rtservice.h ../../../include/rthw.h
@echo "..\..\..\src\object.c"
$(VDSP)/ccblkfn.exe -c ..\..\..\src\object.c -file-attr ProjectName=bf533 -g -structs-do-not-overlap -no-multiline -I ../../../include -I ../ -I ../../../components/finsh -I ../../../libcpu/blackfin/bf53x -I ../../../src -double-size-64 -decls-strong -warn-protos -proc ADSP-BF533 -o .\Debug\object.doj -MM
diff --git a/bsp/lpc54608-LPCXpresso/project.ewp b/bsp/lpc54608-LPCXpresso/project.ewp
index 5e297ee1ab..22154af07d 100644
--- a/bsp/lpc54608-LPCXpresso/project.ewp
+++ b/bsp/lpc54608-LPCXpresso/project.ewp
@@ -2111,9 +2111,6 @@
$PROJ_DIR$\../../src/mempool.c
-
- $PROJ_DIR$\../../src/module.c
-
$PROJ_DIR$\../../src/object.c
diff --git a/bsp/lpc54608-LPCXpresso/project.uvoptx b/bsp/lpc54608-LPCXpresso/project.uvoptx
index 568861960e..ea669a615e 100644
--- a/bsp/lpc54608-LPCXpresso/project.uvoptx
+++ b/bsp/lpc54608-LPCXpresso/project.uvoptx
@@ -1082,18 +1082,6 @@
0
0
-
- 5
- 73
- 1
- 0
- 0
- 0
- ../../src/module.c
- module.c
- 0
- 0
-
5
74
diff --git a/bsp/lpc54608-LPCXpresso/project.uvprojx b/bsp/lpc54608-LPCXpresso/project.uvprojx
index d20f677e9e..d071fe62c0 100644
--- a/bsp/lpc54608-LPCXpresso/project.uvprojx
+++ b/bsp/lpc54608-LPCXpresso/project.uvprojx
@@ -891,13 +891,6 @@
..\..\src\mempool.c
-
-
- module.c
- 1
- ..\..\src\module.c
-
-
object.c
diff --git a/bsp/lpc54608-LPCXpresso/rtconfig.h b/bsp/lpc54608-LPCXpresso/rtconfig.h
index 540ba96030..7738810b58 100644
--- a/bsp/lpc54608-LPCXpresso/rtconfig.h
+++ b/bsp/lpc54608-LPCXpresso/rtconfig.h
@@ -41,7 +41,7 @@
#define RT_USING_CONSOLE
#define RT_CONSOLEBUF_SIZE 128
#define RT_CONSOLE_DEVICE_NAME "uart0"
-#define RT_USING_MODULE
+// #define RT_USING_MODULE
#define ARCH_ARM
#define ARCH_ARM_CORTEX_M
#define ARCH_ARM_CORTEX_M4
diff --git a/bsp/mb9bf500r/fm3_easy_kit.ewp b/bsp/mb9bf500r/fm3_easy_kit.ewp
index 413df3c022..d51d49cf6b 100644
--- a/bsp/mb9bf500r/fm3_easy_kit.ewp
+++ b/bsp/mb9bf500r/fm3_easy_kit.ewp
@@ -1784,9 +1784,6 @@
$PROJ_DIR$\..\..\src\mempool.c
-
- $PROJ_DIR$\..\..\src\module.c
-
$PROJ_DIR$\..\..\src\object.c
diff --git a/bsp/mb9bf500r/project.uvopt b/bsp/mb9bf500r/project.uvopt
index af19ecd27e..f4ebac8267 100644
--- a/bsp/mb9bf500r/project.uvopt
+++ b/bsp/mb9bf500r/project.uvopt
@@ -484,20 +484,6 @@
..\..\src\mempool.c
mempool.c
-
- 4
- 23
- 1
- 0
- 0
- 0
- 0
- 0
- 0
- 0
- ..\..\src\module.c
- module.c
-
4
24
diff --git a/bsp/mb9bf500r/project.uvproj b/bsp/mb9bf500r/project.uvproj
index 28a0d0dccf..971e04f6e1 100644
--- a/bsp/mb9bf500r/project.uvproj
+++ b/bsp/mb9bf500r/project.uvproj
@@ -513,11 +513,6 @@
1
..\..\src\mempool.c
-
- module.c
- 1
- ..\..\src\module.c
-
object.c
1
diff --git a/bsp/mini2440/project.Uv2 b/bsp/mini2440/project.Uv2
index b8dd2195ba..be4f65b05d 100644
--- a/bsp/mini2440/project.Uv2
+++ b/bsp/mini2440/project.Uv2
@@ -30,7 +30,6 @@ File 3,1,<../../src/irq.c>
File 3,1,<../../src/kservice.c>
File 3,1,<../../src/mem.c>
File 3,1,<../../src/mempool.c>
-File 3,1,<../../src/module.c>
File 3,1,<../../src/object.c>
File 3,1,<../../src/scheduler.c>
File 3,1,<../../src/signal.c>
diff --git a/bsp/mini2440/project.uvproj b/bsp/mini2440/project.uvproj
index d29e75e701..5eb27ce34b 100644
--- a/bsp/mini2440/project.uvproj
+++ b/bsp/mini2440/project.uvproj
@@ -493,13 +493,6 @@
../../src/mempool.c
-
-
- module.c
- 1
- ../../src/module.c
-
-
object.c
diff --git a/bsp/nios_ii/readme_cn.txt b/bsp/nios_ii/readme_cn.txt
index 6884bee2bf..40a1245a3e 100644
--- a/bsp/nios_ii/readme_cn.txt
+++ b/bsp/nios_ii/readme_cn.txt
@@ -26,8 +26,6 @@
kservice.h
mem.c
mempool.c
- module.c
- module.h
object.c
rtm.c
scheduler.c
diff --git a/bsp/pic32ethernet/project.cbp b/bsp/pic32ethernet/project.cbp
index cdba10e0a6..ad51307464 100644
--- a/bsp/pic32ethernet/project.cbp
+++ b/bsp/pic32ethernet/project.cbp
@@ -412,10 +412,6 @@
-
-
-
-
diff --git a/bsp/rx/project.vpj b/bsp/rx/project.vpj
index 9e8b56055f..741e2059d6 100644
--- a/bsp/rx/project.vpj
+++ b/bsp/rx/project.vpj
@@ -303,8 +303,6 @@
-
-
diff --git a/components/finsh/msh.c b/components/finsh/msh.c
index 456486c17e..a724b65faa 100644
--- a/components/finsh/msh.c
+++ b/components/finsh/msh.c
@@ -376,25 +376,27 @@ int msh_exec(char *cmd, rt_size_t length)
{
return cmd_ret;
}
-#if defined(RT_USING_MODULE) && defined(RT_USING_DFS)
- if (msh_exec_module(cmd, length) == 0)
- {
- return 0;
- }
-#endif
-
-#if defined(RT_USING_DFS) && defined(DFS_USING_WORKDIR)
+#ifdef RT_USING_DFS
+#ifdef DFS_USING_WORKDIR
if (msh_exec_script(cmd, length) == 0)
{
return 0;
}
#endif
-#if defined(RT_USING_LWP) && defined(RT_USING_DFS)
+#ifdef RT_USING_MODULE
+ if (msh_exec_module(cmd, length) == 0)
+ {
+ return 0;
+ }
+#endif
+
+#ifdef RT_USING_LWP
if (_msh_exec_lwp(cmd, length) == 0)
{
return 0;
}
+#endif
#endif
/* truncate the cmd at the first space. */
@@ -449,8 +451,8 @@ void msh_auto_complete_path(char *path)
ptr = path;
for (;;)
{
- if (*ptr == '/') index = ptr + 1;
- if (!*ptr) break;
+ if (*ptr == '/') index = ptr + 1;
+ if (!*ptr) break;
ptr ++;
}
diff --git a/components/libc/libdl/dlelf.c b/components/libc/libdl/dlelf.c
index 8075af1374..6d83424b80 100644
--- a/components/libc/libdl/dlelf.c
+++ b/components/libc/libdl/dlelf.c
@@ -277,6 +277,7 @@ rt_err_t dlmodule_load_relocated_object(struct rt_dlmodule* module, void *module
rt_kprintf("Module: allocate space failed.\n");
return -RT_ERROR;
}
+ module->mem_size = module_size;
/* zero all space */
ptr = module->mem_space;
diff --git a/components/libc/libdl/dlmodule.c b/components/libc/libdl/dlmodule.c
index 844ad897cf..61ffbfc772 100644
--- a/components/libc/libdl/dlmodule.c
+++ b/components/libc/libdl/dlmodule.c
@@ -491,6 +491,12 @@ struct rt_dlmodule* dlmodule_load(const char* filename)
/* increase module reference count */
module->nref ++;
+ /* deal with cache */
+#ifdef RT_USING_CACHE
+ rt_hw_cpu_dcache_ops(RT_HW_CACHE_FLUSH, module->mem_space, module->mem_size);
+ rt_hw_cpu_icache_ops(RT_HW_CACHE_INVALIDATE, module->mem_space, module->mem_size);
+#endif
+
/* set module initialization and cleanup function */
module->init_func = dlsym(module, "module_init");
module->cleanup_func = dlsym(module, "module_cleanup");