提交 91ae73e4 编写于 作者: B Bernard Xiong

Merge branch 'master' of https://github.com/RT-Thread/rt-thread

...@@ -151,9 +151,7 @@ ...@@ -151,9 +151,7 @@
// </section> // </section>
// <section name="RT_USING_LWIP" description="lwip, a lightweight TCP/IP protocol stack" default="true" > // <section name="RT_USING_LWIP" description="lwip, a lightweight TCP/IP protocol stack" default="true" >
//#define RT_USING_LWIP #define RT_USING_LWIP
// <bool name="RT_USING_LWIP141" description="Using lwIP 1.4.1 version" default="true" />
#define RT_USING_LWIP141
// <bool name="RT_LWIP_ICMP" description="Enable ICMP protocol" default="true" /> // <bool name="RT_LWIP_ICMP" description="Enable ICMP protocol" default="true" />
#define RT_LWIP_ICMP #define RT_LWIP_ICMP
// <bool name="RT_LWIP_IGMP" description="Enable IGMP protocol" default="false" /> // <bool name="RT_LWIP_IGMP" description="Enable IGMP protocol" default="false" />
...@@ -164,20 +162,10 @@ ...@@ -164,20 +162,10 @@
#define RT_LWIP_TCP #define RT_LWIP_TCP
// <bool name="RT_LWIP_DNS" description="Enable DNS protocol" default="true" /> // <bool name="RT_LWIP_DNS" description="Enable DNS protocol" default="true" />
#define RT_LWIP_DNS #define RT_LWIP_DNS
// <integer name="RT_LWIP_PBUF_NUM" description="Maximal number of buffers in the pbuf pool" default="4" />
#define RT_LWIP_PBUF_NUM 4
// <integer name="RT_LWIP_TCP_PCB_NUM" description="Maximal number of simultaneously active TCP connections" default="5" />
#define RT_LWIP_TCP_PCB_NUM 3
// <integer name="RT_LWIP_TCP_SND_BUF" description="TCP sender buffer size" default="8192" />
#define RT_LWIP_TCP_SND_BUF 4086
// <integer name="RT_LWIP_TCP_WND" description="TCP receive window" default="8192" />
#define RT_LWIP_TCP_WND 2048
// <bool name="RT_LWIP_SNMP" description="Enable SNMP protocol" default="false" /> // <bool name="RT_LWIP_SNMP" description="Enable SNMP protocol" default="false" />
// #define RT_LWIP_SNMP // #define RT_LWIP_SNMP
// <bool name="RT_LWIP_DHCP" description="Enable DHCP client to get IP address" default="false" /> // <bool name="RT_LWIP_DHCP" description="Enable DHCP client to get IP address" default="false" />
// #define RT_LWIP_DHCP // #define RT_LWIP_DHCP
// <integer name="RT_LWIP_TCP_SEG_NUM" description="the number of simultaneously queued TCP" default="4" />
#define RT_LWIP_TCP_SEG_NUM 4
// <integer name="RT_LWIP_TCPTHREAD_PRIORITY" description="the thread priority of TCP thread" default="128" /> // <integer name="RT_LWIP_TCPTHREAD_PRIORITY" description="the thread priority of TCP thread" default="128" />
#define RT_LWIP_TCPTHREAD_PRIORITY 12 #define RT_LWIP_TCPTHREAD_PRIORITY 12
// <integer name="RT_LWIP_TCPTHREAD_MBOX_SIZE" description="the mail box size of TCP thread to wait for" default="32" /> // <integer name="RT_LWIP_TCPTHREAD_MBOX_SIZE" description="the mail box size of TCP thread to wait for" default="32" />
......
...@@ -116,7 +116,7 @@ ...@@ -116,7 +116,7 @@
// <bool name="RT_USING_LIBC" description="Using libc library" default="true" /> // <bool name="RT_USING_LIBC" description="Using libc library" default="true" />
#define RT_USING_LIBC #define RT_USING_LIBC
// <bool name="RT_USING_PTHREADS" description="Using POSIX threads library" default="true" /> // <bool name="RT_USING_PTHREADS" description="Using POSIX threads library" default="true" />
//#define RT_USING_PTHREADS #define RT_USING_PTHREADS
// </section> // </section>
// <section name="RT_USING_DFS" description="Device file system" default="true" > // <section name="RT_USING_DFS" description="Device file system" default="true" >
......
...@@ -44,7 +44,7 @@ if PLATFORM == 'gcc': ...@@ -44,7 +44,7 @@ if PLATFORM == 'gcc':
OBJCPY = PREFIX + 'objcopy' OBJCPY = PREFIX + 'objcopy'
STRIP = PREFIX + 'strip' 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' CFLAGS = DEVICE + ' -g -Wall -DSTM32F756xx -DUSE_HAL_DRIVER -D__ASSEMBLY__ -D__FPU_USED'
AFLAGS = ' -c' + DEVICE + ' -x assembler-with-cpp -Wa,-mimplicit-it=thumb ' 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' LFLAGS = DEVICE + ' -lm -lgcc -lc' + ' -nostartfiles -Wl,--gc-sections,-Map=rtthread_stm32f7xx.map,-cref,-u,Reset_Handler -T rtthread-stm32f7xx.ld'
......
...@@ -52,16 +52,16 @@ ...@@ -52,16 +52,16 @@
static struct rt_thread finsh_thread; static struct rt_thread finsh_thread;
ALIGN(RT_ALIGN_SIZE) ALIGN(RT_ALIGN_SIZE)
static char finsh_thread_stack[FINSH_THREAD_STACK_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(FINSH_USING_MSH) || (defined(RT_USING_DFS) && defined(DFS_USING_WORKDIR))
#if defined(RT_USING_DFS) #if defined(RT_USING_DFS)
#include <dfs_posix.h> #include <dfs_posix.h>
#endif #endif
const char* finsh_get_prompt() const char *finsh_get_prompt()
{ {
#define _MSH_PROMPT "msh " #define _MSH_PROMPT "msh "
#define _PROMPT "finsh " #define _PROMPT "finsh "
static char finsh_prompt[RT_CONSOLEBUF_SIZE + 1] = {0}; static char finsh_prompt[RT_CONSOLEBUF_SIZE + 1] = {0};
#ifdef FINSH_USING_MSH #ifdef FINSH_USING_MSH
...@@ -98,7 +98,7 @@ static rt_err_t finsh_rx_ind(rt_device_t dev, rt_size_t size) ...@@ -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. * @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; rt_device_t dev = RT_NULL;
...@@ -113,7 +113,7 @@ void finsh_set_device(const char* device_name) ...@@ -113,7 +113,7 @@ void finsh_set_device(const char* device_name)
/* check whether it's a same device */ /* check whether it's a same device */
if (dev == shell->device) return; if (dev == shell->device) return;
/* open this device and set the new device in finsh shell */ /* 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) RT_DEVICE_FLAG_STREAM) == RT_EOK)
{ {
if (shell->device != RT_NULL) if (shell->device != RT_NULL)
...@@ -139,7 +139,7 @@ void finsh_set_device(const char* device_name) ...@@ -139,7 +139,7 @@ void finsh_set_device(const char* device_name)
* *
* @return the finsh shell input device name is returned. * @return the finsh shell input device name is returned.
*/ */
const char* finsh_get_device() const char *finsh_get_device()
{ {
RT_ASSERT(shell != RT_NULL); RT_ASSERT(shell != RT_NULL);
return shell->device->parent.name; return shell->device->parent.name;
...@@ -174,7 +174,7 @@ rt_uint32_t finsh_get_echo() ...@@ -174,7 +174,7 @@ rt_uint32_t finsh_get_echo()
return shell->echo_mode; return shell->echo_mode;
} }
static void shell_auto_complete(char* prefix) static void shell_auto_complete(char *prefix)
{ {
rt_kprintf("\n"); rt_kprintf("\n");
...@@ -187,7 +187,7 @@ static void shell_auto_complete(char* prefix) ...@@ -187,7 +187,7 @@ static void shell_auto_complete(char* prefix)
#endif #endif
{ {
#ifndef FINSH_USING_MSH_ONLY #ifndef FINSH_USING_MSH_ONLY
extern void list_prefix(char* prefix); extern void list_prefix(char * prefix);
list_prefix(prefix); list_prefix(prefix);
#endif #endif
} }
...@@ -196,12 +196,12 @@ static void shell_auto_complete(char* prefix) ...@@ -196,12 +196,12 @@ static void shell_auto_complete(char* prefix)
} }
#ifndef FINSH_USING_MSH_ONLY #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"); rt_kprintf("\n");
finsh_parser_run(parser, (unsigned char*)line); finsh_parser_run(parser, (unsigned char *)line);
/* compile node root */ /* compile node root */
if (finsh_errno() == 0) if (finsh_errno() == 0)
...@@ -241,13 +241,13 @@ void finsh_run_line(struct finsh_parser* parser, const char *line) ...@@ -241,13 +241,13 @@ void finsh_run_line(struct finsh_parser* parser, const char *line)
#endif #endif
#ifdef FINSH_USING_HISTORY #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) #if defined(_WIN32)
int i; int i;
rt_kprintf("\r"); rt_kprintf("\r");
for(i=0; i<= 60; i++) for (i = 0; i <= 60; i++)
putchar(' '); putchar(' ');
rt_kprintf("\r"); rt_kprintf("\r");
...@@ -258,7 +258,7 @@ static rt_bool_t shell_handle_history(struct finsh_shell* shell) ...@@ -258,7 +258,7 @@ static rt_bool_t shell_handle_history(struct finsh_shell* shell)
return RT_FALSE; 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) if (shell->line_position != 0)
{ {
...@@ -294,7 +294,7 @@ static void shell_push_history(struct finsh_shell* shell) ...@@ -294,7 +294,7 @@ static void shell_push_history(struct finsh_shell* shell)
#ifndef RT_USING_HEAP #ifndef RT_USING_HEAP
struct finsh_shell _shell; struct finsh_shell _shell;
#endif #endif
void finsh_thread_entry(void* parameter) void finsh_thread_entry(void *parameter)
{ {
char ch; char ch;
...@@ -424,7 +424,10 @@ void finsh_thread_entry(void* parameter) ...@@ -424,7 +424,10 @@ void finsh_thread_entry(void* parameter)
char next; char next;
if (rt_device_read(shell->device, 0, &next, 1) == 1) 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'; else ch = '\r';
} }
/* handle tab key */ /* handle tab key */
...@@ -479,26 +482,26 @@ void finsh_thread_entry(void* parameter) ...@@ -479,26 +482,26 @@ void finsh_thread_entry(void* parameter)
/* handle end of line, break */ /* handle end of line, break */
if (ch == '\r' || ch == '\n') if (ch == '\r' || ch == '\n')
{ {
#ifdef FINSH_USING_HISTORY #ifdef FINSH_USING_HISTORY
shell_push_history(shell); shell_push_history(shell);
#endif #endif
#ifdef FINSH_USING_MSH #ifdef FINSH_USING_MSH
if (msh_is_used() == RT_TRUE) if (msh_is_used() == RT_TRUE)
{ {
rt_kprintf("\n"); rt_kprintf("\n");
msh_exec(shell->line, shell->line_position); msh_exec(shell->line, shell->line_position);
} }
else else
#endif #endif
{ {
#ifndef FINSH_USING_MSH_ONLY #ifndef FINSH_USING_MSH_ONLY
/* add ';' and run the command line */ /* add ';' and run the command line */
shell->line[shell->line_position] = ';'; shell->line[shell->line_position] = ';';
if (shell->line_position != 0) finsh_run_line(&shell->parser, shell->line); if (shell->line_position != 0) finsh_run_line(&shell->parser, shell->line);
else rt_kprintf("\n"); else rt_kprintf("\n");
#endif #endif
} }
rt_kprintf(FINSH_PROMPT); rt_kprintf(FINSH_PROMPT);
...@@ -547,30 +550,30 @@ void finsh_thread_entry(void* parameter) ...@@ -547,30 +550,30 @@ void finsh_thread_entry(void* parameter)
} }
} }
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_begin = (struct finsh_syscall *) begin;
_syscall_table_end = (struct finsh_syscall*) end; _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_begin = (struct finsh_sysvar *) begin;
_sysvar_table_end = (struct finsh_sysvar*) end; _sysvar_table_end = (struct finsh_sysvar *) end;
} }
#if defined(__ICCARM__) || defined(__ICCRX__) /* for IAR compiler */ #if defined(__ICCARM__) || defined(__ICCRX__) /* for IAR compiler */
#ifdef FINSH_USING_SYMTAB #ifdef FINSH_USING_SYMTAB
#pragma section="FSymTab" #pragma section="FSymTab"
#pragma section="VSymTab" #pragma section="VSymTab"
#endif #endif
#elif defined(__ADSPBLACKFIN__) /* for VisaulDSP++ Compiler*/ #elif defined(__ADSPBLACKFIN__) /* for VisaulDSP++ Compiler*/
#ifdef FINSH_USING_SYMTAB #ifdef FINSH_USING_SYMTAB
extern "asm" int __fsymtab_start; extern "asm" int __fsymtab_start;
extern "asm" int __fsymtab_end; extern "asm" int __fsymtab_end;
extern "asm" int __vsymtab_start; extern "asm" int __vsymtab_start;
extern "asm" int __vsymtab_end; extern "asm" int __vsymtab_end;
#endif #endif
#elif defined(_MSC_VER) #elif defined(_MSC_VER)
#pragma section("FSymTab$a", read) #pragma section("FSymTab$a", read)
const char __fsym_begin_name[] = "__start"; const char __fsym_begin_name[] = "__start";
...@@ -609,9 +612,9 @@ int finsh_system_init(void) ...@@ -609,9 +612,9 @@ int finsh_system_init(void)
extern const int VSymTab$$Base; extern const int VSymTab$$Base;
extern const int VSymTab$$Limit; extern const int VSymTab$$Limit;
finsh_system_function_init(&FSymTab$$Base, &FSymTab$$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); finsh_system_var_init(&VSymTab$$Base, &VSymTab$$Limit);
#endif #endif
#elif defined (__ICCARM__) || defined(__ICCRX__) /* for IAR Compiler */ #elif defined (__ICCARM__) || defined(__ICCRX__) /* for IAR Compiler */
finsh_system_function_init(__section_begin("FSymTab"), finsh_system_function_init(__section_begin("FSymTab"),
__section_end("FSymTab")); __section_end("FSymTab"));
...@@ -631,10 +634,12 @@ int finsh_system_init(void) ...@@ -631,10 +634,12 @@ int finsh_system_init(void)
#elif defined(_MSC_VER) #elif defined(_MSC_VER)
unsigned int *ptr_begin, *ptr_end; 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 ++; 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 --; while (*ptr_end == 0) ptr_end --;
finsh_system_function_init(ptr_begin, ptr_end); finsh_system_function_init(ptr_begin, ptr_end);
...@@ -643,7 +648,7 @@ int finsh_system_init(void) ...@@ -643,7 +648,7 @@ int finsh_system_init(void)
/* create or set shell structure */ /* create or set shell structure */
#ifdef RT_USING_HEAP #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) if (shell == RT_NULL)
{ {
rt_kprintf("no memory for shell\n"); rt_kprintf("no memory for shell\n");
......
...@@ -442,3 +442,8 @@ _system(const char *s) ...@@ -442,3 +442,8 @@ _system(const char *s)
/* not support this call */ /* not support this call */
return; return;
} }
void __libc_init_array(void)
{
/* we not use __libc init_aray to initialize C++ objects */
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册