Merge pull request #1756 from RT-Thread/feature_libdl

Feature libdl
This commit is contained in:
Bernard Xiong 2018-09-01 11:55:53 +08:00 committed by GitHub
commit 52761fb9c8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
18 changed files with 21 additions and 97 deletions

View File

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

View File

@ -453,24 +453,6 @@
</file-configuration> </file-configuration>
</file-configurations> </file-configurations>
</file> </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 name="..\..\..\src\object.c">
<file-configurations> <file-configurations>
<file-configuration name="Debug"> <file-configuration name="Debug">

View File

@ -138,10 +138,6 @@ bf533_Debug : ./Debug/bf533.ldr
@echo "..\..\..\src\mempool.c" @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 $(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 ./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" @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 $(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

View File

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

View File

@ -1082,18 +1082,6 @@
<RteFlg>0</RteFlg> <RteFlg>0</RteFlg>
<bShared>0</bShared> <bShared>0</bShared>
</File> </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> <File>
<GroupNumber>5</GroupNumber> <GroupNumber>5</GroupNumber>
<FileNumber>74</FileNumber> <FileNumber>74</FileNumber>

View File

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

View File

@ -41,7 +41,7 @@
#define RT_USING_CONSOLE #define RT_USING_CONSOLE
#define RT_CONSOLEBUF_SIZE 128 #define RT_CONSOLEBUF_SIZE 128
#define RT_CONSOLE_DEVICE_NAME "uart0" #define RT_CONSOLE_DEVICE_NAME "uart0"
#define RT_USING_MODULE // #define RT_USING_MODULE
#define ARCH_ARM #define ARCH_ARM
#define ARCH_ARM_CORTEX_M #define ARCH_ARM_CORTEX_M
#define ARCH_ARM_CORTEX_M4 #define ARCH_ARM_CORTEX_M4

View File

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

View File

@ -484,20 +484,6 @@
<PathWithFileName>..\..\src\mempool.c</PathWithFileName> <PathWithFileName>..\..\src\mempool.c</PathWithFileName>
<FilenameWithoutPath>mempool.c</FilenameWithoutPath> <FilenameWithoutPath>mempool.c</FilenameWithoutPath>
</File> </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> <File>
<GroupNumber>4</GroupNumber> <GroupNumber>4</GroupNumber>
<FileNumber>24</FileNumber> <FileNumber>24</FileNumber>

View File

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

View File

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

View File

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

View File

@ -26,8 +26,6 @@
kservice.h kservice.h
mem.c mem.c
mempool.c mempool.c
module.c
module.h
object.c object.c
rtm.c rtm.c
scheduler.c scheduler.c

View File

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

View File

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

View File

@ -376,25 +376,27 @@ int msh_exec(char *cmd, rt_size_t length)
{ {
return cmd_ret; return cmd_ret;
} }
#if defined(RT_USING_MODULE) && defined(RT_USING_DFS) #ifdef RT_USING_DFS
if (msh_exec_module(cmd, length) == 0) #ifdef DFS_USING_WORKDIR
{
return 0;
}
#endif
#if defined(RT_USING_DFS) && defined(DFS_USING_WORKDIR)
if (msh_exec_script(cmd, length) == 0) if (msh_exec_script(cmd, length) == 0)
{ {
return 0; return 0;
} }
#endif #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) if (_msh_exec_lwp(cmd, length) == 0)
{ {
return 0; return 0;
} }
#endif
#endif #endif
/* truncate the cmd at the first space. */ /* truncate the cmd at the first space. */
@ -449,8 +451,8 @@ void msh_auto_complete_path(char *path)
ptr = path; ptr = path;
for (;;) for (;;)
{ {
if (*ptr == '/') index = ptr + 1; if (*ptr == '/') index = ptr + 1;
if (!*ptr) break; if (!*ptr) break;
ptr ++; ptr ++;
} }

View File

@ -277,6 +277,7 @@ rt_err_t dlmodule_load_relocated_object(struct rt_dlmodule* module, void *module
rt_kprintf("Module: allocate space failed.\n"); rt_kprintf("Module: allocate space failed.\n");
return -RT_ERROR; return -RT_ERROR;
} }
module->mem_size = module_size;
/* zero all space */ /* zero all space */
ptr = module->mem_space; ptr = module->mem_space;

View File

@ -491,6 +491,12 @@ struct rt_dlmodule* dlmodule_load(const char* filename)
/* increase module reference count */ /* increase module reference count */
module->nref ++; 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 */ /* set module initialization and cleanup function */
module->init_func = dlsym(module, "module_init"); module->init_func = dlsym(module, "module_init");
module->cleanup_func = dlsym(module, "module_cleanup"); module->cleanup_func = dlsym(module, "module_cleanup");