diff --git a/components/finsh/finsh.h b/components/finsh/finsh.h index 575066e464..12474e841a 100644 --- a/components/finsh/finsh.h +++ b/components/finsh/finsh.h @@ -24,7 +24,7 @@ #define FINSH_STRING_MAX 128 /* max length of string */ #define FINSH_VARIABLE_MAX 8 /* max number of variable */ -#define FINSH_STACK_MAX 128 /* max stack size */ +#define FINSH_STACK_MAX 64 /* max stack size */ #define FINSH_TEXT_MAX 128 /* max text segment size */ #define HEAP_ALIGNMENT 4 /* heap alignment */ diff --git a/components/finsh/finsh_error.c b/components/finsh/finsh_error.c index c10c3c0092..9a8ef631fd 100644 --- a/components/finsh/finsh_error.c +++ b/components/finsh/finsh_error.c @@ -15,7 +15,7 @@ u_char global_errno; -const char* finsh_error_string_table[] = +static const char* finsh_error_string_table[] = { "No error", "Invalid token", diff --git a/components/finsh/finsh_token.c b/components/finsh/finsh_token.c index 11f9dc6459..49d4f8d44a 100644 --- a/components/finsh/finsh_token.c +++ b/components/finsh/finsh_token.c @@ -28,7 +28,7 @@ struct name_table }; /* keyword */ -static struct name_table finsh_name_table[] = +static const struct name_table finsh_name_table[] = { {"void", finsh_token_type_void}, {"char", finsh_token_type_char}, diff --git a/components/finsh/shell.c b/components/finsh/shell.c index fc1b9acb38..a2e1b5b884 100644 --- a/components/finsh/shell.c +++ b/components/finsh/shell.c @@ -144,9 +144,10 @@ void finsh_auto_complete(char* prefix) rt_kprintf("finsh>>%s", prefix); } -extern const char* finsh_error_string_table[]; void finsh_run_line(struct finsh_parser* parser, const char *line) { + const char* err_str; + rt_kprintf("\n"); finsh_parser_run(parser, (unsigned char*)line); @@ -157,7 +158,8 @@ void finsh_run_line(struct finsh_parser* parser, const char *line) } else { - rt_kprintf("%s\n", finsh_error_string(finsh_errno())); + err_str = finsh_error_string(finsh_errno()); + rt_kprintf("%s\n", err_str); } /* run virtual machine */