diff --git a/bsp/mini2440/mini2440_ram.ld b/bsp/mini2440/mini2440_ram.ld index 727e65ea0f..95856f2688 100644 --- a/bsp/mini2440/mini2440_ram.ld +++ b/bsp/mini2440/mini2440_ram.ld @@ -6,10 +6,22 @@ SECTIONS . = 0x30000000; . = ALIGN(4); - .text : { + .text : + { *(.init) *(.text) *(.gnu.linkonce.t*) + + /* section information for finsh shell */ + . = ALIGN(4); + __fsymtab_start = .; + KEEP(*(FSymTab)) + __fsymtab_end = .; + . = ALIGN(4); + __vsymtab_start = .; + KEEP(*(VSymTab)) + __vsymtab_end = .; + . = ALIGN(4); } . = ALIGN(4); diff --git a/bsp/mini2440/rtconfig.py b/bsp/mini2440/rtconfig.py index 9b1846db74..fd9e605ef4 100644 --- a/bsp/mini2440/rtconfig.py +++ b/bsp/mini2440/rtconfig.py @@ -90,9 +90,10 @@ if PLATFORM == 'gcc': else: CFLAGS += ' -O2' + if RT_USING_FINSH: + CFLAGS += ' -D FINSH_USING_SYMTAB -DFINSH_USING_DESCRIPTION' if RT_USING_WEBSERVER: CFLAGS += ' -DWEBS -DUEMF -DRTT -D__NO_FCNTL=1 -DRT_USING_WEBSERVER' - RT_USING_MINILIBC = True POST_ACTION = OBJCPY + ' -O binary $TARGET rtthread.bin\n' + SIZE + ' $TARGET \n' diff --git a/filesystem/dfs/src/dfs_init.c b/filesystem/dfs/src/dfs_init.c index 7922bd438c..2667c7dd88 100644 --- a/filesystem/dfs/src/dfs_init.c +++ b/filesystem/dfs/src/dfs_init.c @@ -68,10 +68,6 @@ void dfs_init() /* clean fd table */ rt_memset(fd_table, 0, sizeof(fd_table)); - -#if defined(RT_USING_FINSH) && !defined(FINSH_USING_SYMTAB) - dfs_export_finsh(); -#endif } void dfs_lock() diff --git a/filesystem/dfs/src/dfs_raw.c b/filesystem/dfs/src/dfs_raw.c index e87348572b..ec0bce6820 100644 --- a/filesystem/dfs/src/dfs_raw.c +++ b/filesystem/dfs/src/dfs_raw.c @@ -581,7 +581,7 @@ int dfile_raw_rename(const char* oldpath, const char* newpath) static char fullpath[256 + 1]; static struct dfs_fd fd; static struct dfs_dirent dirent; -void __ls(const char* pathname) +void ls(const char* pathname) { struct dfs_stat stat; int length; @@ -622,9 +622,9 @@ void __ls(const char* pathname) rt_kprintf("No such directory\n"); } } -FINSH_FUNCTION_EXPORT(__ls, list directory contents) +FINSH_FUNCTION_EXPORT(ls, list directory contents) -void __mkdir(const char* pathname) +void _mkdir(const char* pathname) { /* make a new directory */ if (dfile_raw_open(&fd, pathname, DFS_O_DIRECTORY | DFS_O_CREAT) == 0) @@ -633,18 +633,18 @@ void __mkdir(const char* pathname) } else rt_kprintf("Can't mkdir %s\n", pathname); } -FINSH_FUNCTION_EXPORT(__mkdir, make a directory) +FINSH_FUNCTION_EXPORT(_mkdir, make a directory) -void __rm(const char* filename) +void rm(const char* filename) { if (dfile_raw_unlink(filename) < 0) { rt_kprintf("Delete %s failed\n", filename); } } -FINSH_FUNCTION_EXPORT(__rm, remove files or directories) +FINSH_FUNCTION_EXPORT(rm, remove files or directories) -void __cat(const char* filename) +void cat(const char* filename) { rt_uint32_t length; char buffer[81]; @@ -667,15 +667,6 @@ void __cat(const char* filename) dfile_raw_close(&fd); } -FINSH_FUNCTION_EXPORT(__cat, print file) +FINSH_FUNCTION_EXPORT(cat, print file) -#ifndef FINSH_USING_SYMTAB -void dfs_export_finsh(void) -{ - finsh_syscall_append("ls", (syscall_func)__ls); - finsh_syscall_append("mkdir", (syscall_func)__mkdir); - finsh_syscall_append("rm", (syscall_func)__rm); - finsh_syscall_append("cat", (syscall_func)__cat); -} -#endif #endif