Browse Source

Merge pull request #1756 from RT-Thread/feature_libdl

Feature libdl
Bernard Xiong 6 years ago
parent
commit
52761fb9c8

+ 0 - 3
bsp/beaglebone/am335x_sk.ewp

@@ -1099,9 +1099,6 @@
     <file>
       <name>$PROJ_DIR$\..\..\src\mempool.c</name>
     </file>
-    <file>
-      <name>$PROJ_DIR$\..\..\src\module.c</name>
-    </file>
     <file>
       <name>$PROJ_DIR$\..\..\src\object.c</name>
     </file>

+ 0 - 18
bsp/bf533/vdsp/bf533.dpj

@@ -453,24 +453,6 @@
 								</file-configuration>
 							</file-configurations>
 						</file>
-						<file name="..\..\..\src\module.c">
-							<file-configurations>
-								<file-configuration name="Debug">
-									<excluded-flag value="no"/>
-									<build-with-flag value="project"/>
-									<intermediate-dir>.\Debug</intermediate-dir>
-									<output-dir>.\Debug</output-dir>
-								</file-configuration>
-								<file-configuration name="Release">
-									<excluded-flag value="no"/>
-									<build-with-flag value="project"/>
-									<intermediate-dir>.\Release</intermediate-dir>
-									<output-dir>.\Release</output-dir>
-								</file-configuration>
-							</file-configurations>
-						</file>
-						<file name="..\..\..\src\module.h">
-						</file>
 						<file name="..\..\..\src\object.c">
 							<file-configurations>
 								<file-configuration name="Debug">

+ 0 - 4
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

+ 0 - 3
bsp/lpc54608-LPCXpresso/project.ewp

@@ -2111,9 +2111,6 @@
     <file>
       <name>$PROJ_DIR$\../../src/mempool.c</name>
     </file>
-    <file>
-      <name>$PROJ_DIR$\../../src/module.c</name>
-    </file>
     <file>
       <name>$PROJ_DIR$\../../src/object.c</name>
     </file>

+ 0 - 12
bsp/lpc54608-LPCXpresso/project.uvoptx

@@ -1082,18 +1082,6 @@
       <RteFlg>0</RteFlg>
       <bShared>0</bShared>
     </File>
-    <File>
-      <GroupNumber>5</GroupNumber>
-      <FileNumber>73</FileNumber>
-      <FileType>1</FileType>
-      <tvExp>0</tvExp>
-      <tvExpOptDlg>0</tvExpOptDlg>
-      <bDave2>0</bDave2>
-      <PathWithFileName>../../src/module.c</PathWithFileName>
-      <FilenameWithoutPath>module.c</FilenameWithoutPath>
-      <RteFlg>0</RteFlg>
-      <bShared>0</bShared>
-    </File>
     <File>
       <GroupNumber>5</GroupNumber>
       <FileNumber>74</FileNumber>

+ 0 - 7
bsp/lpc54608-LPCXpresso/project.uvprojx

@@ -891,13 +891,6 @@
               <FilePath>..\..\src\mempool.c</FilePath>
             </File>
           </Files>
-          <Files>
-            <File>
-              <FileName>module.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\src\module.c</FilePath>
-            </File>
-          </Files>
           <Files>
             <File>
               <FileName>object.c</FileName>

+ 1 - 1
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

+ 0 - 3
bsp/mb9bf500r/fm3_easy_kit.ewp

@@ -1784,9 +1784,6 @@
     <file>
       <name>$PROJ_DIR$\..\..\src\mempool.c</name>
     </file>
-    <file>
-      <name>$PROJ_DIR$\..\..\src\module.c</name>
-    </file>
     <file>
       <name>$PROJ_DIR$\..\..\src\object.c</name>
     </file>

+ 0 - 14
bsp/mb9bf500r/project.uvopt

