diff --git a/bsp/simulator/SConstruct b/bsp/simulator/SConstruct index c58b6c1acb1e030f06b12edad50a5e3db1d7c938..513a5a41edc88870ccd908994e2414fff4589043 100644 --- a/bsp/simulator/SConstruct +++ b/bsp/simulator/SConstruct @@ -75,6 +75,9 @@ if GetDepend('RT_USING_RTGUI'): objs = objs + SConscript(RTT_ROOT + '/examples/gui/SConscript', variant_dir='build/examples/gui', duplicate=0) +if GetDepend('RT_USING_TC'): + objs = objs + SConscript(RTT_ROOT + '/examples/kernel/SConscript', variant_dir = 'build/tc/kernel', duplicate=0) + # build program program = env.Program(TARGET, objs) diff --git a/components/finsh/cmd.c b/components/finsh/cmd.c index 632577404eb1b1250215b4922506f0b40042de15..4ebbfc62d6e4330ef40d28c903623834dbeb5d29 100644 --- a/components/finsh/cmd.c +++ b/components/finsh/cmd.c @@ -32,21 +32,6 @@ #include #include "finsh.h" -#if defined(_MSC_VER) -static struct finsh_syscall* _next_syscall(struct finsh_syscall* call) -{ - unsigned int *ptr; - ptr = (unsigned int*) (call + 1); - while ((*ptr == 0) && ((unsigned int*)ptr < (unsigned int*) _syscall_table_end)) - ptr ++; - - return (struct finsh_syscall*)ptr; -} -#define _NEXT_SYSCALl(index) index=_next_syscall(index) -#else -#define _NEXT_SYSCALl(index) index++ -#endif - rt_inline unsigned int rt_list_len(const rt_list_t *l) { @@ -564,7 +549,7 @@ long list(void) rt_kprintf("--Function List:\n"); { struct finsh_syscall *index; - for (index = _syscall_table_begin; index < _syscall_table_end; _NEXT_SYSCALl(index)) + for (index = _syscall_table_begin; index < _syscall_table_end; FINSH_NEXT_SYSCALL(index)) { #ifdef FINSH_USING_DESCRIPTION rt_kprintf("%-16s -- %s\n", index->name, index->desc); @@ -649,7 +634,7 @@ void list_prefix(char *prefix) /* checks in system function call */ { struct finsh_syscall* index; - for (index = _syscall_table_begin; index < _syscall_table_end; _NEXT_SYSCALl(index)) + for (index = _syscall_table_begin; index < _syscall_table_end; FINSH_NEXT_SYSCALL(index)) { if (str_is_prefix(prefix, index->name) == 0) { diff --git a/components/finsh/finsh.h b/components/finsh/finsh.h index 0ada00ea0366b8f1aee6a239a06b74bcfd46c069..994509bd64099defd3378f9aaff791f4c4a4ebb3 100644 --- a/components/finsh/finsh.h +++ b/components/finsh/finsh.h @@ -148,6 +148,13 @@ struct finsh_sysvar void* var ; /* the address of variable */ }; +#if defined(_MSC_VER) +struct finsh_syscall* finsh_syscall_next(struct finsh_syscall* call); +#define FINSH_NEXT_SYSCALL(index) index=finsh_syscall_next(index) +#else +#define FINSH_NEXT_SYSCALL(index) index++ +#endif + /* system variable item */ struct finsh_sysvar_item { diff --git a/components/finsh/finsh_vm.c b/components/finsh/finsh_vm.c index c5b6dcf632f957a63aa8560d1d96fc71b9cca9ae..845eb48919175e22d0d193271d12a19bd8d9afa6 100644 --- a/components/finsh/finsh_vm.c +++ b/components/finsh/finsh_vm.c @@ -83,8 +83,8 @@ void finsh_syscall_append(const char* name, syscall_func func) } #endif -#if defined(_MSC_VER) -static struct finsh_syscall* _next_syscall(struct finsh_syscall* call) +#ifdef _MSC_VER +struct finsh_syscall* finsh_syscall_next(struct finsh_syscall* call) { unsigned int *ptr; ptr = (unsigned int*) (call + 1); @@ -93,9 +93,6 @@ static struct finsh_syscall* _next_syscall(struct finsh_syscall* call) return (struct finsh_syscall*)ptr; } -#define _NEXT_SYSCALL(index) index=_next_syscall(index) -#else -#define _NEXT_SYSCALL(index) index++ #endif struct finsh_syscall* finsh_syscall_lookup(const char* name) @@ -103,7 +100,7 @@ struct finsh_syscall* finsh_syscall_lookup(const char* name) struct finsh_syscall* index; struct finsh_syscall_item* item; - for (index = _syscall_table_begin; index < _syscall_table_end; _NEXT_SYSCALL(index)) + for (index = _syscall_table_begin; index < _syscall_table_end; FINSH_NEXT_SYSCALL(index)) { if (strcmp(index->name, name) == 0) return index; diff --git a/examples/kernel/tc_comm.c b/examples/kernel/tc_comm.c index 008be9b74684a967d14cc941d98e8c2cb4bc28a2..1ec48f53984b03ce20bb2904f4110edef1138874 100644 --- a/examples/kernel/tc_comm.c +++ b/examples/kernel/tc_comm.c @@ -27,7 +27,7 @@ void tc_thread_entry(void* parameter) while (_tc_stat & TC_STAT_RUNNING) { - for (index = _syscall_table_begin; index < _syscall_table_end; index ++) + for (index = _syscall_table_begin; index < _syscall_table_end; FINSH_NEXT_SYSCALL(index)) { /* search testcase */ if (rt_strstr(index->name, _tc_prefix) == index->name) @@ -158,7 +158,7 @@ void list_tc() struct finsh_syscall* index; rt_kprintf("TestCases List:\n"); - for (index = _syscall_table_begin; index < _syscall_table_end; index ++) + for (index = _syscall_table_begin; index < _syscall_table_end; FINSH_NEXT_SYSCALL(index)) { /* search testcase */ if (rt_strstr(index->name, "_tc_") == index->name)