Merge branch 'master' of https://github.com/RT-Thread/rt-thread
This commit is contained in:
commit
91ae73e4e6
@ -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 @@
|
|||||||
#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 @@
|
|||||||
// <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':
|
|||||||
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,23 +52,23 @@
|
|||||||
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
|
||||||
if (msh_is_used()) strcpy(finsh_prompt, _MSH_PROMPT);
|
if (msh_is_used()) strcpy(finsh_prompt, _MSH_PROMPT);
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
strcpy(finsh_prompt, _PROMPT);
|
strcpy(finsh_prompt, _PROMPT);
|
||||||
|
|
||||||
#if defined(RT_USING_DFS) && defined(DFS_USING_WORKDIR)
|
#if defined(RT_USING_DFS) && defined(DFS_USING_WORKDIR)
|
||||||
/* get current working directory */
|
/* 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.
|
* @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)
|
|||||||
/* 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)
|
||||||
@ -122,11 +122,11 @@ void finsh_set_device(const char* device_name)
|
|||||||
rt_device_close(shell->device);
|
rt_device_close(shell->device);
|
||||||
rt_device_set_rx_indicate(shell->device, RT_NULL);
|
rt_device_set_rx_indicate(shell->device, RT_NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* clear line buffer before switch to new device */
|
/* clear line buffer before switch to new device */
|
||||||
memset(shell->line, 0, sizeof(shell->line));
|
memset(shell->line, 0, sizeof(shell->line));
|
||||||
shell->line_curpos = shell->line_position = 0;
|
shell->line_curpos = shell->line_position = 0;
|
||||||
|
|
||||||
shell->device = dev;
|
shell->device = dev;
|
||||||
rt_device_set_rx_indicate(dev, finsh_rx_ind);
|
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.
|
* @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()
|
|||||||
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");
|
||||||
@ -183,11 +183,11 @@ static void shell_auto_complete(char* prefix)
|
|||||||
{
|
{
|
||||||
msh_auto_complete(prefix);
|
msh_auto_complete(prefix);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
#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)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#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)
|
||||||
@ -224,15 +224,15 @@ void finsh_run_line(struct finsh_parser* parser, const char *line)
|
|||||||
if (ch > 0x20 && ch < 0x7e)
|
if (ch > 0x20 && ch < 0x7e)
|
||||||
{
|
{
|
||||||
rt_kprintf("\t'%c', %d, 0x%08x\n",
|
rt_kprintf("\t'%c', %d, 0x%08x\n",
|
||||||
(unsigned char)finsh_stack_bottom(),
|
(unsigned char)finsh_stack_bottom(),
|
||||||
(unsigned int)finsh_stack_bottom(),
|
(unsigned int)finsh_stack_bottom(),
|
||||||
(unsigned int)finsh_stack_bottom());
|
(unsigned int)finsh_stack_bottom());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
rt_kprintf("\t%d, 0x%08x\n",
|
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
|
#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)
|
|||||||
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)
|
||||||
{
|
{
|
||||||
@ -270,7 +270,7 @@ static void shell_push_history(struct finsh_shell* shell)
|
|||||||
for (index = 0; index < FINSH_HISTORY_LINES - 1; index ++)
|
for (index = 0; index < FINSH_HISTORY_LINES - 1; index ++)
|
||||||
{
|
{
|
||||||
memcpy(&shell->cmd_history[index][0],
|
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);
|
memset(&shell->cmd_history[index][0], 0, FINSH_CMD_SIZE);
|
||||||
memcpy(&shell->cmd_history[index][0], shell->line, shell->line_position);
|
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
|
#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)
|
|||||||
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)
|
|||||||
/* 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);
|
||||||
@ -537,45 +540,45 @@ void finsh_thread_entry(void* parameter)
|
|||||||
ch = 0;
|
ch = 0;
|
||||||
shell->line_position ++;
|
shell->line_position ++;
|
||||||
shell->line_curpos++;
|
shell->line_curpos++;
|
||||||
if (shell->line_position >= 80)
|
if (shell->line_position >= 80)
|
||||||
{
|
{
|
||||||
/* clear command line */
|
/* clear command line */
|
||||||
shell->line_position = 0;
|
shell->line_position = 0;
|
||||||
shell->line_curpos = 0;
|
shell->line_curpos = 0;
|
||||||
}
|
}
|
||||||
} /* end of device read */
|
} /* 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_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";
|
||||||
const char __fsym_begin_desc[] = "begin of finsh";
|
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_name,
|
||||||
__fsym_begin_desc,
|
__fsym_begin_desc,
|
||||||
@ -585,7 +588,7 @@ __declspec(allocate("FSymTab$a")) const struct finsh_syscall __fsym_begin =
|
|||||||
#pragma section("FSymTab$z", read)
|
#pragma section("FSymTab$z", read)
|
||||||
const char __fsym_end_name[] = "__end";
|
const char __fsym_end_name[] = "__end";
|
||||||
const char __fsym_end_desc[] = "end of finsh";
|
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_name,
|
||||||
__fsym_end_desc,
|
__fsym_end_desc,
|
||||||
@ -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)
|
|||||||
#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)
|
|||||||
|
|
||||||
/* 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");
|
||||||
@ -657,10 +662,10 @@ int finsh_system_init(void)
|
|||||||
|
|
||||||
rt_sem_init(&(shell->rx_sem), "shrx", 0, 0);
|
rt_sem_init(&(shell->rx_sem), "shrx", 0, 0);
|
||||||
result = rt_thread_init(&finsh_thread,
|
result = rt_thread_init(&finsh_thread,
|
||||||
"tshell",
|
"tshell",
|
||||||
finsh_thread_entry, RT_NULL,
|
finsh_thread_entry, RT_NULL,
|
||||||
&finsh_thread_stack[0], sizeof(finsh_thread_stack),
|
&finsh_thread_stack[0], sizeof(finsh_thread_stack),
|
||||||
FINSH_THREAD_PRIORITY, 10);
|
FINSH_THREAD_PRIORITY, 10);
|
||||||
|
|
||||||
if (result == RT_EOK)
|
if (result == RT_EOK)
|
||||||
rt_thread_startup(&finsh_thread);
|
rt_thread_startup(&finsh_thread);
|
||||||
|
@ -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 */
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user