diff --git a/bsp/stm3210/application.c b/bsp/stm3210/application.c index 1737067e39..8cde671bbb 100644 --- a/bsp/stm3210/application.c +++ b/bsp/stm3210/application.c @@ -1,7 +1,7 @@ /* * File : application.c * This file is part of RT-Thread RTOS - * COPYRIGHT (C) 2009, RT-Thread Development Team + * COPYRIGHT (C) 2006, RT-Thread Development Team * * The license and distribution terms for this file may be * found in the file LICENSE in this distribution or at @@ -17,105 +17,71 @@ */ /*@{*/ -#include #include +#include "led.h" -#ifdef RT_USING_DFS -/* dfs init */ -#include -/* dfs filesystem:EFS filesystem init */ -#include -/* dfs Filesystem APIs */ -#include -#endif - -#ifdef RT_USING_LWIP -#include -#include -#include -#endif - -void rt_init_thread_entry(void* parameter) +char thread_led1_stack[512]; +struct rt_thread thread_led1; +static void rt_thread_entry_led1(void* parameter) { -/* Filesystem Initialization */ -#ifdef RT_USING_DFS - { - /* init the device filesystem */ - dfs_init(); + /* init led configuration */ + rt_hw_led_init(); -#ifdef RT_USING_DFS_EFSL - /* init the efsl filesystam*/ - efsl_init(); + while (1) + { + /* led on */ + rt_kprintf("led1 on\r\n"); + rt_hw_led_on(0); + rt_thread_delay(50); /* sleep 0.5 second and switch to other thread */ - /* mount sd card fat partition 1 as root directory */ - if (dfs_mount("sd0", "/", "efs", 0, 0) == 0) - { - rt_kprintf("File System initialized!\n"); - } - else - rt_kprintf("File System initialzation failed!\n"); -#elif defined(RT_USING_DFS_ELMFAT) - /* init the elm chan FatFs filesystam*/ - elm_init(); + /* led off */ + rt_kprintf("led1 off\r\n"); + rt_hw_led_off(0); + rt_thread_delay(50); + } +} - /* mount sd card fat partition 1 as root directory */ - if (dfs_mount("sd0", "/", "elm", 0, 0) == 0) - { - rt_kprintf("File System initialized!\n"); - } - else - rt_kprintf("File System initialzation failed!\n"); -#endif - } -#endif +char thread_led2_stack[512]; +struct rt_thread thread_led2; +void rt_thread_entry_led2(void* parameter) +{ + unsigned int count=0; + while (1) + { + /* led on */ + rt_kprintf("led2 on,count : %d\r\n",count); + count++; + rt_hw_led_on(1); + rt_thread_delay(RT_TICK_PER_SECOND); -/* LwIP Initialization */ -#ifdef RT_USING_LWIP - { - extern void lwip_sys_init(void); - - /* register ethernetif device */ - eth_system_device_init(); - -#ifdef STM32F10X_CL - rt_hw_stm32_eth_init(); -#else - /* STM32F103 */ - #if STM32_ETH_IF == 0 - rt_hw_enc28j60_init(); - #elif STM32_ETH_IF == 1 - rt_hw_dm9000_init(); - #endif -#endif - - /* re-init device driver */ - rt_device_init_all(); - - /* init lwip system */ - lwip_sys_init(); - rt_kprintf("TCP/IP initialized!\n"); - } -#endif + /* led off */ + rt_kprintf("led2 off\r\n"); + rt_hw_led_off(1); + rt_thread_delay(RT_TICK_PER_SECOND); + } } int rt_application_init() { - rt_thread_t init_thread; + /* init led1 thread */ + rt_thread_init(&thread_led1, + "led1", + rt_thread_entry_led1, + RT_NULL, + &thread_led1_stack[0], + sizeof(thread_led1_stack),10,10); + rt_thread_startup(&thread_led1); -#if (RT_THREAD_PRIORITY_MAX == 32) - init_thread = rt_thread_create("init", - rt_init_thread_entry, RT_NULL, - 2048, 8, 20); -#else - init_thread = rt_thread_create("init", - rt_init_thread_entry, RT_NULL, - 2048, 80, 20); -#endif + /* init led2 thread */ + rt_thread_init(&thread_led2, + "led2", + rt_thread_entry_led2, + RT_NULL, + &thread_led2_stack[0], + sizeof(thread_led2_stack),10,10); + rt_thread_startup(&thread_led2); - if (init_thread != RT_NULL) - rt_thread_startup(init_thread); - - return 0; + return 0; } /*@}*/ diff --git a/bsp/stm3210/led.c b/bsp/stm3210/led.c index 25b44e3517..6645965d2e 100644 --- a/bsp/stm3210/led.c +++ b/bsp/stm3210/led.c @@ -14,6 +14,15 @@ #include #include +#ifdef STM32_SIMULATOR +#define led1_rcc RCC_APB2Periph_GPIOA +#define led1_gpio GPIOA +#define led1_pin (GPIO_Pin_5) + +#define led2_rcc RCC_APB2Periph_GPIOA +#define led2_gpio GPIOA +#define led2_pin (GPIO_Pin_6) +#else #define led1_rcc RCC_APB2Periph_GPIOF #define led1_gpio GPIOF #define led1_pin (GPIO_Pin_6 | GPIO_Pin_7) @@ -21,6 +30,7 @@ #define led2_rcc RCC_APB2Periph_GPIOF #define led2_gpio GPIOF #define led2_pin (GPIO_Pin_8) +#endif void rt_hw_led_init(void) { diff --git a/bsp/stm3210/project.Uv2 b/bsp/stm3210/project.Uv2 index f49c3a6739..54e98186a8 100644 --- a/bsp/stm3210/project.Uv2 +++ b/bsp/stm3210/project.Uv2 @@ -2,30 +2,23 @@ ### Do not modify ! Target (RT-Thread STM32), 0x0004 // Tools: 'ARM-ADS' +Target (RT-Thread STM32 Simulator), 0x0004 // Tools: 'ARM-ADS' Group (Startup) Group (StdPeriph_Driver) Group (CMSIS) Group (Kernel) Group (STM32) -Group (finsh) -Group (Filesystem) -Group (LwIP) File 1,1,<.\stm32f10x_it.c> File 1,1,<.\board.c> File 1,1,<.\application.c> File 1,1,<.\startup.c> File 1,1,<.\led.c> -File 1,1,<.\usart.c> -File 1,1,<.\sdcard.c> -File 1,1,<.\msd.c> -File 1,1,<.\enc28j60.c> -File 1,1,<.\dm9000a.c> -File 1,1,<.\rtc.c> File 1,5,<.\rtconfig.h> File 1,5,<.\board.h> File 2,1,<.\Libraries\STM32F10x_StdPeriph_Driver\src\misc.c> +File 2,1,<.\Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_wwdg.c> File 2,1,<.\Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_adc.c> File 2,1,<.\Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_bkp.c> File 2,1,<.\Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_can.c> @@ -46,7 +39,6 @@ File 2,1,<.\Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_sdio.c> File 2,1,<.\Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_tim.c> File 2,1,<.\Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_usart.c> -File 2,1,<.\Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_wwdg.c> File 3,1,<.\Libraries\CMSIS\Core\CM3\core_cm3.c> File 3,1,<.\Libraries\CMSIS\Core\CM3\system_stm32f10x.c> File 4,1,<..\..\src\clock.c> @@ -66,63 +58,9 @@ File 5,1,<..\..\libcpu\arm\stm32\cpu.c> File 5,1,<..\..\libcpu\arm\stm32\fault.c> File 5,1,<..\..\libcpu\arm\stm32\interrupt.c> File 5,1,<..\..\libcpu\arm\stm32\stack.c> -File 5,1,<..\..\libcpu\arm\stm32\serial.c> File 5,2,<..\..\libcpu\arm\stm32\context_rvds.S> File 5,2,<..\..\libcpu\arm\stm32\fault_rvds.S> File 5,2,<..\..\libcpu\arm\stm32\start_rvds.s> -File 6,1,<..\..\finsh\symbol.c> -File 6,1,<..\..\finsh\cmd.c> -File 6,1,<..\..\finsh\finsh_compiler.c> -File 6,1,<..\..\finsh\finsh_error.c> -File 6,1,<..\..\finsh\finsh_heap.c> -File 6,1,<..\..\finsh\finsh_init.c> -File 6,1,<..\..\finsh\finsh_node.c> -File 6,1,<..\..\finsh\finsh_ops.c> -File 6,1,<..\..\finsh\finsh_parser.c> -File 6,1,<..\..\finsh\finsh_token.c> -File 6,1,<..\..\finsh\finsh_var.c> -File 6,1,<..\..\finsh\finsh_vm.c> -File 6,1,<..\..\finsh\shell.c> -File 7,1,<..\..\filesystem\dfs\src\dfs_util.c> -File 7,1,<..\..\filesystem\dfs\src\dfs_fs.c> -File 7,1,<..\..\filesystem\dfs\src\dfs_init.c> -File 7,1,<..\..\filesystem\dfs\src\dfs_posix.c> -File 7,1,<..\..\filesystem\dfs\src\dfs_raw.c> -File 7,1,<..\..\filesystem\dfs\filesystems\elmfat\ff.c> -File 7,1,<..\..\filesystem\dfs\filesystems\elmfat\dfs_elm.c> -File 8,1,<..\..\net\lwip\src\core\dhcp.c> -File 8,1,<..\..\net\lwip\src\core\dns.c> -File 8,1,<..\..\net\lwip\src\core\init.c> -File 8,1,<..\..\net\lwip\src\core\memp.c> -File 8,1,<..\..\net\lwip\src\core\netif.c> -File 8,1,<..\..\net\lwip\src\core\pbuf.c> -File 8,1,<..\..\net\lwip\src\core\raw.c> -File 8,1,<..\..\net\lwip\src\core\stats.c> -File 8,1,<..\..\net\lwip\src\core\sys.c> -File 8,1,<..\..\net\lwip\src\core\tcp.c> -File 8,1,<..\..\net\lwip\src\core\tcp_in.c> -File 8,1,<..\..\net\lwip\src\core\tcp_out.c> -File 8,1,<..\..\net\lwip\src\core\udp.c> -File 8,1,<..\..\net\lwip\src\core\ipv4\ip_frag.c> -File 8,1,<..\..\net\lwip\src\core\ipv4\autoip.c> -File 8,1,<..\..\net\lwip\src\core\ipv4\icmp.c> -File 8,1,<..\..\net\lwip\src\core\ipv4\igmp.c> -File 8,1,<..\..\net\lwip\src\core\ipv4\inet.c> -File 8,1,<..\..\net\lwip\src\core\ipv4\inet_chksum.c> -File 8,1,<..\..\net\lwip\src\core\ipv4\ip.c> -File 8,1,<..\..\net\lwip\src\core\ipv4\ip_addr.c> -File 8,1,<..\..\net\lwip\src\api\tcpip.c> -File 8,1,<..\..\net\lwip\src\api\api_lib.c> -File 8,1,<..\..\net\lwip\src\api\api_msg.c> -File 8,1,<..\..\net\lwip\src\api\err.c> -File 8,1,<..\..\net\lwip\src\api\netbuf.c> -File 8,1,<..\..\net\lwip\src\api\netdb.c> -File 8,1,<..\..\net\lwip\src\api\netifapi.c> -File 8,1,<..\..\net\lwip\src\api\sockets.c> -File 8,1,<..\..\net\lwip\src\netif\ethernetif.c> -File 8,1,<..\..\net\lwip\src\netif\etharp.c> -File 8,1,<..\..\net\lwip\src\arch\sys_arch_init.c> -File 8,1,<..\..\net\lwip\src\arch\sys_arch.c> Options 1,0,0 // Target 'RT-Thread STM32' @@ -183,7 +121,7 @@ Options 1,0,0 // Target 'RT-Thread STM32' ADSCMISC () ADSCDEFN (USE_STDPERIPH_DRIVER, STM32F10X_HD,) ADSCUDEF () - ADSCINCD (.\Libraries\STM32F10x_StdPeriph_Driver\inc;.\Libraries\CMSIS\Core\CM3;..\..\include;.;..\..\libcpu\arm\stm32;..\..\filesystem\dfs;..\..\filesystem\dfs\include;..\..\net\lwip\src;..\..\net\lwip\src\include;..\..\net\lwip\src\arch\include;..\..\net\lwip\src\include\ipv4;..\..\finsh) + ADSCINCD (.\Libraries\STM32F10x_StdPeriph_Driver\inc;.\Libraries\CMSIS\Core\CM3;..\..\include;.;..\..\libcpu\arm\stm32) ADSASFLG { 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } ADSAMISC () ADSADEFN () @@ -204,14 +142,104 @@ Options 1,0,0 // Target 'RT-Thread STM32' ADSLDSC () ADSLDIB () ADSLDIC () - ADSLDMC (--keep __fsym_* --keep __vsym_*) + ADSLDMC () ADSLDIF () ADSLDDW () - OPTDL (SARMCM3.DLL)()(DARMSTM.DLL)(-pSTM32F107xCSchedule)(SARMCM3.DLL)()(TARMSTM.DLL)(-pSTM32F107xC) - OPTDBG 49149,7,()()()()()()()()()() (Segger\JL2CM3.dll)()()() - FLASH1 { 9,0,0,0,1,0,0,0,6,16,0,0,0,0,0,0,0,0,0,0 } + OPTDL (SARMCM3.DLL)()(DARMSTM.DLL)(-pSTM32F103ZE)(SARMCM3.DLL)()(TARMSTM.DLL)(-pSTM32F103ZE) + OPTDBG 49150,7,()()()()()()()()()() (Segger\JL2CM3.dll)()()() + FLASH1 { 9,0,0,0,1,0,0,0,5,16,0,0,0,0,0,0,0,0,0,0 } FLASH2 (Segger\JL2CM3.dll) FLASH3 ("" ()) FLASH4 () EndOpt +Options 2,0,0 // Target 'RT-Thread STM32 Simulator' + Device (STM32F103ZE) + Vendor (STMicroelectronics) + Cpu (IRAM(0x20000000-0x2000FFFF) IROM(0x8000000-0x807FFFF) CLOCK(8000000) CPUTYPE("Cortex-M3")) + FlashUt () + StupF ("STARTUP\ST\STM32F10x.s" ("STM32 Startup Code")) + FlashDR (UL2CM3(-O14 -S0 -C0 -N00("ARM Cortex-M3") -D00(1BA00477) -L00(4) -FO7 -FD20000000 -FC800 -FN1 -FF0STM32F10x_512 -FS08000000 -FL080000)) + DevID (4216) + Rgf (stm32f10x_lib.h) + Mem () + C () + A () + RL () + OH () + DBC_IFX () + DBC_CMS () + DBC_AMS () + DBC_LMS () + UseEnv=0 + EnvBin () + EnvInc () + EnvLib () + EnvReg (˙ST\STM32F10x\) + OrgReg (˙ST\STM32F10x\) + TgStat=16 + OutDir (.\obj\) + OutName (rtthread-stm32) + GenApp=1 + GenLib=0 + GenHex=0 + Debug=1 + Browse=0 + LstDir (.\obj\) + HexSel=1 + MG32K=0 + TGMORE=0 + RunUsr 0 0 <> + RunUsr 1 0 <> + BrunUsr 0 0 <> + BrunUsr 1 0 <> + CrunUsr 0 0 <> + CrunUsr 1 0 <> + SVCSID <> + GLFLAGS=1790 + ADSFLGA { 243,31,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } + ACPUTYP ("Cortex-M3") + RVDEV () + ADSTFLGA { 0,12,0,2,99,0,0,66,0,0,0,0,0,0,0,0,0,0,0,0 } + OCMADSOCM { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } + OCMADSIRAM { 0,0,0,0,32,0,0,1,0 } + OCMADSIROM { 1,0,0,0,8,0,0,8,0 } + OCMADSXRAM { 0,0,0,0,0,0,0,0,0 } + OCR_RVCT { 1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,1,0,0,0,8,0,0,8,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,32,0,0,1,0,0,0,0,0,0,0,0,0,0 } + RV_STAVEC () + ADSCCFLG { 5,32,0,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } + ADSCMISC () + ADSCDEFN (USE_STDPERIPH_DRIVER, STM32F10X_HD, STM32_SIMULATOR) + ADSCUDEF () + ADSCINCD (.\Libraries\STM32F10x_StdPeriph_Driver\inc;.\Libraries\CMSIS\Core\CM3;..\..\include;.;..\..\libcpu\arm\stm32) + ADSASFLG { 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } + ADSAMISC () + ADSADEFN () + ADSAUDEF () + ADSAINCD () + PropFld { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } + IncBld=1 + AlwaysBuild=0 + GenAsm=0 + AsmAsm=0 + PublicsOnly=0 + StopCode=3 + CustArgs () + LibMods () + ADSLDFG { 17,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } + ADSLDTA (0x08000000) + ADSLDDA (0x20000000) + ADSLDSC () + ADSLDIB () + ADSLDIC () + ADSLDMC () + ADSLDIF () + ADSLDDW () + OPTDL (SARMCM3.DLL)()(DARMSTM.DLL)(-pSTM32F103ZE)(SARMCM3.DLL)()(TARMSTM.DLL)(-pSTM32F103ZE) + OPTDBG 49149,7,()()()()()()()()()() (Segger\JL2CM3.dll)()()() + FLASH1 { 9,0,0,0,1,0,0,0,5,16,0,0,0,0,0,0,0,0,0,0 } + FLASH2 (Segger\JLTAgdi.dll) + FLASH3 ("" ()) + FLASH4 () +EndOpt + diff --git a/bsp/stm3210/project.ewp b/bsp/stm3210/project.ewp index 44b5d4b048..a4b74f9df2 100644 --- a/bsp/stm3210/project.ewp +++ b/bsp/stm3210/project.ewp @@ -285,16 +285,6 @@ $PROJ_DIR$\Libraries\CMSIS\Core\CM3 $PROJ_DIR$\..\..\include $PROJ_DIR$\..\..\libcpu\arm\stm32 - $PROJ_DIR$\..\..\finsh - $PROJ_DIR$\..\..\filesystem\dfs - $PROJ_DIR$\..\..\filesystem\dfs\include - $PROJ_DIR$\..\..\filesystem\dfs\filesystems\efsl\src\include - $PROJ_DIR$\..\..\filesystem\dfs\filesystems\efsl\src\base\include - $PROJ_DIR$\..\..\filesystem\dfs\filesystems\efsl\src\fs\vfat\include - $PROJ_DIR$\..\..\net\lwip\src - $PROJ_DIR$\..\..\net\lwip\src\include - $PROJ_DIR$\..\..\net\lwip\src\arch\include - $PROJ_DIR$\..\..\net\lwip\src\include\ipv4