diff --git a/components/finsh/msh.c b/components/finsh/msh.c index 456486c17e7b631ac8f2dee57e08d66b793fc56d..a724b65faaaa546e70b734f39659ff2f210bcce7 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) +#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 ++; } diff --git a/components/libc/libdl/dlelf.c b/components/libc/libdl/dlelf.c index 8075af137496bd94c072428417abdceef5880e7d..6d83424b80a06671d661cb8001910d6bf57430b9 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 844ad897cf73bb5ecf847209f698e9e5bb207891..61ffbfc7727895aba38dd6a4140139cff4b728a0 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");