@@ -484,20 +484,6 @@
       <PathWithFileName>..\..\src\mempool.c</PathWithFileName>
       <FilenameWithoutPath>mempool.c</FilenameWithoutPath>
     </File>
-    <File>
-      <GroupNumber>4</GroupNumber>
-      <FileNumber>23</FileNumber>
-      <FileType>1</FileType>
-      <tvExp>0</tvExp>
-      <Focus>0</Focus>
-      <ColumnNumber>0</ColumnNumber>
-      <tvExpOptDlg>0</tvExpOptDlg>
-      <TopLine>0</TopLine>
-      <CurrentLine>0</CurrentLine>
-      <bDave2>0</bDave2>
-      <PathWithFileName>..\..\src\module.c</PathWithFileName>
-      <FilenameWithoutPath>module.c</FilenameWithoutPath>
-    </File>
     <File>
       <GroupNumber>4</GroupNumber>
       <FileNumber>24</FileNumber>

+ 0 - 5
bsp/mb9bf500r/project.uvproj

@@ -513,11 +513,6 @@
               <FileType>1</FileType>
               <FilePath>..\..\src\mempool.c</FilePath>
             </File>
-            <File>
-              <FileName>module.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\src\module.c</FilePath>
-            </File>
             <File>
               <FileName>object.c</FileName>
               <FileType>1</FileType>

+ 0 - 1
bsp/mini2440/project.Uv2

@@ -30,7 +30,6 @@ File 3,1,<../../src/irq.c><irq.c>
 File 3,1,<../../src/kservice.c><kservice.c>
 File 3,1,<../../src/mem.c><mem.c>
 File 3,1,<../../src/mempool.c><mempool.c>
-File 3,1,<../../src/module.c><module.c>
 File 3,1,<../../src/object.c><object.c>
 File 3,1,<../../src/scheduler.c><scheduler.c>
 File 3,1,<../../src/signal.c><signal.c>

+ 0 - 7
bsp/mini2440/project.uvproj

@@ -493,13 +493,6 @@
               <FilePath>../../src/mempool.c</FilePath>
             </File>
           </Files>
-          <Files>
-            <File>
-              <FileName>module.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>../../src/module.c</FilePath>
-            </File>
-          </Files>
           <Files>
             <File>
               <FileName>object.c</FileName>

+ 0 - 2
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

+ 0 - 4
bsp/pic32ethernet/project.cbp

@@ -412,10 +412,6 @@
 		<Unit filename="..\..\src\mempool.c">
 			<Option compilerVar="CC" />
 		</Unit>
-		<Unit filename="..\..\src\module.c">
-			<Option compilerVar="CC" />
-		</Unit>
-		<Unit filename="..\..\src\module.h" />
 		<Unit filename="..\..\src\object.c">
 			<Option compilerVar="CC" />
 		</Unit>

+ 0 - 2
bsp/rx/project.vpj

@@ -303,8 +303,6 @@
 			<F N="../../src/mem.c"/>
 			<F N="../../src/memheap.c"/>
 			<F N="../../src/mempool.c"/>
-			<F N="../../src/module.c"/>
-			<F N="../../src/module.h"/>
 			<F N="../../src/object.c"/>
 			<F N="../../src/scheduler.c"/>
 			<F N="../../src/SConscript"/>

+ 9 - 7
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)
+#ifdef RT_USING_DFS
+#ifdef DFS_USING_WORKDIR
+    if (msh_exec_script(cmd, length) == 0)
     {
         return 0;
     }
 #endif
 
-#if defined(RT_USING_DFS) && defined(DFS_USING_WORKDIR)
-    if (msh_exec_script(cmd, length) == 0)
+#ifdef RT_USING_MODULE
+    if (msh_exec_module(cmd, length) == 0)
     {
         return 0;
     }
 #endif
 
-#if defined(RT_USING_LWP) && defined(RT_USING_DFS)
+#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 ++;
     }

+ 1 - 0
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;

+ 6 - 0
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");