Change system clock from OSC to PLL for lm3s platform & fix ftp memory free problem

git-svn-id: https://rt-thread.googlecode.com/svn/trunk@214 bbd45198-f89e-11dd-88c7-29a3b14d5316
This commit is contained in:
qiuyiuestc 2009-12-20 01:56:26 +00:00
parent 31d281e979
commit 1018dd336a
6 changed files with 35 additions and 46 deletions

View File

@ -36,35 +36,6 @@
#include <lwip/api.h>
#endif
char thread1_stack[0x120];
struct rt_thread thread1;
void thread1_entry(void* parameter)
{
rt_uint32_t i = 0;
while (1)
{
rt_kprintf("thread1 --> %d\n", ++i);
rt_thread_delay(100);
}
}
void thread_test()
{
rt_thread_init(&thread1,
"thread1",
thread1_entry, RT_NULL,
&thread1_stack[0], sizeof(thread1_stack),
20, 15);
rt_thread_startup(&thread1);
}
#ifdef RT_USING_FINSH
#include <finsh.h>
FINSH_FUNCTION_EXPORT(thread_test, test a basic thread)
#endif
/* thread phase init */
void rt_init_thread_entry(void *parameter)
{
@ -102,7 +73,7 @@ int rt_application_init()
init_thread = rt_thread_create("init",
rt_init_thread_entry, RT_NULL,
2048, 21, 20);
1024, 21, 20);
rt_thread_startup(init_thread);
return 0;

View File

