diff --git a/bsp/lpc408x/rtconfig.h b/bsp/lpc408x/rtconfig.h index ddb85fe8f9f3de7f86c96869e1402841071cecf2..2ef8f1523edab29bab13ac35c4518d5e30ac0bcd 100644 --- a/bsp/lpc408x/rtconfig.h +++ b/bsp/lpc408x/rtconfig.h @@ -151,9 +151,7 @@ // //
-//#define RT_USING_LWIP -// -#define RT_USING_LWIP141 +#define RT_USING_LWIP // #define RT_LWIP_ICMP // @@ -164,20 +162,10 @@ #define RT_LWIP_TCP // #define RT_LWIP_DNS -// -#define RT_LWIP_PBUF_NUM 4 -// -#define RT_LWIP_TCP_PCB_NUM 3 -// -#define RT_LWIP_TCP_SND_BUF 4086 -// -#define RT_LWIP_TCP_WND 2048 // // #define RT_LWIP_SNMP // // #define RT_LWIP_DHCP -// -#define RT_LWIP_TCP_SEG_NUM 4 // #define RT_LWIP_TCPTHREAD_PRIORITY 12 // diff --git a/bsp/stm32f7-disco/rtconfig.h b/bsp/stm32f7-disco/rtconfig.h index 64bd443678f4dce1a2fb77a8c387fe5b069f7060..98c2599d20f85bd4c35125d9db149c77cb319e0d 100644 --- a/bsp/stm32f7-disco/rtconfig.h +++ b/bsp/stm32f7-disco/rtconfig.h @@ -116,7 +116,7 @@ // #define RT_USING_LIBC // -//#define RT_USING_PTHREADS +#define RT_USING_PTHREADS //
//
diff --git a/bsp/stm32f7-disco/rtconfig.py b/bsp/stm32f7-disco/rtconfig.py index 18cb7b6b267157beb698f0ed4699c43de968e14b..91ef8db8b30185eb68e7a5371304d7f2633f68ce 100644 --- a/bsp/stm32f7-disco/rtconfig.py +++ b/bsp/stm32f7-disco/rtconfig.py @@ -44,7 +44,7 @@ if PLATFORM == 'gcc': OBJCPY = PREFIX + 'objcopy' STRIP = PREFIX + 'strip' - DEVICE = ' -mcpu=cortex-m7 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=hard -ffunction-sections -fdata-sections' + DEVICE = ' -mcpu=cortex-m7 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=softfp -ffunction-sections -fdata-sections' CFLAGS = DEVICE + ' -g -Wall -DSTM32F756xx -DUSE_HAL_DRIVER -D__ASSEMBLY__ -D__FPU_USED' AFLAGS = ' -c' + DEVICE + ' -x assembler-with-cpp -Wa,-mimplicit-it=thumb ' LFLAGS = DEVICE + ' -lm -lgcc -lc' + ' -nostartfiles -Wl,--gc-sections,-Map=rtthread_stm32f7xx.map,-cref,-u,Reset_Handler -T rtthread-stm32f7xx.ld' diff --git a/components/finsh/shell.c b/components/finsh/shell.c index c4708cee111f7e12b7f937762eb92c69a3c63b46..ce80e4dec21fbe09f3c581cee7c0c4f6b41e26a4 100644 --- a/components/finsh/shell.c +++ b/components/finsh/shell.c @@ -52,23 +52,23 @@ static struct rt_thread finsh_thread; ALIGN(RT_ALIGN_SIZE) static char finsh_thread_stack[FINSH_THREAD_STACK_SIZE]; -struct finsh_shell* shell; +struct finsh_shell *shell; #if defined(FINSH_USING_MSH) || (defined(RT_USING_DFS) && defined(DFS_USING_WORKDIR)) #if defined(RT_USING_DFS) #include #endif -const char* finsh_get_prompt() +const char *finsh_get_prompt() { - #define _MSH_PROMPT "msh " - #define _PROMPT "finsh " +#define _MSH_PROMPT "msh " +#define _PROMPT "finsh " static char finsh_prompt[RT_CONSOLEBUF_SIZE + 1] = {0}; #ifdef FINSH_USING_MSH if (msh_is_used()) strcpy(finsh_prompt, _MSH_PROMPT); else #endif - strcpy(finsh_prompt, _PROMPT); + strcpy(finsh_prompt, _PROMPT); #if defined(RT_USING_DFS) && defined(DFS_USING_WORKDIR) /* get current working directory */ @@ -98,7 +98,7 @@ static rt_err_t finsh_rx_ind(rt_device_t dev, rt_size_t size) * * @param device_name the name of new input device. */ -void finsh_set_device(const char* device_name) +void finsh_set_device(const char *device_name) { rt_device_t dev = RT_NULL; @@ -113,7 +113,7 @@ void finsh_set_device(const char* device_name) /* check whether it's a same device */ if (dev == shell->device) return; /* open this device and set the new device in finsh shell */ - if (rt_device_open(dev, RT_DEVICE_OFLAG_RDWR | RT_DEVICE_FLAG_INT_RX |\ + if (rt_device_open(dev, RT_DEVICE_OFLAG_RDWR | RT_DEVICE_FLAG_INT_RX | \ RT_DEVICE_FLAG_STREAM) == RT_EOK) { if (shell->device != RT_NULL) @@ -122,11 +122,11 @@ void finsh_set_device(const char* device_name) rt_device_close(shell->device); rt_device_set_rx_indicate(shell->device, RT_NULL); } - + /* clear line buffer before switch to new device */ memset(shell->line, 0, sizeof(shell->line)); shell->line_curpos = shell->line_position = 0; - + shell->device = dev; rt_device_set_rx_indicate(dev, finsh_rx_ind); } @@ -139,7 +139,7 @@ void finsh_set_device(const char* device_name) * * @return the finsh shell input device name is returned. */ -const char* finsh_get_device() +const char *finsh_get_device() { RT_ASSERT(shell != RT_NULL); return shell->device->parent.name; @@ -174,7 +174,7 @@ rt_uint32_t finsh_get_echo() return shell->echo_mode; } -static void shell_auto_complete(char* prefix) +static void shell_auto_complete(char *prefix) { rt_kprintf("\n"); @@ -183,11 +183,11 @@ static void shell_auto_complete(char* prefix) { msh_auto_complete(prefix); } - else + else #endif { -#ifndef FINSH_USING_MSH_ONLY - extern void list_prefix(char* prefix); +#ifndef FINSH_USING_MSH_ONLY + extern void list_prefix(char * prefix); list_prefix(prefix); #endif } @@ -196,12 +196,12 @@ static void shell_auto_complete(char* prefix) } #ifndef FINSH_USING_MSH_ONLY -void finsh_run_line(struct finsh_parser* parser, const char *line) +void finsh_run_line(struct finsh_parser *parser, const char *line) { - const char* err_str; + const char *err_str; rt_kprintf("\n"); - finsh_parser_run(parser, (unsigned char*)line); + finsh_parser_run(parser, (unsigned char *)line); /* compile node root */ if (finsh_errno() == 0) @@ -224,15 +224,15 @@ void finsh_run_line(struct finsh_parser* parser, const char *line) if (ch > 0x20 && ch < 0x7e) { rt_kprintf("\t'%c', %d, 0x%08x\n", - (unsigned char)finsh_stack_bottom(), - (unsigned int)finsh_stack_bottom(), - (unsigned int)finsh_stack_bottom()); + (unsigned char)finsh_stack_bottom(), + (unsigned int)finsh_stack_bottom(), + (unsigned int)finsh_stack_bottom()); } else { rt_kprintf("\t%d, 0x%08x\n", - (unsigned int)finsh_stack_bottom(), - (unsigned int)finsh_stack_bottom()); + (unsigned int)finsh_stack_bottom(), + (unsigned int)finsh_stack_bottom()); } } @@ -241,13 +241,13 @@ void finsh_run_line(struct finsh_parser* parser, const char *line) #endif #ifdef FINSH_USING_HISTORY -static rt_bool_t shell_handle_history(struct finsh_shell* shell) +static rt_bool_t shell_handle_history(struct finsh_shell *shell) { #if defined(_WIN32) int i; rt_kprintf("\r"); - for(i=0; i<= 60; i++) + for (i = 0; i <= 60; i++) putchar(' '); rt_kprintf("\r"); @@ -258,7 +258,7 @@ static rt_bool_t shell_handle_history(struct finsh_shell* shell) return RT_FALSE; } -static void shell_push_history(struct finsh_shell* shell) +static void shell_push_history(struct finsh_shell *shell) { if (shell->line_position != 0) { @@ -270,7 +270,7 @@ static void shell_push_history(struct finsh_shell* shell) for (index = 0; index < FINSH_HISTORY_LINES - 1; index ++) { memcpy(&shell->cmd_history[index][0], - &shell->cmd_history[index + 1][0], FINSH_CMD_SIZE); + &shell->cmd_history[index + 1][0], FINSH_CMD_SIZE); } memset(&shell->cmd_history[index][0], 0, FINSH_CMD_SIZE); memcpy(&shell->cmd_history[index][0], shell->line, shell->line_position); @@ -294,7 +294,7 @@ static void shell_push_history(struct finsh_shell* shell) #ifndef RT_USING_HEAP struct finsh_shell _shell; #endif -void finsh_thread_entry(void* parameter) +void finsh_thread_entry(void *parameter) { char ch; @@ -424,7 +424,10 @@ void finsh_thread_entry(void* parameter) char next; if (rt_device_read(shell->device, 0, &next, 1) == 1) - ch = next; + { + if (next == '\0') ch = 'r'; /* linux telnet will issue '\0' */ + else ch = next; + } else ch = '\r'; } /* handle tab key */ @@ -479,26 +482,26 @@ void finsh_thread_entry(void* parameter) /* handle end of line, break */ if (ch == '\r' || ch == '\n') { - #ifdef FINSH_USING_HISTORY +#ifdef FINSH_USING_HISTORY shell_push_history(shell); - #endif +#endif - #ifdef FINSH_USING_MSH +#ifdef FINSH_USING_MSH if (msh_is_used() == RT_TRUE) { rt_kprintf("\n"); msh_exec(shell->line, shell->line_position); } else - #endif +#endif { - #ifndef FINSH_USING_MSH_ONLY +#ifndef FINSH_USING_MSH_ONLY /* add ';' and run the command line */ shell->line[shell->line_position] = ';'; if (shell->line_position != 0) finsh_run_line(&shell->parser, shell->line); else rt_kprintf("\n"); - #endif +#endif } rt_kprintf(FINSH_PROMPT); @@ -537,45 +540,45 @@ void finsh_thread_entry(void* parameter) ch = 0; shell->line_position ++; shell->line_curpos++; - if (shell->line_position >= 80) - { - /* clear command line */ - shell->line_position = 0; - shell->line_curpos = 0; - } + if (shell->line_position >= 80) + { + /* clear command line */ + shell->line_position = 0; + shell->line_curpos = 0; + } } /* end of device read */ } } -void finsh_system_function_init(const void* begin, const void* end) +void finsh_system_function_init(const void *begin, const void *end) { - _syscall_table_begin = (struct finsh_syscall*) begin; - _syscall_table_end = (struct finsh_syscall*) end; + _syscall_table_begin = (struct finsh_syscall *) begin; + _syscall_table_end = (struct finsh_syscall *) end; } -void finsh_system_var_init(const void* begin, const void* end) +void finsh_system_var_init(const void *begin, const void *end) { - _sysvar_table_begin = (struct finsh_sysvar*) begin; - _sysvar_table_end = (struct finsh_sysvar*) end; + _sysvar_table_begin = (struct finsh_sysvar *) begin; + _sysvar_table_end = (struct finsh_sysvar *) end; } #if defined(__ICCARM__) || defined(__ICCRX__) /* for IAR compiler */ - #ifdef FINSH_USING_SYMTAB - #pragma section="FSymTab" - #pragma section="VSymTab" - #endif +#ifdef FINSH_USING_SYMTAB +#pragma section="FSymTab" +#pragma section="VSymTab" +#endif #elif defined(__ADSPBLACKFIN__) /* for VisaulDSP++ Compiler*/ - #ifdef FINSH_USING_SYMTAB - extern "asm" int __fsymtab_start; - extern "asm" int __fsymtab_end; - extern "asm" int __vsymtab_start; - extern "asm" int __vsymtab_end; - #endif +#ifdef FINSH_USING_SYMTAB +extern "asm" int __fsymtab_start; +extern "asm" int __fsymtab_end; +extern "asm" int __vsymtab_start; +extern "asm" int __vsymtab_end; +#endif #elif defined(_MSC_VER) #pragma section("FSymTab$a", read) const char __fsym_begin_name[] = "__start"; const char __fsym_begin_desc[] = "begin of finsh"; -__declspec(allocate("FSymTab$a")) const struct finsh_syscall __fsym_begin = +__declspec(allocate("FSymTab$a")) const struct finsh_syscall __fsym_begin = { __fsym_begin_name, __fsym_begin_desc, @@ -585,7 +588,7 @@ __declspec(allocate("FSymTab$a")) const struct finsh_syscall __fsym_begin = #pragma section("FSymTab$z", read) const char __fsym_end_name[] = "__end"; const char __fsym_end_desc[] = "end of finsh"; -__declspec(allocate("FSymTab$z")) const struct finsh_syscall __fsym_end = +__declspec(allocate("FSymTab$z")) const struct finsh_syscall __fsym_end = { __fsym_end_name, __fsym_end_desc, @@ -609,9 +612,9 @@ int finsh_system_init(void) extern const int VSymTab$$Base; extern const int VSymTab$$Limit; finsh_system_function_init(&FSymTab$$Base, &FSymTab$$Limit); - #ifndef FINSH_USING_MSH_ONLY +#ifndef FINSH_USING_MSH_ONLY finsh_system_var_init(&VSymTab$$Base, &VSymTab$$Limit); - #endif +#endif #elif defined (__ICCARM__) || defined(__ICCRX__) /* for IAR Compiler */ finsh_system_function_init(__section_begin("FSymTab"), __section_end("FSymTab")); @@ -631,10 +634,12 @@ int finsh_system_init(void) #elif defined(_MSC_VER) unsigned int *ptr_begin, *ptr_end; - ptr_begin = (unsigned int*)&__fsym_begin; ptr_begin += (sizeof(struct finsh_syscall)/sizeof(unsigned int)); + ptr_begin = (unsigned int *)&__fsym_begin; + ptr_begin += (sizeof(struct finsh_syscall) / sizeof(unsigned int)); while (*ptr_begin == 0) ptr_begin ++; - ptr_end = (unsigned int*) &__fsym_end; ptr_end --; + ptr_end = (unsigned int *) &__fsym_end; + ptr_end --; while (*ptr_end == 0) ptr_end --; finsh_system_function_init(ptr_begin, ptr_end); @@ -643,7 +648,7 @@ int finsh_system_init(void) /* create or set shell structure */ #ifdef RT_USING_HEAP - shell = (struct finsh_shell*)rt_malloc(sizeof(struct finsh_shell)); + shell = (struct finsh_shell *)rt_malloc(sizeof(struct finsh_shell)); if (shell == RT_NULL) { rt_kprintf("no memory for shell\n"); @@ -657,10 +662,10 @@ int finsh_system_init(void) rt_sem_init(&(shell->rx_sem), "shrx", 0, 0); result = rt_thread_init(&finsh_thread, - "tshell", - finsh_thread_entry, RT_NULL, - &finsh_thread_stack[0], sizeof(finsh_thread_stack), - FINSH_THREAD_PRIORITY, 10); + "tshell", + finsh_thread_entry, RT_NULL, + &finsh_thread_stack[0], sizeof(finsh_thread_stack), + FINSH_THREAD_PRIORITY, 10); if (result == RT_EOK) rt_thread_startup(&finsh_thread); diff --git a/components/libc/newlib/syscalls.c b/components/libc/newlib/syscalls.c index 388d240c9449c136b7611c4fe075fef1ec3c8147..239d208520aa2736181131fb0141b326f907c324 100644 --- a/components/libc/newlib/syscalls.c +++ b/components/libc/newlib/syscalls.c @@ -442,3 +442,8 @@ _system(const char *s) /* not support this call */ return; } + +void __libc_init_array(void) +{ + /* we not use __libc init_aray to initialize C++ objects */ +}