mirror of https://github.com/RT-Thread/rt-thread
[mini2440]support more finsh cmd for GCC version
git-svn-id: https://rt-thread.googlecode.com/svn/trunk@453 bbd45198-f89e-11dd-88c7-29a3b14d5316
This commit is contained in:
parent
a96bfb9836
commit
03d17809b7
|
@ -6,10 +6,22 @@ SECTIONS
|
||||||
. = 0x30000000;
|
. = 0x30000000;
|
||||||
|
|
||||||
. = ALIGN(4);
|
. = ALIGN(4);
|
||||||
.text : {
|
.text :
|
||||||
|
{
|
||||||
*(.init)
|
*(.init)
|
||||||
*(.text)
|
*(.text)
|
||||||
*(.gnu.linkonce.t*)
|
*(.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);
|
. = ALIGN(4);
|
||||||
|
|
|
@ -90,9 +90,10 @@ if PLATFORM == 'gcc':
|
||||||
else:
|
else:
|
||||||
CFLAGS += ' -O2'
|
CFLAGS += ' -O2'
|
||||||
|
|
||||||
|
if RT_USING_FINSH:
|
||||||
|
CFLAGS += ' -D FINSH_USING_SYMTAB -DFINSH_USING_DESCRIPTION'
|
||||||
if RT_USING_WEBSERVER:
|
if RT_USING_WEBSERVER:
|
||||||
CFLAGS += ' -DWEBS -DUEMF -DRTT -D__NO_FCNTL=1 -DRT_USING_WEBSERVER'
|
CFLAGS += ' -DWEBS -DUEMF -DRTT -D__NO_FCNTL=1 -DRT_USING_WEBSERVER'
|
||||||
|
|
||||||
RT_USING_MINILIBC = True
|
RT_USING_MINILIBC = True
|
||||||
POST_ACTION = OBJCPY + ' -O binary $TARGET rtthread.bin\n' + SIZE + ' $TARGET \n'
|
POST_ACTION = OBJCPY + ' -O binary $TARGET rtthread.bin\n' + SIZE + ' $TARGET \n'
|
||||||
|
|
||||||
|
|
|
@ -68,10 +68,6 @@ void dfs_init()
|
||||||
|
|
||||||
/* clean fd table */
|
/* clean fd table */
|
||||||
rt_memset(fd_table, 0, sizeof(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()
|
void dfs_lock()
|
||||||
|
|
|
@ -581,7 +581,7 @@ int dfile_raw_rename(const char* oldpath, const char* newpath)
|
||||||
static char fullpath[256 + 1];
|
static char fullpath[256 + 1];
|
||||||
static struct dfs_fd fd;
|
static struct dfs_fd fd;
|
||||||
static struct dfs_dirent dirent;
|
static struct dfs_dirent dirent;
|
||||||
void __ls(const char* pathname)
|
void ls(const char* pathname)
|
||||||
{
|
{
|
||||||
struct dfs_stat stat;
|
struct dfs_stat stat;
|
||||||
int length;
|
int length;
|
||||||
|
@ -622,9 +622,9 @@ void __ls(const char* pathname)
|
||||||
rt_kprintf("No such directory\n");
|
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 */
|
/* make a new directory */
|
||||||
if (dfile_raw_open(&fd, pathname, DFS_O_DIRECTORY | DFS_O_CREAT) == 0)
|
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);
|
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)
|
if (dfile_raw_unlink(filename) < 0)
|
||||||
{
|
{
|
||||||
rt_kprintf("Delete %s failed\n", filename);
|
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;
|
rt_uint32_t length;
|
||||||
char buffer[81];
|
char buffer[81];
|
||||||
|
@ -667,15 +667,6 @@ void __cat(const char* filename)
|
||||||
|
|
||||||
dfile_raw_close(&fd);
|
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
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue