diff --git a/bsp/lm3s/application.c b/bsp/lm3s/application.c index 508ff154ac..b697141116 100644 --- a/bsp/lm3s/application.c +++ b/bsp/lm3s/application.c @@ -23,10 +23,8 @@ #ifdef RT_USING_DFS /* dfs init */ #include -/* dfs filesystem:FAT filesystem init */ -#include -/* dfs filesystem:EFS filesystem init */ -#include +/* dfs filesystem:ELM FatFs filesystem init */ +#include /* dfs Filesystem APIs */ #include #endif @@ -44,14 +42,18 @@ void rt_init_thread_entry(void *parameter) { /* init the device filesystem */ dfs_init(); - /* init the efsl filesystam*/ - efsl_init(); +#ifdef RT_USING_DFS_ELMFAT + /* init the elm chan FatFs filesystam*/ + elm_init(); /* mount sd card fat partition 1 as root directory */ - if (dfs_mount("sd0", "/", "efs", 0, 0) == 0) + if (dfs_mount("sd0", "/", "elm", 0, 0) == 0) + { rt_kprintf("File System initialized!\n"); + } else - rt_kprintf("File System init failed!\n"); + rt_kprintf("File System initialzation failed!\n"); +#endif } #endif diff --git a/bsp/lm3s/board.c b/bsp/lm3s/board.c index 0a64a2f120..56fa83f89b 100644 --- a/bsp/lm3s/board.c +++ b/bsp/lm3s/board.c @@ -14,6 +14,7 @@ #include #include +#include #include #include @@ -24,6 +25,7 @@ #include #include + static void rt_hw_console_init(void); /** @@ -71,7 +73,7 @@ void rt_hw_board_init() SysCtlLDOSet(SYSCTL_LDO_2_50V); /* set clock */ SysCtlClockSet(SYSCTL_SYSDIV_4 | SYSCTL_USE_PLL | SYSCTL_OSC_MAIN | - SYSCTL_XTAL_6MHZ); + LM3S_XTAL_TYPE); /* init systick */ SysTickDisable(); diff --git a/bsp/lm3s/board.h b/bsp/lm3s/board.h index f386ea3cfd..33d3285465 100644 --- a/bsp/lm3s/board.h +++ b/bsp/lm3s/board.h @@ -22,10 +22,14 @@ #define LM3S_SRAM_SIZE 64 #define LM3S_SRAM_END (0x20000000 + LM3S_SRAM_SIZE * 1024) +// For lm3s8962, it should be SYSCTL_XTAL_8MHZ +#define LM3S_XTAL_TYPE SYSCTL_XTAL_6MHZ + void rt_hw_board_led_on(int n); void rt_hw_board_led_off(int n); void rt_hw_board_init(void); void rt_hw_usart_init(void); +void rt_hw_sdcard_init(void); #endif diff --git a/bsp/lm3s/lm3s_rom.ld b/bsp/lm3s/lm3s_rom.ld index b4e1f34ebd..e2b965b74f 100644 --- a/bsp/lm3s/lm3s_rom.ld +++ b/bsp/lm3s/lm3s_rom.ld @@ -9,7 +9,7 @@ MEMORY CODE (rx) : ORIGIN = 0x00000000, LENGTH = 0x00040000 DATA (rw) : ORIGIN = 0x20000000, LENGTH = 0x00010000 } -ENTRY(ResetISR) +ENTRY(Reset_Handler) SECTIONS { diff --git a/bsp/lm3s/project_lwip_dfs.Opt b/bsp/lm3s/project_lwip_dfs.Opt index 66caf10fab..66d75c1205 100644 --- a/bsp/lm3s/project_lwip_dfs.Opt +++ b/bsp/lm3s/project_lwip_dfs.Opt @@ -11,24 +11,24 @@ DaveTm { 0,0,0,0,0,0,0,0 } Target (RT-Thread-LM3S), 0x0004 // Tools: 'ARM-ADS' -GRPOPT 1,(Startup),1,0,0 +GRPOPT 1,(Startup),0,0,0 GRPOPT 2,(Kernel),0,0,0 GRPOPT 3,(finsh),0,0,0 GRPOPT 4,(LM3S),0,0,0 -GRPOPT 5,(driverlib),1,0,0 +GRPOPT 5,(driverlib),0,0,0 GRPOPT 6,(Filesystem),0,0,0 GRPOPT 7,(LwIP),0,0,0 -OPTFFF 1,1,1,0,0,1,1,0,<.\application.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,88,0,0,0,116,0,0,0,236,2,0,0,123,1,0,0 } -OPTFFF 1,2,1,486539264,0,63,63,0,<.\board.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 1,1,1,570425344,0,25,34,0,<.\application.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,88,0,0,0,116,0,0,0,236,2,0,0,123,1,0,0 } +OPTFFF 1,2,1,0,0,63,74,0,<.\board.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 1,3,1,0,0,130,135,0,<.\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,22,0,0,0,29,0,0,0,161,2,0,0,71,1,0,0 } OPTFFF 1,4,5,134217728,0,84,84,0,<.\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,0,0,0,0,0,0,0,0,139,2,0,0,42,1,0,0 } -OPTFFF 1,5,1,922746880,0,0,0,0,<.\sdcard.c> +OPTFFF 1,5,1,0,0,89,95,0,<.\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,22,0,0,0,29,0,0,0,183,2,0,0,9,1,0,0 } OPTFFF 1,6,1,1006632960,0,1,1,0,<.\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,7,5,0,0,0,0,0,<.\board.h> +OPTFFF 1,7,5,0,0,16,20,0,<.\board.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,110,0,0,0,145,0,0,0,227,2,0,0,188,1,0,0 } OPTFFF 2,8,1,0,0,0,0,0,<..\..\src\clock.c> OPTFFF 2,9,1,0,0,0,0,0,<..\..\src\device.c> -OPTFFF 2,10,1,0,0,51,60,0,<..\..\src\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,205,2,0,0,129,1,0,0 } +OPTFFF 2,10,1,687865858,0,51,58,0,<..\..\src\idle.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 2,11,1,0,0,0,0,0,<..\..\src\ipc.c> OPTFFF 2,12,1,0,0,0,0,0,<..\..\src\irq.c> OPTFFF 2,13,1,0,0,0,0,0,<..\..\src\mem.c> @@ -61,68 +61,59 @@ OPTFFF 4,39,1,0,0,0,0,0,<..\..\libcpu\arm\lm3s\serial.c> OPTFFF 4,40,1,0,0,0,0,0,<..\..\libcpu\arm\lm3s\fault.c> OPTFFF 4,41,2,0,0,0,0,0,<..\..\libcpu\arm\lm3s\fault_rvds.S> OPTFFF 5,42,4,0,0,0,0,0,<..\..\bsp\lm3s\Libraries\driverlib\rvmdk\driverlib.lib> -OPTFFF 6,43,1,1,0,0,0,0,<..\..\filesystem\dfs\src\dfs_init.c> +OPTFFF 6,43,1,0,0,0,0,0,<..\..\filesystem\dfs\src\dfs_init.c> OPTFFF 6,44,1,0,0,0,0,0,<..\..\filesystem\dfs\src\dfs_fs.c> OPTFFF 6,45,1,0,0,0,0,0,<..\..\filesystem\dfs\src\dfs_raw.c> OPTFFF 6,46,1,0,0,0,0,0,<..\..\filesystem\dfs\src\dfs_util.c> -OPTFFF 6,47,1,0,0,0,0,0,<..\..\filesystem\dfs\src\dfs_cache.c> -OPTFFF 6,48,1,0,0,0,0,0,<..\..\filesystem\dfs\src\dfs_posix.c> -OPTFFF 6,49,1,0,0,0,0,0,<..\..\filesystem\dfs\filesystems\efsl\src\base\efs.c> -OPTFFF 6,50,1,0,0,0,0,0,<..\..\filesystem\dfs\filesystems\efsl\src\base\extract.c> -OPTFFF 6,51,1,0,0,0,0,0,<..\..\filesystem\dfs\filesystems\efsl\src\base\partition.c> -OPTFFF 6,52,1,0,0,0,0,0,<..\..\filesystem\dfs\filesystems\efsl\src\base\plibc.c> -OPTFFF 6,53,1,0,0,0,0,0,<..\..\filesystem\dfs\filesystems\efsl\src\fs\vfat\dir.c> -OPTFFF 6,54,1,0,0,0,0,0,<..\..\filesystem\dfs\filesystems\efsl\src\fs\vfat\fat.c> -OPTFFF 6,55,1,0,0,0,0,0,<..\..\filesystem\dfs\filesystems\efsl\src\fs\vfat\file.c> -OPTFFF 6,56,1,0,0,0,0,0,<..\..\filesystem\dfs\filesystems\efsl\src\fs\vfat\fs.c> -OPTFFF 6,57,1,0,0,0,0,0,<..\..\filesystem\dfs\filesystems\efsl\src\fs\vfat\ls.c> -OPTFFF 6,58,1,0,0,0,0,0,<..\..\filesystem\dfs\filesystems\efsl\src\fs\vfat\time.c> -OPTFFF 6,59,1,0,0,0,0,0,<..\..\filesystem\dfs\filesystems\efsl\src\fs\vfat\ui.c> -OPTFFF 7,60,1,0,0,0,0,0,<..\..\net\lwip\src\core\dhcp.c> -OPTFFF 7,61,1,0,0,0,0,0,<..\..\net\lwip\src\core\dns.c> -OPTFFF 7,62,1,0,0,247,247,0,<..\..\net\lwip\src\core\init.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,0,0,0,0,0,0,0,0,139,2,0,0,42,1,0,0 } -OPTFFF 7,63,1,0,0,0,0,0,<..\..\net\lwip\src\core\netif.c> -OPTFFF 7,64,1,0,0,0,0,0,<..\..\net\lwip\src\core\pbuf.c> -OPTFFF 7,65,1,0,0,0,0,0,<..\..\net\lwip\src\core\raw.c> -OPTFFF 7,66,1,0,0,0,0,0,<..\..\net\lwip\src\core\stats.c> -OPTFFF 7,67,1,0,0,0,0,0,<..\..\net\lwip\src\core\sys.c> -OPTFFF 7,68,1,0,0,381,381,0,<..\..\net\lwip\src\core\tcp.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,88,0,0,0,116,0,0,0,227,2,0,0,158,1,0,0 } -OPTFFF 7,69,1,0,0,0,0,0,<..\..\net\lwip\src\core\tcp_in.c> -OPTFFF 7,70,1,0,0,0,0,0,<..\..\net\lwip\src\core\tcp_out.c> -OPTFFF 7,71,1,0,0,0,0,0,<..\..\net\lwip\src\core\udp.c> -OPTFFF 7,72,1,0,0,0,0,0,<..\..\net\lwip\src\core\ipv4\autoip.c> -OPTFFF 7,73,1,0,0,0,0,0,<..\..\net\lwip\src\core\ipv4\icmp.c> -OPTFFF 7,74,1,0,0,0,0,0,<..\..\net\lwip\src\core\ipv4\igmp.c> -OPTFFF 7,75,1,0,0,0,0,0,<..\..\net\lwip\src\core\ipv4\inet.c> -OPTFFF 7,76,1,0,0,0,0,0,<..\..\net\lwip\src\core\ipv4\inet_chksum.c> -OPTFFF 7,77,1,0,0,0,0,0,<..\..\net\lwip\src\core\ipv4\ip.c> -OPTFFF 7,78,1,0,0,0,0,0,<..\..\net\lwip\src\core\ipv4\ip_addr.c> -OPTFFF 7,79,1,0,0,0,0,0,<..\..\net\lwip\src\core\ipv4\ip_frag.c> -OPTFFF 7,80,1,0,0,0,0,0,<..\..\net\lwip\src\core\snmp\msg_in.c> -OPTFFF 7,81,1,0,0,0,0,0,<..\..\net\lwip\src\core\snmp\msg_out.c> -OPTFFF 7,82,1,0,0,0,0,0,<..\..\net\lwip\src\api\api_lib.c> -OPTFFF 7,83,1,0,0,0,0,0,<..\..\net\lwip\src\api\api_msg.c> -OPTFFF 7,84,1,0,0,0,0,0,<..\..\net\lwip\src\api\err.c> -OPTFFF 7,85,1,0,0,0,0,0,<..\..\net\lwip\src\api\netbuf.c> -OPTFFF 7,86,1,0,0,0,0,0,<..\..\net\lwip\src\api\netdb.c> -OPTFFF 7,87,1,0,0,0,0,0,<..\..\net\lwip\src\api\netifapi.c> -OPTFFF 7,88,1,0,0,0,0,0,<..\..\net\lwip\src\api\tcpip.c> -OPTFFF 7,89,1,0,0,0,0,0,<..\..\net\lwip\src\netif\etharp.c> -OPTFFF 7,90,1,0,0,0,0,0,<..\..\net\lwip\src\netif\ethernetif.c> -OPTFFF 7,91,1,0,0,0,0,0,<..\..\net\lwip\src\netif\loopif.c> -OPTFFF 7,92,1,0,0,0,0,0,<..\..\net\lwip\src\arch\sys_arch_init.c> -OPTFFF 7,93,1,0,0,0,0,0,<..\..\net\lwip\src\arch\sys_arch.c> -OPTFFF 7,94,1,0,0,0,0,0,<..\..\net\lwip\src\api\sockets.c> -OPTFFF 7,95,1,503316480,0,350,359,0,<..\..\net\lwip\src\core\memp.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,205,2,0,0,47,1,0,0 } -OPTFFF 7,96,1,0,0,0,0,0,<..\..\net\lwip\src\core\snmp\asn1_dec.c> -OPTFFF 7,97,1,0,0,0,0,0,<..\..\net\lwip\src\core\snmp\asn1_enc.c> -OPTFFF 7,98,1,838860802,0,4104,4104,0,<..\..\net\lwip\src\core\snmp\mib2.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,183,2,0,0,172,0,0,0 } -OPTFFF 7,99,1,0,0,0,0,0,<..\..\net\lwip\src\core\snmp\mib_structs.c> +OPTFFF 6,47,1,0,0,0,0,0,<..\..\filesystem\dfs\src\dfs_posix.c> +OPTFFF 6,48,1,0,0,0,0,0,<..\..\filesystem\dfs\filesystems\elmfat\ff.c> +OPTFFF 6,49,1,0,0,0,0,0,<..\..\filesystem\dfs\filesystems\elmfat\dfs_elm.c> +OPTFFF 7,50,1,0,0,0,0,0,<..\..\net\lwip\src\core\dhcp.c> +OPTFFF 7,51,1,0,0,0,0,0,<..\..\net\lwip\src\core\dns.c> +OPTFFF 7,52,1,0,0,247,247,0,<..\..\net\lwip\src\core\init.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,0,0,0,0,0,0,0,0,139,2,0,0,42,1,0,0 } +OPTFFF 7,53,1,0,0,0,0,0,<..\..\net\lwip\src\core\netif.c> +OPTFFF 7,54,1,0,0,0,0,0,<..\..\net\lwip\src\core\pbuf.c> +OPTFFF 7,55,1,0,0,0,0,0,<..\..\net\lwip\src\core\raw.c> +OPTFFF 7,56,1,0,0,0,0,0,<..\..\net\lwip\src\core\stats.c> +OPTFFF 7,57,1,0,0,0,0,0,<..\..\net\lwip\src\core\sys.c> +OPTFFF 7,58,1,0,0,381,381,0,<..\..\net\lwip\src\core\tcp.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,88,0,0,0,116,0,0,0,227,2,0,0,158,1,0,0 } +OPTFFF 7,59,1,0,0,0,0,0,<..\..\net\lwip\src\core\tcp_in.c> +OPTFFF 7,60,1,0,0,0,0,0,<..\..\net\lwip\src\core\tcp_out.c> +OPTFFF 7,61,1,0,0,0,0,0,<..\..\net\lwip\src\core\udp.c> +OPTFFF 7,62,1,0,0,0,0,0,<..\..\net\lwip\src\core\ipv4\autoip.c> +OPTFFF 7,63,1,0,0,0,0,0,<..\..\net\lwip\src\core\ipv4\icmp.c> +OPTFFF 7,64,1,0,0,0,0,0,<..\..\net\lwip\src\core\ipv4\igmp.c> +OPTFFF 7,65,1,0,0,0,0,0,<..\..\net\lwip\src\core\ipv4\inet.c> +OPTFFF 7,66,1,0,0,0,0,0,<..\..\net\lwip\src\core\ipv4\inet_chksum.c> +OPTFFF 7,67,1,0,0,0,0,0,<..\..\net\lwip\src\core\ipv4\ip.c> +OPTFFF 7,68,1,0,0,0,0,0,<..\..\net\lwip\src\core\ipv4\ip_addr.c> +OPTFFF 7,69,1,0,0,0,0,0,<..\..\net\lwip\src\core\ipv4\ip_frag.c> +OPTFFF 7,70,1,0,0,0,0,0,<..\..\net\lwip\src\core\snmp\msg_in.c> +OPTFFF 7,71,1,0,0,0,0,0,<..\..\net\lwip\src\core\snmp\msg_out.c> +OPTFFF 7,72,1,0,0,0,0,0,<..\..\net\lwip\src\api\api_lib.c> +OPTFFF 7,73,1,0,0,0,0,0,<..\..\net\lwip\src\api\api_msg.c> +OPTFFF 7,74,1,0,0,0,0,0,<..\..\net\lwip\src\api\err.c> +OPTFFF 7,75,1,0,0,0,0,0,<..\..\net\lwip\src\api\netbuf.c> +OPTFFF 7,76,1,0,0,0,0,0,<..\..\net\lwip\src\api\netdb.c> +OPTFFF 7,77,1,0,0,0,0,0,<..\..\net\lwip\src\api\netifapi.c> +OPTFFF 7,78,1,0,0,0,0,0,<..\..\net\lwip\src\api\tcpip.c> +OPTFFF 7,79,1,0,0,0,0,0,<..\..\net\lwip\src\netif\etharp.c> +OPTFFF 7,80,1,0,0,0,0,0,<..\..\net\lwip\src\netif\ethernetif.c> +OPTFFF 7,81,1,0,0,0,0,0,<..\..\net\lwip\src\netif\loopif.c> +OPTFFF 7,82,1,0,0,0,0,0,<..\..\net\lwip\src\arch\sys_arch_init.c> +OPTFFF 7,83,1,0,0,0,0,0,<..\..\net\lwip\src\arch\sys_arch.c> +OPTFFF 7,84,1,0,0,0,0,0,<..\..\net\lwip\src\api\sockets.c> +OPTFFF 7,85,1,503316480,0,350,359,0,<..\..\net\lwip\src\core\memp.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,205,2,0,0,47,1,0,0 } +OPTFFF 7,86,1,0,0,0,0,0,<..\..\net\lwip\src\core\snmp\asn1_dec.c> +OPTFFF 7,87,1,0,0,0,0,0,<..\..\net\lwip\src\core\snmp\asn1_enc.c> +OPTFFF 7,88,1,285212672,0,4104,4104,0,<..\..\net\lwip\src\core\snmp\mib2.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,0,0,0,0,0,0,0,0,183,2,0,0,172,0,0,0 } +OPTFFF 7,89,1,0,0,0,0,0,<..\..\net\lwip\src\core\snmp\mib_structs.c> +ExtF 27,27,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,88,0,0,0,116,0,0,0,205,2,0,0,159,1,0,0 } TARGOPT 1, (RT-Thread-LM3S) ADSCLK=6000000 - OPTTT 0,1,1,0 + OPTTT 1,1,1,0 OPTHX 1,65535,0,0,0 OPTLX 79,66,8,<.\> OPTOX 16 @@ -132,7 +123,11 @@ TARGOPT 1, (RT-Thread-LM3S) OPTAX 0 OPTDL (SARMCM3.DLL)()(DLM.DLL)(-pLM3S6918)(SARMCM3.DLL)()(TLM.DLL)(-pLM3S6918) OPTDBG 49150,7,()()()()()()()()()() (Segger\JL2CM3.dll)()()() - OPTDF 0x0 + OPTKEY 0,(DLGTARM)((1010=-1,-1,-1,-1,0)(1007=-1,-1,-1,-1,0)(1008=-1,-1,-1,-1,0)(1009=-1,-1,-1,-1,0)(110=-1,-1,-1,-1,0)(100=-1,-1,-1,-1,0)(101=-1,-1,-1,-1,0)(102=-1,-1,-1,-1,0)(103=-1,-1,-1,-1,0)(104=-1,-1,-1,-1,0)(105=-1,-1,-1,-1,0)(106=-1,-1,-1,-1,0)(161=-1,-1,-1,-1,0)(162=-1,-1,-1,-1,0)(163=-1,-1,-1,-1,0)(164=-1,-1,-1,-1,0)(150=-1,-1,-1,-1,0)(151=-1,-1,-1,-1,0)(152=-1,-1,-1,-1,0)(1011=-1,-1,-1,-1,0)(1012=-1,-1,-1,-1,0)(1014=-1,-1,-1,-1,0)(1016=-1,-1,-1,-1,0)(136=-1,-1,-1,-1,0)) + 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 OPTLE <> OPTLC <> EndOpt diff --git a/bsp/lm3s/project_lwip_dfs.Uv2 b/bsp/lm3s/project_lwip_dfs.Uv2 index 5a659941c9..03f310d45d 100644 --- a/bsp/lm3s/project_lwip_dfs.Uv2 +++ b/bsp/lm3s/project_lwip_dfs.Uv2 @@ -57,19 +57,9 @@ File 6,1,<..\..\filesystem\dfs\src\dfs_init.c> File 6,1,<..\..\filesystem\dfs\src\dfs_fs.c> File 6,1,<..\..\filesystem\dfs\src\dfs_raw.c> File 6,1,<..\..\filesystem\dfs\src\dfs_util.c> -File 6,1,<..\..\filesystem\dfs\src\dfs_cache.c> File 6,1,<..\..\filesystem\dfs\src\dfs_posix.c> -File 6,1,<..\..\filesystem\dfs\filesystems\efsl\src\base\efs.c> -File 6,1,<..\..\filesystem\dfs\filesystems\efsl\src\base\extract.c> -File 6,1,<..\..\filesystem\dfs\filesystems\efsl\src\base\partition.c> -File 6,1,<..\..\filesystem\dfs\filesystems\efsl\src\base\plibc.c> -File 6,1,<..\..\filesystem\dfs\filesystems\efsl\src\fs\vfat\dir.c> -File 6,1,<..\..\filesystem\dfs\filesystems\efsl\src\fs\vfat\fat.c> -File 6,1,<..\..\filesystem\dfs\filesystems\efsl\src\fs\vfat\file.c> -File 6,1,<..\..\filesystem\dfs\filesystems\efsl\src\fs\vfat\fs.c> -File 6,1,<..\..\filesystem\dfs\filesystems\efsl\src\fs\vfat\ls.c> -File 6,1,<..\..\filesystem\dfs\filesystems\efsl\src\fs\vfat\time.c> -File 6,1,<..\..\filesystem\dfs\filesystems\efsl\src\fs\vfat\ui.c> +File 6,1,<..\..\filesystem\dfs\filesystems\elmfat\ff.c> +File 6,1,<..\..\filesystem\dfs\filesystems\elmfat\dfs_elm.c> File 7,1,<..\..\net\lwip\src\core\dhcp.c> File 7,1,<..\..\net\lwip\src\core\dns.c> File 7,1,<..\..\net\lwip\src\core\init.c> diff --git a/bsp/lm3s/rtconfig.h b/bsp/lm3s/rtconfig.h index 0c343dc91a..2f0c86e9c2 100644 --- a/bsp/lm3s/rtconfig.h +++ b/bsp/lm3s/rtconfig.h @@ -83,6 +83,9 @@ #define RT_USING_DFS /* SECTION: DFS options */ +#define RT_USING_DFS_ELMFAT +#define RT_DFS_ELM_WORD_ACCESS + /* the max number of mounted filesystem */ #define DFS_FILESYSTEMS_MAX 1 /* the max number of opened files */ @@ -95,8 +98,8 @@ #define RT_USING_LWIP /* Trace LwIP protocol*/ -/* #define RT_LWIP_DEBUG */ - +/* #define RT_LWIP_DEBUG */ + #define RT_LWIP_USING_RT_MEM /* Enable ICMP protocol*/ diff --git a/bsp/lm3s/rtconfig.py b/bsp/lm3s/rtconfig.py index 83bec409da..9eadd3e403 100644 --- a/bsp/lm3s/rtconfig.py +++ b/bsp/lm3s/rtconfig.py @@ -1,18 +1,47 @@ -# component options -# finsh shell option -RT_USING_FINSH = True +import SCons.cpp -# device file system options -RT_USING_DFS = True -RT_USING_DFS_EFSL = True -RT_USING_DFS_ELMFAT = False -RT_USING_DFS_YAFFS2 = False +# component options + +# make all component false +RT_USING_DFS = False +RT_USING_FINSH = False +RT_USING_DFS_ELMFAT= False +RT_USING_DFS_YAFFS2= False +RT_USING_LWIP = False +RT_USING_RTGUI = False + +# parse rtconfig.h to get used component +PreProcessor = SCons.cpp.PreProcessor() +f = file('rtconfig.h', 'r') +contents = f.read() +f.close() +PreProcessor.process_contents(contents) +rtconfig_ns = PreProcessor.cpp_namespace + +# finsh shell options +if rtconfig_ns.has_key('RT_USING_FINSH'): + RT_USING_FINSH = True + +# device virtual filesystem options +if rtconfig_ns.has_key('RT_USING_DFS'): + RT_USING_DFS = True + + if rtconfig_ns.has_key('RT_USING_DFS_EFSL'): + RT_USING_DFS_EFSL = True + if rtconfig_ns.has_key('RT_USING_DFS_ELMFAT'): + RT_USING_DFS_ELMFAT = True + if rtconfig_ns.has_key('RT_USING_DFS_YAFFS2'): + RT_USING_DFS_YAFFS2 = True # lwip options -RT_USING_LWIP = True +if rtconfig_ns.has_key('RT_USING_LWIP'): + RT_USING_LWIP = True + if rtconfig_ns.has_key('RT_USING_WEBSERVER'): + RT_USING_WEBSERVER = True # rtgui options -RT_USING_RTGUI = False +if rtconfig_ns.has_key('RT_USING_RTGUI'): + RT_USING_RTGUI = True # toolchains options ARCH='arm' diff --git a/bsp/lm3s/sdcard.c b/bsp/lm3s/sdcard.c index 7cc34f28c5..7699efe51e 100644 --- a/bsp/lm3s/sdcard.c +++ b/bsp/lm3s/sdcard.c @@ -14,14 +14,31 @@ * in this file does not attempt to share the SSI port with the osram, * it assumes the osram is not being used. */ +#include -#include "sdcard.h" #include #include #include #include #include +/* Status of Disk Functions */ +typedef rt_uint8_t DSTATUS; + +/* Results of Disk Functions */ +typedef enum { + RES_OK = 0, /* 0: Successful */ + RES_ERROR, /* 1: R/W Error */ + RES_WRPRT, /* 2: Write Protected */ + RES_NOTRDY, /* 3: Not Ready */ + RES_PARERR /* 4: Invalid Parameter */ +} DRESULT; + +/* Disk Status Bits (DSTATUS) */ + +#define STA_NOINIT 0x01 /* Drive not initialized */ +#define STA_NODISK 0x02 /* No medium in the drive */ +#define STA_PROTECT 0x04 /* Write protected */ /* Definitions for MMC/SDC command */ #define CMD0 (0x40+0) /* GO_IDLE_STATE */ @@ -40,6 +57,27 @@ #define CMD55 (0x40+55) /* APP_CMD */ #define CMD58 (0x40+58) /* READ_OCR */ +/* Command code for disk_ioctrl() */ + +/* Generic command */ +#define CTRL_SYNC 0 /* Mandatory for write functions */ +#define GET_SECTOR_COUNT 1 /* Mandatory for only f_mkfs() */ +#define GET_SECTOR_SIZE 2 /* Mandatory for multiple sector size cfg */ +#define GET_BLOCK_SIZE 3 /* Mandatory for only f_mkfs() */ +#define CTRL_POWER 4 +#define CTRL_LOCK 5 +#define CTRL_EJECT 6 +/* MMC/SDC command */ +#define MMC_GET_TYPE 10 +#define MMC_GET_CSD 11 +#define MMC_GET_CID 12 +#define MMC_GET_OCR 13 +#define MMC_GET_SDSTAT 14 +/* ATA/CF command */ +#define ATA_GET_REV 20 +#define ATA_GET_MODEL 21 +#define ATA_GET_SN 22 + /* Peripheral definitions for EK-LM3S6965 board */ // SSI port #define SDC_SSI_BASE SSI0_BASE @@ -377,8 +415,8 @@ rt_uint8_t send_cmd ( /*-----------------------------------------------------------------------*/ /* Initialize Disk Drive */ /*-----------------------------------------------------------------------*/ - -DSTATUS disk_initialize ( +static +DSTATUS sdcard_initialize ( rt_uint8_t drv /* Physical drive nmuber (0) */ ) { @@ -433,27 +471,11 @@ DSTATUS disk_initialize ( return Stat; } - - -/*-----------------------------------------------------------------------*/ -/* Get Disk Status */ -/*-----------------------------------------------------------------------*/ - -DSTATUS disk_status ( - rt_uint8_t drv /* Physical drive nmuber (0) */ -) -{ - if (drv) return STA_NOINIT; /* Supports only single drive */ - return Stat; -} - - - /*-----------------------------------------------------------------------*/ /* Read Sector(s) */ /*-----------------------------------------------------------------------*/ - -DRESULT disk_read ( +static +DRESULT sdcard_read ( rt_uint8_t drv, /* Physical drive nmuber (0) */ rt_uint8_t *buff, /* Pointer to the data buffer to store read data */ rt_uint32_t sector, /* Start sector number (LBA) */ @@ -495,7 +517,8 @@ DRESULT disk_read ( /*-----------------------------------------------------------------------*/ #if _READONLY == 0 -DRESULT disk_write ( +static +DRESULT sdcard_write ( rt_uint8_t drv, /* Physical drive nmuber (0) */ const rt_uint8_t *buff, /* Pointer to the data to be written */ rt_uint32_t sector, /* Start sector number (LBA) */ @@ -541,8 +564,8 @@ DRESULT disk_write ( /*-----------------------------------------------------------------------*/ /* Miscellaneous Functions */ /*-----------------------------------------------------------------------*/ - -DRESULT disk_ioctl ( +static +DRESULT sdcard_ioctl ( rt_uint8_t drv, /* Physical drive nmuber (0) */ rt_uint8_t ctrl, /* Control code */ void *buff /* Buffer to send/receive control data */ @@ -641,46 +664,6 @@ DRESULT disk_ioctl ( return res; } - - -/*-----------------------------------------------------------------------*/ -/* Device Timer Interrupt Procedure (Platform dependent) */ -/*-----------------------------------------------------------------------*/ -/* This function must be called in period of 10ms */ - -void disk_timerproc (void) -{ -// rt_uint8_t n, s; - rt_uint8_t n; - - - n = Timer1; /* 100Hz decrement timer */ - if (n) Timer1 = --n; - n = Timer2; - if (n) Timer2 = --n; - -} - -/*---------------------------------------------------------*/ -/* User Provided Timer Function for FatFs module */ -/*---------------------------------------------------------*/ -/* This is a real time clock service to be called from */ -/* FatFs module. Any valid time must be returned even if */ -/* the system does not support a real time clock. */ - -rt_uint32_t get_fattime (void) -{ - - return ((2007UL-1980) << 25) // Year = 2007 - | (6UL << 21) // Month = June - | (5UL << 16) // Day = 5 - | (11U << 11) // Hour = 11 - | (38U << 5) // Min = 38 - | (0U >> 1) // Sec = 0 - ; - -} - /* * RT-Thread SD Card Driver * 20090705 Yi.Qiu @@ -714,7 +697,7 @@ static rt_size_t rt_sdcard_read(rt_device_t dev, rt_off_t pos, void* buffer, rt_ { DRESULT status; - status = disk_read(0, buffer, part.offset + pos / SECTOR_SIZE, size / SECTOR_SIZE); + status = sdcard_read(0, buffer, part.offset + pos / SECTOR_SIZE, size / SECTOR_SIZE); if (status != RES_OK) { rt_kprintf("sd card read failed\n"); @@ -728,7 +711,7 @@ static rt_size_t rt_sdcard_write (rt_device_t dev, rt_off_t pos, const void* buf { DRESULT status; - status = disk_write(0, buffer, part.offset + pos / SECTOR_SIZE, size / SECTOR_SIZE); + status = sdcard_write(0, buffer, part.offset + pos / SECTOR_SIZE, size / SECTOR_SIZE); if (status != RES_OK) { rt_kprintf("sd card write failed\n"); @@ -743,9 +726,9 @@ static rt_err_t rt_sdcard_control(rt_device_t dev, rt_uint8_t cmd, void *args) return RT_EOK; } -void rt_hw_sdcard_init() +void rt_hw_sdcard_init(void) { - if (disk_initialize(0) == RES_OK) + if (sdcard_initialize(0) == RES_OK) { DRESULT status; rt_uint8_t *sector; @@ -757,7 +740,7 @@ void rt_hw_sdcard_init() rt_kprintf("allocate partition sector buffer failed\n"); return; } - status = disk_read(0, sector, 0, 1); + status = sdcard_read(0, sector, 0, 1); if (status == RES_OK) { /* get the first partition */ @@ -781,9 +764,9 @@ void rt_hw_sdcard_init() /* register sdcard device */ sdcard_device.init = rt_sdcard_init; sdcard_device.open = rt_sdcard_open; - sdcard_device.close = rt_sdcard_close; + sdcard_device.close = rt_sdcard_close; sdcard_device.read = rt_sdcard_read; - sdcard_device.write = rt_sdcard_write; + sdcard_device.write = rt_sdcard_write; sdcard_device.control = rt_sdcard_control; /* no private */ diff --git a/bsp/lm3s/sdcard.h b/bsp/lm3s/sdcard.h deleted file mode 100644 index 64d99e7f99..0000000000 --- a/bsp/lm3s/sdcard.h +++ /dev/null @@ -1,60 +0,0 @@ -/*----------------------------------------------------------------------- -/ Low level disk interface modlue include file R0.04a (C)ChaN, 2007 -/-----------------------------------------------------------------------*/ - -#ifndef __SDCARD_H__ -#define __SDCARD_H__ - -#define _READONLY 0 /* 1: Read-only mode */ - -#include - - -/* Status of Disk Functions */ -typedef rt_uint8_t DSTATUS; - -/* Results of Disk Functions */ -typedef enum { - RES_OK = 0, /* 0: Successful */ - RES_ERROR, /* 1: R/W Error */ - RES_WRPRT, /* 2: Write Protected */ - RES_NOTRDY, /* 3: Not Ready */ - RES_PARERR /* 4: Invalid Parameter */ -} DRESULT; - - -/*---------------------------------------*/ -/* Prototypes for disk control functions */ - -DSTATUS disk_initialize (rt_uint8_t); -DSTATUS disk_status (rt_uint8_t); -DRESULT disk_read (rt_uint8_t, rt_uint8_t*, rt_uint32_t, rt_uint8_t); -#if _READONLY == 0 -DRESULT disk_write (rt_uint8_t, const rt_uint8_t*, rt_uint32_t, rt_uint8_t); -#endif -DRESULT disk_ioctl (rt_uint8_t, rt_uint8_t, void*); -void disk_timerproc (void); - -/* Disk Status Bits (DSTATUS) */ - -#define STA_NOINIT 0x01 /* Drive not initialized */ -#define STA_NODISK 0x02 /* No medium in the drive */ -#define STA_PROTECT 0x04 /* Write protected */ - - -/* Command code for disk_ioctrl() */ - -#define GET_SECTOR_COUNT 1 -#define GET_SECTOR_SIZE 2 -#define CTRL_SYNC 3 -#define CTRL_POWER 4 -#define CTRL_LOCK 5 -#define CTRL_EJECT 6 -#define MMC_GET_CSD 10 -#define MMC_GET_CID 11 -#define MMC_GET_OCR 12 -#define ATA_GET_REV 20 -#define ATA_GET_MODEL 21 -#define ATA_GET_SN 22 - -#endif