@ -55,7 +55,7 @@ void rt_hw_timer_handler(void)
void rt_hw_board_init()
{
/* set clock */
SysCtlClockSet(SYSCTL_SYSDIV_1 | SYSCTL_USE_OSC | SYSCTL_OSC_MAIN |
SysCtlClockSet(SYSCTL_SYSDIV_2 | SYSCTL_USE_PLL | SYSCTL_OSC_MAIN |
SYSCTL_XTAL_6MHZ);
/* init systick */

View File

@ -33,7 +33,7 @@ OPTFFF 1,16,1,0,0,0,0,0,<.\ssi.c><ssi.c>
OPTFFF 1,17,1,0,0,0,0,0,<.\sysctl.c><sysctl.c>
OPTFFF 1,18,1,0,0,0,0,0,<.\systick.c><systick.c>
OPTFFF 1,19,1,0,0,0,0,0,<.\timer.c><timer.c>
OPTFFF 1,20,1,83886082,0,1124,1143,0,<.\uart.c><uart.c> { 44,0,0,0,2,0,0,0,3,0,0,0,255,255,255,255,255,255,255,255,252,255,255,255,226,255,255,255,0,0,0,0,0,0,0,0,182,2,0,0,196,0,0,0 }
OPTFFF 1,20,1,738197506,0,707,707,0,<.\uart.c><uart.c> { 44,0,0,0,2,0,0,0,3,0,0,0,255,255,255,255,255,255,255,255,252,255,255,255,226,255,255,255,0,0,0,0,0,0,0,0,182,2,0,0,196,0,0,0 }
OPTFFF 1,21,1,0,0,0,0,0,<.\udma.c><udma.c>
OPTFFF 1,22,1,0,0,0,0,0,<.\usb.c><usb.c>
OPTFFF 1,23,1,0,0,0,0,0,<.\watchdog.c><watchdog.c>

View File

@ -14,21 +14,21 @@ Target (RT-Thread/LM3S), 0x0004 // Tools: 'ARM-ADS'
GRPOPT 1,(Startup),1,0,0
GRPOPT 2,(Kernel),0,0,0
GRPOPT 3,(finsh),0,0,0
GRPOPT 4,(LM3S),0,0,0
GRPOPT 4,(LM3S),1,0,0
GRPOPT 5,(driverlib),0,0,0
GRPOPT 6,(Filesystem),0,0,0
GRPOPT 7,(LwIP),1,0,0
GRPOPT 8,(Utils),1,0,0
OPTFFF 1,1,1,201326592,0,0,0,0,<.\application.c><application.c>
OPTFFF 1,2,1,0,0,0,0,0,<.\board.c><board.c>
OPTFFF 1,3,1,234881024,0,132,141,0,<.\startup.c><startup.c> { 44,0,0,0,0,0,0,0,1,0,0,0,255,255,255,255,255,255,255,255,252,255,255,255,226,255,255,255,44,0,0,0,58,0,0,0,214,2,0,0,38,1,0,0 }
OPTFFF 1,4,5,436207616,0,61,61,0,<.\rtconfig.h><rtconfig.h> { 44,0,0,0,0,0,0,0,1,0,0,0,255,255,255,255,255,255,255,255,252,255,255,255,226,255,255,255,22,0,0,0,29,0,0,0,192,2,0,0,9,1,0,0 }
OPTFFF 1,2,1,520093698,0,46,58,0,<.\board.c><board.c> { 44,0,0,0,2,0,0,0,3,0,0,0,255,255,255,255,255,255,255,255,252,255,255,255,226,255,255,255,66,0,0,0,87,0,0,0,205,2,0,0,129,1,0,0 }
OPTFFF 1,3,1,0,0,133,135,0,<.\startup.c><startup.c> { 44,0,0,0,0,0,0,0,1,0,0,0,255,255,255,255,255,255,255,255,252,255,255,255,226,255,255,255,44,0,0,0,58,0,0,0,214,2,0,0,38,1,0,0 }
OPTFFF 1,4,5,0,0,1,1,0,<.\rtconfig.h><rtconfig.h> { 44,0,0,0,0,0,0,0,1,0,0,0,255,255,255,255,255,255,255,255,252,255,255,255,226,255,255,255,22,0,0,0,29,0,0,0,192,2,0,0,9,1,0,0 }
OPTFFF 1,5,1,922746880,0,783,783,0,<.\sdcard.c><sdcard.c> { 44,0,0,0,0,0,0,0,1,0,0,0,255,255,255,255,255,255,255,255,252,255,255,255,226,255,255,255,66,0,0,0,87,0,0,0,236,2,0,0,67,1,0,0 }
OPTFFF 1,6,1,738197504,0,1,1,0,<.\luminaryif.c><luminaryif.c> { 44,0,0,0,0,0,0,0,1,0,0,0,255,255,255,255,255,255,255,255,252,255,255,255,226,255,255,255,66,0,0,0,87,0,0,0,205,2,0,0,129,1,0,0 }
OPTFFF 1,6,1,0,0,38,46,0,<.\luminaryif.c><luminaryif.c> { 44,0,0,0,0,0,0,0,1,0,0,0,255,255,255,255,255,255,255,255,252,255,255,255,226,255,255,255,66,0,0,0,87,0,0,0,205,2,0,0,129,1,0,0 }
OPTFFF 2,7,1,0,0,0,0,0,<..\..\src\clock.c><clock.c>
OPTFFF 2,8,1,0,0,0,0,0,<..\..\src\device.c><device.c>
OPTFFF 2,9,1,0,0,0,0,0,<..\..\src\idle.c><idle.c>
OPTFFF 2,9,1,0,0,57,60,0,<..\..\src\idle.c><idle.c> { 44,0,0,0,0,0,0,0,1,0,0,0,255,255,255,255,255,255,255,255,252,255,255,255,226,255,255,255,66,0,0,0,87,0,0,0,236,2,0,0,67,1,0,0 }
OPTFFF 2,10,1,0,0,0,0,0,<..\..\src\ipc.c><ipc.c>
OPTFFF 2,11,1,0,0,0,0,0,<..\..\src\irq.c><irq.c>
OPTFFF 2,12,1,0,0,0,0,0,<..\..\src\mem.c><mem.c>
@ -56,10 +56,10 @@ OPTFFF 4,33,1,0,0,0,0,0,<..\..\libcpu\arm\lm3s\cpu.c><cpu.c>
OPTFFF 4,34,1,0,0,0,0,0,<..\..\libcpu\arm\lm3s\interrupt.c><interrupt.c>
OPTFFF 4,35,1,0,0,0,0,0,<..\..\libcpu\arm\lm3s\stack.c><stack.c>
OPTFFF 4,36,2,0,0,0,0,0,<..\..\libcpu\arm\lm3s\context_rvds.S><context_rvds.S>
OPTFFF 4,37,2,0,0,0,0,0,<..\..\libcpu\arm\lm3s\start_rvds.S><start_rvds.S>
OPTFFF 4,37,2,0,0,28,32,0,<..\..\libcpu\arm\lm3s\start_rvds.S><start_rvds.S> { 44,0,0,0,0,0,0,0,1,0,0,0,255,255,255,255,255,255,255,255,252,255,255,255,226,255,255,255,66,0,0,0,87,0,0,0,205,2,0,0,129,1,0,0 }
OPTFFF 4,38,1,0,0,0,0,0,<..\..\libcpu\arm\lm3s\serial.c><serial.c>
OPTFFF 4,39,1,0,0,0,0,0,<..\..\libcpu\arm\lm3s\fault.c><fault.c>
OPTFFF 4,40,2,0,0,0,0,0,<..\..\libcpu\arm\lm3s\fault_rvds.S><fault_rvds.S>
OPTFFF 4,40,2,0,0,12,12,0,<..\..\libcpu\arm\lm3s\fault_rvds.S><fault_rvds.S> { 44,0,0,0,0,0,0,0,1,0,0,0,255,255,255,255,255,255,255,255,252,255,255,255,226,255,255,255,88,0,0,0,116,0,0,0,227,2,0,0,158,1,0,0 }
OPTFFF 5,41,4,0,0,0,0,0,<.\driverlib\rvmdk\driverlib.lib><driverlib.lib>
OPTFFF 6,42,1,1,0,0,0,0,<..\..\filesystem\dfs\src\dfs_init.c><dfs_init.c>
OPTFFF 6,43,1,0,0,0,0,0,<..\..\filesystem\dfs\src\dfs_fs.c><dfs_fs.c>
@ -67,7 +67,7 @@ OPTFFF 6,44,1,0,0,0,0,0,<..\..\filesystem\dfs\src\dfs_raw.c><dfs_raw.c>
OPTFFF 6,45,1,0,0,0,0,0,<..\..\filesystem\dfs\src\dfs_util.c><dfs_util.c>
OPTFFF 6,46,1,0,0,0,0,0,<..\..\filesystem\dfs\src\dfs_cache.c><dfs_cache.c>
OPTFFF 6,47,1,0,0,0,0,0,<..\..\filesystem\dfs\src\dfs_posix.c><dfs_posix.c>
OPTFFF 6,48,1,0,0,0,0,0,<..\..\filesystem\dfs\filesystems\efsl\src\base\efs.c><efs.c>
OPTFFF 6,48,1,0,0,160,168,0,<..\..\filesystem\dfs\filesystems\efsl\src\base\efs.c><efs.c> { 44,0,0,0,0,0,0,0,1,0,0,0,255,255,255,255,255,255,255,255,252,255,255,255,226,255,255,255,44,0,0,0,58,0,0,0,183,2,0,0,100,1,0,0 }
OPTFFF 6,49,1,0,0,0,0,0,<..\..\filesystem\dfs\filesystems\efsl\src\base\extract.c><extract.c>
OPTFFF 6,50,1,0,0,0,0,0,<..\..\filesystem\dfs\filesystems\efsl\src\base\partition.c><partition.c>
OPTFFF 6,51,1,0,0,0,0,0,<..\..\filesystem\dfs\filesystems\efsl\src\base\plibc.c><plibc.c>
@ -115,15 +115,16 @@ OPTFFF 7,92,1,0,0,0,0,0,<..\..\net\lwip\src\arch\sys_arch.c><sys_arch.c>
OPTFFF 7,93,1,0,0,0,0,0,<..\..\net\lwip\src\api\sockets.c><sockets.c>
OPTFFF 7,94,1,0,0,0,0,0,<..\..\net\lwip\src\core\memp_tiny.c><memp_tiny.c>
OPTFFF 8,95,1,0,0,0,0,0,<..\..\net\apps\chargen.c><chargen.c>
OPTFFF 8,96,1,0,0,0,0,0,<..\..\net\apps\ftpd.c><ftpd.c>
OPTFFF 8,96,1,0,0,548,558,0,<..\..\net\apps\ftpd.c><ftpd.c> { 44,0,0,0,0,0,0,0,1,0,0,0,255,255,255,255,255,255,255,255,252,255,255,255,226,255,255,255,44,0,0,0,58,0,0,0,214,2,0,0,38,1,0,0 }
OPTFFF 8,97,1,0,0,0,0,0,<..\..\net\apps\sntp.c><sntp.c>
OPTFFF 8,98,1,0,0,0,0,0,<..\..\net\apps\tcpecho.c><tcpecho.c>
OPTFFF 8,99,1,486539264,0,83,87,0,<..\..\net\apps\tftp.c><tftp.c> { 44,0,0,0,0,0,0,0,1,0,0,0,255,255,255,255,255,255,255,255,252,255,255,255,226,255,255,255,22,0,0,0,29,0,0,0,161,2,0,0,71,1,0,0 }
OPTFFF 8,99,1,486539264,0,56,56,0,<..\..\net\apps\tftp.c><tftp.c> { 44,0,0,0,0,0,0,0,1,0,0,0,255,255,255,255,255,255,255,255,252,255,255,255,226,255,255,255,22,0,0,0,29,0,0,0,161,2,0,0,71,1,0,0 }
OPTFFF 8,100,1,0,0,0,0,0,<..\..\net\apps\udpecho.c><udpecho.c>
ExtF <E:\SVN-Google-Source\filesystem\dfs\include\dfs_def.h> 141,141,0,{ 44,0,0,0,0,0,0,0,1,0,0,0,255,255,255,255,255,255,255,255,252,255,255,255,226,255,255,255,66,0,0,0,87,0,0,0,236,2,0,0,67,1,0,0 }
ExtF <E:\SVN-Google-Source\filesystem\dfs\dfs_config.h> 83,91,0,{ 44,0,0,0,0,0,0,0,1,0,0,0,255,255,255,255,255,255,255,255,252,255,255,255,226,255,255,255,0,0,0,0,0,0,0,0,170,2,0,0,236,0,0,0 }
ExtF <E:\SVN-Google-Source\net\lwip\src\lwipopts.h> 137,152,0,{ 44,0,0,0,2,0,0,0,3,0,0,0,255,255,255,255,255,255,255,255,252,255,255,255,226,255,255,255,0,0,0,0,0,0,0,0,170,2,0,0,236,0,0,0 }
ExtF <E:\SVN-Google-Source\net\lwip\src\lwipopts.h> 144,148,0,{ 44,0,0,0,0,0,0,0,1,0,0,0,255,255,255,255,255,255,255,255,252,255,255,255,226,255,255,255,0,0,0,0,0,0,0,0,170,2,0,0,236,0,0,0 }
ExtF <E:\SVN-Google-Source\src\kservice.h> 81,87,0,{ 44,0,0,0,0,0,0,0,1,0,0,0,255,255,255,255,255,255,255,255,252,255,255,255,226,255,255,255,0,0,0,0,0,0,0,0,170,2,0,0,236,0,0,0 }
TARGOPT 1, (RT-Thread/LM3S)
ADSCLK=6000000
@ -141,7 +142,7 @@ TARGOPT 1, (RT-Thread/LM3S)
OPTKEY 0,(ARMDBGFLAGS)()
OPTKEY 0,(DLGUARM)((105=-1,-1,-1,-1,0)(106=-1,-1,-1,-1,0)(107=-1,-1,-1,-1,0))
OPTKEY 0,(JL2CM3)(-U -O14 -S0 -C-1 -JU1 -JI127.0.0.1 -JP0 -TO18 -TC10000000 -TP21 -TDS8007 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -TB1 -TRE0 -FO7 -FD20000000 -FC800 -FN1 -FF0LM3S_256 -FS00 -FL040000)
OPTDF 0x80
OPTDF 0x84
OPTLE <>
OPTLC <>
EndOpt

View File

@ -116,7 +116,7 @@
#define RT_LWIP_ETH_PAD_SIZE 2
/* TCP sender buffer space*/
#define RT_LWIP_TCP_SND_BUF 1500
#define RT_LWIP_TCP_SND_BUF 2048
/* Enable SNMP protocol*/
/* #define RT_LWIP_SNMP */

View File

@ -362,6 +362,7 @@ int ftp_process_request(struct ftp_session* session, char *buf)
// incorrect login
rt_sprintf(sbuf, "530 Login incorrect. Bye.\r\n");
send(session->sockfd, sbuf, strlen(sbuf), 0);
rt_free(sbuf);
return -1;
}
return 0;
@ -375,12 +376,14 @@ int ftp_process_request(struct ftp_session* session, char *buf)
// password correct
rt_sprintf(sbuf, "230 User logged in\r\n");
send(session->sockfd, sbuf, strlen(sbuf), 0);
rt_free(sbuf);
return 0;
}
// incorrect password
rt_sprintf(sbuf, "530 Login or Password incorrect. Bye!\r\n");
send(session->sockfd, sbuf, strlen(sbuf), 0);
rt_free(sbuf);
return -1;
}
else if(str_begin_with(buf, "LIST")==0 )
@ -488,6 +491,7 @@ int ftp_process_request(struct ftp_session* session, char *buf)
err1:
closesocket(session->pasv_sockfd);
session->pasv_active = 0;
rt_free(sbuf);
return 0;
}
}
@ -504,12 +508,14 @@ err1:
rt_sprintf(sbuf, "550 \"%s\" : not a regular file\r\n", filename);
send(session->sockfd, sbuf, strlen(sbuf), 0);
session->offset=0;
rt_free(sbuf);
return 0;
}
fd = open(filename, O_RDONLY, 0);
if (fd < 0)
{
rt_free(sbuf);
return 0;
}
@ -538,6 +544,7 @@ err1:
{
rt_sprintf(sbuf, "550 Permission denied.\r\n");
send(session->sockfd, sbuf, strlen(sbuf), 0);
rt_free(sbuf);
return 0;
}
@ -548,6 +555,7 @@ err1:
{
rt_sprintf(sbuf, "550 Cannot open \"%s\" for writing.\r\n", filename);
send(session->sockfd, sbuf, strlen(sbuf), 0);
rt_free(sbuf);
return 0;
}
rt_sprintf(sbuf, "150 Opening binary mode data connection for \"%s\".\r\n", filename);
@ -573,6 +581,7 @@ err1:
{
close(fd);
closesocket(session->pasv_sockfd);
rt_free(sbuf);
return -1;
}
}
@ -643,6 +652,7 @@ err1:
send(session->sockfd, sbuf, strlen(sbuf), 0);
closesocket(session->pasv_sockfd);
session->pasv_active = 0;
rt_free(sbuf);
return 0;
}
pasvremote.sin_addr.s_addr=inet_addr(tmpip);
@ -657,6 +667,7 @@ err1:
rt_sprintf(sbuf, "425 Can't open data connection.\r\n");
send(session->sockfd, sbuf, strlen(sbuf), 0);
closesocket(session->pasv_sockfd);
rt_free(sbuf);
return 0;
}
}
@ -681,6 +692,7 @@ err1:
{
rt_sprintf(sbuf, "550 Permission denied.\r\n");
send(session->sockfd, sbuf, strlen(sbuf), 0);
rt_free(sbuf);
return 0;
}
@ -703,6 +715,7 @@ err1:
{
rt_sprintf(sbuf, "550 Permission denied.\r\n");
send(session->sockfd, sbuf, strlen(sbuf), 0);
rt_free(sbuf);
return 0;
}
@ -722,6 +735,7 @@ err1:
{
rt_sprintf(sbuf, "550 Permission denied.\r\n");
send(session->sockfd, sbuf, strlen(sbuf), 0);
rt_free(sbuf);
return 0;
}
build_full_path(session, parameter_ptr, filename, 256);
@ -737,10 +751,12 @@ err1:
send(session->sockfd, sbuf, strlen(sbuf), 0);
}
}
else if(str_begin_with(buf, "QUIT")==0)
{
rt_sprintf(sbuf, "221 Bye!\r\n");
send(session->sockfd, sbuf, strlen(sbuf), 0);
rt_free(sbuf);
return -1;
}
else
@ -748,6 +764,7 @@ err1:
rt_sprintf(sbuf, "502 Not Implemented.\r\n");
send(session->sockfd, sbuf, strlen(sbuf), 0);
}
rt_free(sbuf);
return 0;
}