Browse Source

update stm32f10x

git-svn-id: https://rt-thread.googlecode.com/svn/trunk@1534 bbd45198-f89e-11dd-88c7-29a3b14d5316
wuyangyong 14 years ago
parent
commit
de1f2b6b84

+ 1 - 1
bsp/stm32f10x/SConscript

@@ -15,7 +15,7 @@ if GetDepend('RT_USING_LWIP'):
 	if rtconfig.STM32_TYPE == 'STM32F10X_CL':
 		src_drv += ['stm32_eth.c']
 	else:
-		src_drv += ['enc28j60.c']
+		src_drv += ['enc28j60.c'] + ['dm9000a.c']
 
 src = src_bsp + src_drv
 CPPPATH = [RTT_ROOT + '/bsp/stm32f10x']

+ 42 - 0
bsp/stm32f10x/application.c

@@ -35,6 +35,36 @@
 #include <netif/ethernetif.h>
 #endif
 
+#include "led.h"
+
+ALIGN(RT_ALIGN_SIZE)
+static struct rt_thread led_thread;
+static rt_uint32_t led_stack[512/4];
+static void led_thread_entry(void* parameter)
+{
+    unsigned int count=0;
+
+    rt_hw_led_init();
+
+    while (1)
+    {
+        /* led1 on */
+#ifndef RT_USING_FINSH
+        rt_kprintf("led on, count : %d\r\n",count);
+#endif
+        count++;
+        rt_hw_led_on(0);
+        rt_thread_delay( RT_TICK_PER_SECOND/2 ); /* sleep 0.5 second and switch to other thread */
+
+        /* led1 off */
+#ifndef RT_USING_FINSH
+        rt_kprintf("led2 off\r\n");
+#endif
+        rt_hw_led_off(0);
+        rt_thread_delay( RT_TICK_PER_SECOND/2 );
+    }
+}
+
 void rt_init_thread_entry(void* parameter)
 {
 /* Filesystem Initialization */
@@ -91,6 +121,18 @@ int rt_application_init()
 {
 	rt_thread_t init_thread;
 
+	rt_err_t result;
+
+    /* init led thread */
+	result = rt_thread_init(&led_thread,
+		"led",
+		led_thread_entry, RT_NULL,
+		(rt_uint8_t*)&led_stack[0], sizeof(led_stack), 20, 5);
+	if (result == RT_EOK)
+	{
+        rt_thread_startup(&led_thread);
+	}
+
 #if (RT_THREAD_PRIORITY_MAX == 32)
 	init_thread = rt_thread_create("init",
 								rt_init_thread_entry, RT_NULL,

+ 1 - 1
bsp/stm32f10x/board.h

@@ -44,7 +44,7 @@
 
 // <o> Ethernet Interface: <0=> Microchip ENC28J60 <1=> Davicom DM9000A
 // 	<i>Default: 0
-#define STM32_ETH_IF			0
+#define STM32_ETH_IF			1
 
 void rt_hw_board_led_on(int n);
 void rt_hw_board_led_off(int n);

+ 2 - 2
bsp/stm32f10x/dm9000a.c

@@ -27,7 +27,7 @@
 #endif
 
 /*
- * DM9000 interrupt line is connected to PF7
+ * DM9000 interrupt line is connected to PE4
  */
 //--------------------------------------------------------
 
@@ -586,7 +586,7 @@ static void NVIC_Configuration(void)
 {
     NVIC_InitTypeDef NVIC_InitStructure;
 
-    /* Enable the EXTI0 Interrupt */
+    /* Enable the EXTI4 Interrupt */
     NVIC_InitStructure.NVIC_IRQChannel = EXTI4_IRQn;
     NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 1;
     NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0;

+ 11 - 7
bsp/stm32f10x/led.c

@@ -14,6 +14,7 @@
 #include <rtthread.h>
 #include <stm32f10x.h>
 
+// led define
 #ifdef STM32_SIMULATOR
 #define led1_rcc                    RCC_APB2Periph_GPIOA
 #define led1_gpio                   GPIOA
@@ -22,15 +23,18 @@
 #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)
 
-#define led2_rcc                    RCC_APB2Periph_GPIOF
-#define led2_gpio                   GPIOF
-#define led2_pin                    (GPIO_Pin_8)
-#endif
+#define led1_rcc                    RCC_APB2Periph_GPIOE
+#define led1_gpio                   GPIOE
+#define led1_pin                    (GPIO_Pin_2)
+
+#define led2_rcc                    RCC_APB2Periph_GPIOE
+#define led2_gpio                   GPIOE
+#define led2_pin                    (GPIO_Pin_3)
+
+#endif // led define #ifdef STM32_SIMULATOR
 
 void rt_hw_led_init(void)
 {

+ 42 - 87
bsp/stm32f10x/project.Uv2

@@ -6,9 +6,7 @@ Target (RT-Thread STM32), 0x0004 // Tools: 'ARM-ADS'
 Group (Startup)
 Group (Kernel)
 Group (STM32)
-Group (Filesystem)
 Group (finsh)
-Group (LwIP)
 Group (STM32_StdPeriph)
 
 File 1,1,<.\application.c><application.c>
@@ -19,8 +17,6 @@ File 1,1,<.\rtc.c><rtc.c>
 File 1,1,<.\usart.c><usart.c>
 File 1,1,<.\serial.c><serial.c>
 File 1,1,<.\led.c><led.c>
-File 1,1,<.\sdcard.c><sdcard.c>
-File 1,1,<.\enc28j60.c><enc28j60.c>
 File 2,1,<..\..\src\clock.c><clock.c>
 File 2,1,<..\..\src\device.c><device.c>
 File 2,1,<..\..\src\idle.c><idle.c>
@@ -41,86 +37,45 @@ File 3,2,<..\..\libcpu\arm\stm32\context_rvds.S><context_rvds.S>
 File 3,1,<..\..\libcpu\arm\common\backtrace.c><backtrace.c>
 File 3,1,<..\..\libcpu\arm\common\div0.c><div0.c>
 File 3,1,<..\..\libcpu\arm\common\showmem.c><showmem.c>
-File 4,1,<..\..\components\dfs\src\dfs.c><dfs.c>
-File 4,1,<..\..\components\dfs\src\dfs_fs.c><dfs_fs.c>
-File 4,1,<..\..\components\dfs\src\dfs_file.c><dfs_file.c>
-File 4,1,<..\..\components\dfs\src\dfs_posix.c><dfs_posix.c>
-File 4,1,<..\..\components\dfs\filesystems\elmfat\dfs_elm.c><dfs_elm.c>
-File 4,1,<..\..\components\dfs\filesystems\elmfat\ff.c><ff.c>
-File 5,1,<..\..\components\finsh\cmd.c><cmd.c>
-File 5,1,<..\..\components\finsh\finsh_compiler.c><finsh_compiler.c>
-File 5,1,<..\..\components\finsh\finsh_error.c><finsh_error.c>
-File 5,1,<..\..\components\finsh\finsh_heap.c><finsh_heap.c>
-File 5,1,<..\..\components\finsh\finsh_init.c><finsh_init.c>
-File 5,1,<..\..\components\finsh\finsh_node.c><finsh_node.c>
-File 5,1,<..\..\components\finsh\finsh_ops.c><finsh_ops.c>
-File 5,1,<..\..\components\finsh\finsh_parser.c><finsh_parser.c>
-File 5,1,<..\..\components\finsh\finsh_token.c><finsh_token.c>
-File 5,1,<..\..\components\finsh\finsh_var.c><finsh_var.c>
-File 5,1,<..\..\components\finsh\finsh_vm.c><finsh_vm.c>
-File 5,1,<..\..\components\finsh\shell.c><shell.c>
-File 5,1,<..\..\components\finsh\symbol.c><symbol.c>
-File 6,1,<..\..\components\net\lwip\src\api\api_lib.c><api_lib.c>
-File 6,1,<..\..\components\net\lwip\src\api\api_msg.c><api_msg.c>
-File 6,1,<..\..\components\net\lwip\src\api\err.c><err.c>
-File 6,1,<..\..\components\net\lwip\src\api\netbuf.c><netbuf.c>
-File 6,1,<..\..\components\net\lwip\src\api\netdb.c><netdb.c>
-File 6,1,<..\..\components\net\lwip\src\api\netifapi.c><netifapi.c>
-File 6,1,<..\..\components\net\lwip\src\api\sockets.c><sockets.c>
-File 6,1,<..\..\components\net\lwip\src\api\tcpip.c><tcpip.c>
-File 6,1,<..\..\components\net\lwip\src\arch\sys_arch.c><sys_arch.c>
-File 6,1,<..\..\components\net\lwip\src\arch\sys_arch_init.c><sys_arch_init.c>
-File 6,1,<..\..\components\net\lwip\src\core\dhcp.c><dhcp.c>
-File 6,1,<..\..\components\net\lwip\src\core\dns.c><dns.c>
-File 6,1,<..\..\components\net\lwip\src\core\init.c><init.c>
-File 6,1,<..\..\components\net\lwip\src\core\memp.c><memp.c>
-File 6,1,<..\..\components\net\lwip\src\core\netif.c><netif.c>
-File 6,1,<..\..\components\net\lwip\src\core\pbuf.c><pbuf.c>
-File 6,1,<..\..\components\net\lwip\src\core\raw.c><raw.c>
-File 6,1,<..\..\components\net\lwip\src\core\stats.c><stats.c>
-File 6,1,<..\..\components\net\lwip\src\core\sys.c><sys.c>
-File 6,1,<..\..\components\net\lwip\src\core\tcp.c><tcp.c>
-File 6,1,<..\..\components\net\lwip\src\core\tcp_in.c><tcp_in.c>
-File 6,1,<..\..\components\net\lwip\src\core\tcp_out.c><tcp_out.c>
-File 6,1,<..\..\components\net\lwip\src\core\udp.c><udp.c>
-File 6,1,<..\..\components\net\lwip\src\core\ipv4\autoip.c><autoip.c>
-File 6,1,<..\..\components\net\lwip\src\core\ipv4\icmp.c><icmp.c>
-File 6,1,<..\..\components\net\lwip\src\core\ipv4\igmp.c><igmp.c>
-File 6,1,<..\..\components\net\lwip\src\core\ipv4\inet.c><inet.c>
-File 6,1,<..\..\components\net\lwip\src\core\ipv4\inet_chksum.c><inet_chksum.c>
-File 6,1,<..\..\components\net\lwip\src\core\ipv4\ip.c><ip.c>
-File 6,1,<..\..\components\net\lwip\src\core\ipv4\ip_addr.c><ip_addr.c>
-File 6,1,<..\..\components\net\lwip\src\core\ipv4\ip_frag.c><ip_frag.c>
-File 6,1,<..\..\components\net\lwip\src\netif\etharp.c><etharp.c>
-File 6,1,<..\..\components\net\lwip\src\netif\ethernetif.c><ethernetif.c>
-File 6,1,<..\..\components\net\lwip\src\netif\loopif.c><loopif.c>
-File 6,1,<..\..\components\net\lwip\src\netif\slipif.c><slipif.c>
-File 7,1,<Libraries\CMSIS\CM3\CoreSupport\core_cm3.c><core_cm3.c>
-File 7,1,<Libraries\CMSIS\CM3\DeviceSupport\ST\STM32F10x\system_stm32f10x.c><system_stm32f10x.c>
-File 7,1,<Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_crc.c><stm32f10x_crc.c>
-File 7,1,<Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_rcc.c><stm32f10x_rcc.c>
-File 7,1,<Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_wwdg.c><stm32f10x_wwdg.c>
-File 7,1,<Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_pwr.c><stm32f10x_pwr.c>
-File 7,1,<Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_exti.c><stm32f10x_exti.c>
-File 7,1,<Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_bkp.c><stm32f10x_bkp.c>
-File 7,1,<Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_i2c.c><stm32f10x_i2c.c>
-File 7,1,<Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_adc.c><stm32f10x_adc.c>
-File 7,1,<Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_dac.c><stm32f10x_dac.c>
-File 7,1,<Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_rtc.c><stm32f10x_rtc.c>
-File 7,1,<Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_fsmc.c><stm32f10x_fsmc.c>
-File 7,1,<Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_tim.c><stm32f10x_tim.c>
-File 7,1,<Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_iwdg.c><stm32f10x_iwdg.c>
-File 7,1,<Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_spi.c><stm32f10x_spi.c>
-File 7,1,<Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_flash.c><stm32f10x_flash.c>
-File 7,1,<Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_sdio.c><stm32f10x_sdio.c>
-File 7,1,<Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_gpio.c><stm32f10x_gpio.c>
-File 7,1,<Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_usart.c><stm32f10x_usart.c>
-File 7,1,<Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_dbgmcu.c><stm32f10x_dbgmcu.c>
-File 7,1,<Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_dma.c><stm32f10x_dma.c>
-File 7,1,<Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_can.c><stm32f10x_can.c>
-File 7,1,<Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_cec.c><stm32f10x_cec.c>
-File 7,1,<Libraries\STM32F10x_StdPeriph_Driver\src\misc.c><misc.c>
-File 7,2,<Libraries\CMSIS\CM3\DeviceSupport\ST\STM32F10x\startup\arm\startup_stm32f10x_hd.s><startup_stm32f10x_hd.s>
+File 4,1,<..\..\components\finsh\cmd.c><cmd.c>
+File 4,1,<..\..\components\finsh\finsh_compiler.c><finsh_compiler.c>
+File 4,1,<..\..\components\finsh\finsh_error.c><finsh_error.c>
+File 4,1,<..\..\components\finsh\finsh_heap.c><finsh_heap.c>
+File 4,1,<..\..\components\finsh\finsh_init.c><finsh_init.c>
+File 4,1,<..\..\components\finsh\finsh_node.c><finsh_node.c>
+File 4,1,<..\..\components\finsh\finsh_ops.c><finsh_ops.c>
+File 4,1,<..\..\components\finsh\finsh_parser.c><finsh_parser.c>
+File 4,1,<..\..\components\finsh\finsh_token.c><finsh_token.c>
+File 4,1,<..\..\components\finsh\finsh_var.c><finsh_var.c>
+File 4,1,<..\..\components\finsh\finsh_vm.c><finsh_vm.c>
+File 4,1,<..\..\components\finsh\shell.c><shell.c>
+File 4,1,<..\..\components\finsh\symbol.c><symbol.c>
+File 5,1,<Libraries\CMSIS\CM3\CoreSupport\core_cm3.c><core_cm3.c>
+File 5,1,<Libraries\CMSIS\CM3\DeviceSupport\ST\STM32F10x\system_stm32f10x.c><system_stm32f10x.c>
+File 5,1,<Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_crc.c><stm32f10x_crc.c>
+File 5,1,<Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_rcc.c><stm32f10x_rcc.c>
+File 5,1,<Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_wwdg.c><stm32f10x_wwdg.c>
+File 5,1,<Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_pwr.c><stm32f10x_pwr.c>
+File 5,1,<Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_exti.c><stm32f10x_exti.c>
+File 5,1,<Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_bkp.c><stm32f10x_bkp.c>
+File 5,1,<Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_i2c.c><stm32f10x_i2c.c>
+File 5,1,<Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_adc.c><stm32f10x_adc.c>
+File 5,1,<Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_dac.c><stm32f10x_dac.c>
+File 5,1,<Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_rtc.c><stm32f10x_rtc.c>
+File 5,1,<Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_fsmc.c><stm32f10x_fsmc.c>
+File 5,1,<Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_tim.c><stm32f10x_tim.c>
+File 5,1,<Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_iwdg.c><stm32f10x_iwdg.c>
+File 5,1,<Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_spi.c><stm32f10x_spi.c>
+File 5,1,<Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_flash.c><stm32f10x_flash.c>
+File 5,1,<Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_sdio.c><stm32f10x_sdio.c>
+File 5,1,<Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_gpio.c><stm32f10x_gpio.c>
+File 5,1,<Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_usart.c><stm32f10x_usart.c>
+File 5,1,<Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_dbgmcu.c><stm32f10x_dbgmcu.c>
+File 5,1,<Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_dma.c><stm32f10x_dma.c>
+File 5,1,<Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_can.c><stm32f10x_can.c>
+File 5,1,<Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_cec.c><stm32f10x_cec.c>
+File 5,1,<Libraries\STM32F10x_StdPeriph_Driver\src\misc.c><misc.c>
+File 5,2,<Libraries\CMSIS\CM3\DeviceSupport\ST\STM32F10x\startup\arm\startup_stm32f10x_hd.s><startup_stm32f10x_hd.s>
 
 
 Options 1,0,0  // Target 'RT-Thread STM32'
@@ -181,7 +136,7 @@ Options 1,0,0  // Target 'RT-Thread STM32'
  ADSCMISC ()
  ADSCDEFN (STM32F10X_HD, USE_STDPERIPH_DRIVER)
  ADSCUDEF ()
- ADSCINCD (Libraries\STM32F10x_StdPeriph_Driver\inc;Libraries\CMSIS\CM3\CoreSupport;..\..\components\dfs;..\..\components\finsh;..\..\components\net\lwip\src\include;.;..\..\components\net\lwip\src\include\ipv4;..\..\include;..\..\components\net\lwip\src\arch\include;..\..\components\dfs\include;..\..\components\net\lwip\src;..\..\libcpu\arm\common;..\..\libcpu\arm\stm32;..\..\components\net\lwip\src\include\netif;Libraries\CMSIS\CM3\DeviceSupport\ST\STM32F10x)
+ ADSCINCD (Libraries\STM32F10x_StdPeriph_Driver\inc;..\..\components\finsh;.;..\..\include;Libraries\CMSIS\CM3\CoreSupport;..\..\libcpu\arm\common;..\..\libcpu\arm\stm32;Libraries\CMSIS\CM3\DeviceSupport\ST\STM32F10x)
  ADSASFLG { 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 }
  ADSAMISC ()
  ADSADEFN ()
@@ -202,11 +157,11 @@ Options 1,0,0  // Target 'RT-Thread STM32'
  ADSLDSC ()
  ADSLDIB ()
  ADSLDIC ()
- ADSLDMC ( --keep __fsym_* --keep __vsym_*)
+ ADSLDMC ( --keep __fsym_* --keep __vsym_* )
  ADSLDIF ()
  ADSLDDW ()
   OPTDL (SARMCM3.DLL)()(DARMSTM.DLL)(-pSTM32F103ZE)(SARMCM3.DLL)()(TARMSTM.DLL)(-pSTM32F103ZE)
-  OPTDBG 49149,7,()()()()()()()()()() (Segger\JL2CM3.dll)()()()
+  OPTDBG 49150,7,()()()()()()()()()() (Segger\JL2CM3.dll)()()()
  FLASH1 { 1,0,0,0,1,0,0,0,6,16,0,0,0,0,0,0,0,0,0,0 }
  FLASH2 (Segger\JL2CM3.dll)
  FLASH3 ("" ())

+ 13 - 141
bsp/stm32f10x/project.ewd

@@ -12,7 +12,7 @@
       <name>C-SPY</name>
       <archiveVersion>2</archiveVersion>
       <data>
-        <version>22</version>
+        <version>21</version>
         <wantNonLocal>1</wantNonLocal>
         <debug>1</debug>
         <option>
@@ -81,7 +81,7 @@
         </option>
         <option>
           <name>OCProductVersion</name>
-          <state>5.30.0.51236</state>
+          <state>5.41.0.51757</state>
         </option>
         <option>
           <name>OCDynDriverList</name>
@@ -89,7 +89,7 @@
         </option>
         <option>
           <name>OCLastSavedByProductVersion</name>
-          <state>5.50.5.51996</state>
+          <state>5.41.0.51757</state>
         </option>
         <option>
           <name>OCDownloadAttachToProgram</name>
@@ -97,7 +97,7 @@
         </option>
         <option>
           <name>UseFlashLoader</name>
-          <state>0</state>
+          <state>1</state>
         </option>
         <option>
           <name>CLowLevel</name>
@@ -147,30 +147,6 @@
           <name>OverrideDefFlashBoard</name>
           <state>0</state>
         </option>
-        <option>
-          <name>OCImagesOffset1</name>
-          <state></state>
-        </option>
-        <option>
-          <name>OCImagesOffset2</name>
-          <state></state>
-        </option>
-        <option>
-          <name>OCImagesOffset3</name>
-          <state></state>
-        </option>
-        <option>
-          <name>OCImagesUse1</name>
-          <state>0</state>
-        </option>
-        <option>
-          <name>OCImagesUse2</name>
-          <state>0</state>
-        </option>
-        <option>
-          <name>OCImagesUse3</name>
-          <state>0</state>
-        </option>
       </data>
     </settings>
     <settings>
@@ -317,7 +293,7 @@
       <name>JLINK_ID</name>
       <archiveVersion>2</archiveVersion>
       <data>
-        <version>11</version>
+        <version>10</version>
         <wantNonLocal>1</wantNonLocal>
         <debug>1</debug>
         <option>
@@ -434,42 +410,6 @@
           <name>CCJLinkInterfaceCmdLine</name>
           <state>0</state>
         </option>
-        <option>
-          <name>CCCatchCORERESET</name>
-          <state>0</state>
-        </option>
-        <option>
-          <name>CCCatchMMERR</name>
-          <state>0</state>
-        </option>
-        <option>
-          <name>CCCatchNOCPERR</name>
-          <state>0</state>
-        </option>
-        <option>
-          <name>CCCatchCHRERR</name>
-          <state>0</state>
-        </option>
-        <option>
-          <name>CCCatchSTATERR</name>
-          <state>0</state>
-        </option>
-        <option>
-          <name>CCCatchBUSERR</name>
-          <state>0</state>
-        </option>
-        <option>
-          <name>CCCatchINTERR</name>
-          <state>0</state>
-        </option>
-        <option>
-          <name>CCCatchHARDERR</name>
-          <state>0</state>
-        </option>
-        <option>
-          <name>CCCatchDummy</name>
-          <state>0</state>
-        </option>
       </data>
     </settings>
     <settings>
@@ -722,10 +662,6 @@
         <file>$TOOLKIT_DIR$\plugins\rtos\PowerPac\PowerPacRTOS.ewplugin</file>
         <loadFlag>0</loadFlag>
       </plugin>
-      <plugin>
-        <file>$TOOLKIT_DIR$\plugins\rtos\Quadros\Quadros_EWB5_Plugin.ewplugin</file>
-        <loadFlag>0</loadFlag>
-      </plugin>
       <plugin>
         <file>$TOOLKIT_DIR$\plugins\rtos\ThreadX\ThreadXArmPlugin.ENU.ewplugin</file>
         <loadFlag>0</loadFlag>
@@ -770,7 +706,7 @@
       <name>C-SPY</name>
       <archiveVersion>2</archiveVersion>
       <data>
-        <version>22</version>
+        <version>21</version>
         <wantNonLocal>1</wantNonLocal>
         <debug>0</debug>
         <option>
@@ -803,7 +739,7 @@
         </option>
         <option>
           <name>MemFile</name>
-          <state>$TOOLKIT_DIR$\CONFIG\debugger\ST\iostm32f10xxb.ddf</state>
+          <state></state>
         </option>
         <option>
           <name>RunToEnable</name>
@@ -839,15 +775,15 @@
         </option>
         <option>
           <name>OCProductVersion</name>
-          <state>5.30.0.51236</state>
+          <state>5.41.0.51757</state>
         </option>
         <option>
           <name>OCDynDriverList</name>
-          <state>JLINK_ID</state>
+          <state>ARMSIM_ID</state>
         </option>
         <option>
           <name>OCLastSavedByProductVersion</name>
-          <state>5.30.0.51236</state>
+          <state></state>
         </option>
         <option>
           <name>OCDownloadAttachToProgram</name>
@@ -905,30 +841,6 @@
           <name>OverrideDefFlashBoard</name>
           <state>0</state>
         </option>
-        <option>
-          <name>OCImagesOffset1</name>
-          <state></state>
-        </option>
-        <option>
-          <name>OCImagesOffset2</name>
-          <state></state>
-        </option>
-        <option>
-          <name>OCImagesOffset3</name>
-          <state></state>
-        </option>
-        <option>
-          <name>OCImagesUse1</name>
-          <state>0</state>
-        </option>
-        <option>
-          <name>OCImagesUse2</name>
-          <state>0</state>
-        </option>
-        <option>
-          <name>OCImagesUse3</name>
-          <state>0</state>
-        </option>
       </data>
     </settings>
     <settings>
@@ -1075,7 +987,7 @@
       <name>JLINK_ID</name>
       <archiveVersion>2</archiveVersion>
       <data>
-        <version>11</version>
+        <version>10</version>
         <wantNonLocal>1</wantNonLocal>
         <debug>0</debug>
         <option>
@@ -1177,7 +1089,7 @@
         </option>
         <option>
           <name>CCJLinkInterfaceRadio</name>
-          <state>1</state>
+          <state>0</state>
         </option>
         <option>
           <name>OCJLinkAttachSlave</name>
@@ -1186,48 +1098,12 @@
         <option>
           <name>CCJLinkResetList</name>
           <version>2</version>
-          <state>7</state>
+          <state>5</state>
         </option>
         <option>
           <name>CCJLinkInterfaceCmdLine</name>
           <state>0</state>
         </option>
-        <option>
-          <name>CCCatchCORERESET</name>
-          <state>0</state>
-        </option>
-        <option>
-          <name>CCCatchMMERR</name>
-          <state>0</state>
-        </option>
-        <option>
-          <name>CCCatchNOCPERR</name>
-          <state>0</state>
-        </option>
-        <option>
-          <name>CCCatchCHRERR</name>
-          <state>0</state>
-        </option>
-        <option>
-          <name>CCCatchSTATERR</name>
-          <state>0</state>
-        </option>
-        <option>
-          <name>CCCatchBUSERR</name>
-          <state>0</state>
-        </option>
-        <option>
-          <name>CCCatchINTERR</name>
-          <state>0</state>
-        </option>
-        <option>
-          <name>CCCatchHARDERR</name>
-          <state>0</state>
-        </option>
-        <option>
-          <name>CCCatchDummy</name>
-          <state>0</state>
-        </option>
       </data>
     </settings>
     <settings>
@@ -1480,10 +1356,6 @@
         <file>$TOOLKIT_DIR$\plugins\rtos\PowerPac\PowerPacRTOS.ewplugin</file>
         <loadFlag>0</loadFlag>
       </plugin>
-      <plugin>
-        <file>$TOOLKIT_DIR$\plugins\rtos\Quadros\Quadros_EWB5_Plugin.ewplugin</file>
-        <loadFlag>0</loadFlag>
-      </plugin>
       <plugin>
         <file>$TOOLKIT_DIR$\plugins\rtos\ThreadX\ThreadXArmPlugin.ENU.ewplugin</file>
         <loadFlag>0</loadFlag>

+ 46 - 129
bsp/stm32f10x/project.ewp

@@ -29,8 +29,8 @@
         </option>
         <option>
           <name>Variant</name>
-          <version>17</version>
-          <state>37</state>
+          <version>13</version>
+          <state>36</state>
         </option>
         <option>
           <name>GEndianMode</name>
@@ -60,7 +60,7 @@
         </option>
         <option>
           <name>FPU</name>
-          <version>1</version>
+          <version>0</version>
           <state>0</state>
         </option>
         <option>
@@ -91,7 +91,7 @@
         </option>
         <option>
           <name>OGLastSavedByProductVersion</name>
-          <state>5.50.5.51996</state>
+          <state>5.41.0.51757</state>
         </option>
         <option>
           <name>GeneralEnableMisra</name>
@@ -141,7 +141,7 @@
       <name>ICCARM</name>
       <archiveVersion>2</archiveVersion>
       <data>
-        <version>22</version>
+        <version>21</version>
         <wantNonLocal>1</wantNonLocal>
         <debug>1</debug>
         <option>
@@ -167,11 +167,11 @@
         </option>
         <option>
           <name>CCListCMnemonics</name>
-          <state>1</state>
+          <state>0</state>
         </option>
         <option>
           <name>CCListCMessages</name>
-          <state>1</state>
+          <state>0</state>
         </option>
         <option>
           <name>CCListAssFile</name>
@@ -280,22 +280,18 @@
         </option>
         <option>
           <name>CCIncludePath2</name>
-          <state>$PROJ_DIR$\.</state>
-          <state>$PROJ_DIR$\Libraries\STM32F10x_StdPeriph_Driver\inc</state>
+          <state>$PROJ_DIR$\</state>
           <state>$PROJ_DIR$\Libraries\CMSIS\CM3\CoreSupport</state>
           <state>$PROJ_DIR$\Libraries\CMSIS\CM3\DeviceSupport\ST\STM32F10x</state>
-          <state>$PROJ_DIR$\..\..\include</state>
-          <state>$PROJ_DIR$\..\..\libcpu\arm\stm32</state>
-          <state>$PROJ_DIR$\..\..\components\finsh</state>
-          <state>$PROJ_DIR$\..\..\components\dfs</state>
-          <state>$PROJ_DIR$\..\..\components\dfs\include</state>
-          <state>$PROJ_DIR$\..\..\components\dfs\filesystems\efsl\src\include</state>
-          <state>$PROJ_DIR$\..\..\components\dfs\filesystems\efsl\src\base\include</state>
-          <state>$PROJ_DIR$\..\..\components\dfs\filesystems\efsl\src\fs\vfat\include</state>
-          <state>$PROJ_DIR$\..\..\components\net\lwip\src</state>
-          <state>$PROJ_DIR$\..\..\components\net\lwip\src\include</state>
-          <state>$PROJ_DIR$\..\..\components\net\lwip\src\arch\include</state>
-          <state>$PROJ_DIR$\..\..\components\net\lwip\src\include\ipv4</state>
+          <state>$PROJ_DIR$\Libraries\STM32F10x_StdPeriph_Driver\inc</state>
+          <state>$PROJ_DIR$/../../include</state>
+          <state>$PROJ_DIR$/../../components\finsh</state>
+          <state>$PROJ_DIR$/../../components\dfs\include</state>
+          <state>$PROJ_DIR$/../../components\dfs\filesystems\elmfat</state>
+          <state>$PROJ_DIR$/../../components\net\lwip\src</state>
+          <state>$PROJ_DIR$/../../components\net\lwip\src\include</state>
+          <state>$PROJ_DIR$/../../components\net\lwip\src\include\ipv4</state>
+          <state>$PROJ_DIR$/../../components\net\lwip\src\arch\include</state>
         </option>
         <option>
           <name>CCStdIncCheck</name>
@@ -340,18 +336,6 @@
           <version>0</version>
           <state>111101110010111111111000110111111111111111111111111110010111101111010101111111111111111111111111101111111011111001111011111011111111111111111</state>
         </option>
-        <option>
-          <name>CCPosIndRopi</name>
-          <state>0</state>
-        </option>
-        <option>
-          <name>CCPosIndRwpi</name>
-          <state>0</state>
-        </option>
-        <option>
-          <name>CCPosIndNoDynInit</name>
-          <state>0</state>
-        </option>
       </data>
     </settings>
     <settings>
@@ -575,7 +559,7 @@
       <name>ILINK</name>
       <archiveVersion>0</archiveVersion>
       <data>
-        <version>9</version>
+        <version>8</version>
         <wantNonLocal>1</wantNonLocal>
         <debug>1</debug>
         <option>
@@ -628,7 +612,7 @@
         </option>
         <option>
           <name>IlinkMapFile</name>
-          <state>1</state>
+          <state>0</state>
         </option>
         <option>
           <name>IlinkLogFile</name>
@@ -789,18 +773,6 @@
           <name>IlinkIElfToolPostProcess</name>
           <state>0</state>
         </option>
-        <option>
-          <name>IlinkLogAutoLibSelect</name>
-          <state>0</state>
-        </option>
-        <option>
-          <name>IlinkLogRedirSymbols</name>
-          <state>0</state>
-        </option>
-        <option>
-          <name>IlinkLogUnusedFragments</name>
-          <state>0</state>
-        </option>
       </data>
     </settings>
     <settings>
@@ -857,7 +829,7 @@
         </option>
         <option>
           <name>Variant</name>
-          <version>17</version>
+          <version>13</version>
           <state>37</state>
         </option>
         <option>
@@ -888,7 +860,7 @@
         </option>
         <option>
           <name>FPU</name>
-          <version>1</version>
+          <version>0</version>
           <state>0</state>
         </option>
         <option>
@@ -969,14 +941,12 @@
       <name>ICCARM</name>
       <archiveVersion>2</archiveVersion>
       <data>
-        <version>22</version>
+        <version>21</version>
         <wantNonLocal>1</wantNonLocal>
         <debug>0</debug>
         <option>
           <name>CCDefines</name>
           <state>NDEBUG</state>
-          <state>USE_STDPERIPH_DRIVER</state>
-          <state>STM32F10X_HD</state>
         </option>
         <option>
           <name>CCPreprocFile</name>
@@ -1016,7 +986,7 @@
         </option>
         <option>
           <name>CCDiagSuppress</name>
-          <state>Pa050</state>
+          <state></state>
         </option>
         <option>
           <name>CCDiagRemark</name>
@@ -1089,7 +1059,7 @@
         </option>
         <option>
           <name>OutputFile</name>
-          <state>$FILE_BNAME$.o</state>
+          <state></state>
         </option>
         <option>
           <name>CCLangSelect</name>
@@ -1109,21 +1079,7 @@
         </option>
         <option>
           <name>CCIncludePath2</name>
-          <state>$PROJ_DIR$\.</state>
-          <state>$PROJ_DIR$\Libraries\STM32F10x_StdPeriph_Driver\inc</state>
-          <state>$PROJ_DIR$\Libraries\CMSIS\Core\CM3</state>
-          <state>$PROJ_DIR$\..\..\include</state>
-          <state>$PROJ_DIR$\..\..\libcpu\arm\stm32</state>
-          <state>$PROJ_DIR$\..\..\finsh</state>
-          <state>$PROJ_DIR$\..\..\filesystem\dfs</state>
-          <state>$PROJ_DIR$\..\..\filesystem\dfs\include</state>
-          <state>$PROJ_DIR$\..\..\filesystem\dfs\filesystems\efsl\src\include</state>
-          <state>$PROJ_DIR$\..\..\filesystem\dfs\filesystems\efsl\src\base\include</state>
-          <state>$PROJ_DIR$\..\..\filesystem\dfs\filesystems\efsl\src\fs\vfat\include</state>
-          <state>$PROJ_DIR$\..\..\net\lwip\src</state>
-          <state>$PROJ_DIR$\..\..\net\lwip\src\include</state>
-          <state>$PROJ_DIR$\..\..\net\lwip\src\arch\include</state>
-          <state>$PROJ_DIR$\..\..\net\lwip\src\include\ipv4</state>
+          <state></state>
         </option>
         <option>
           <name>CCStdIncCheck</name>
@@ -1131,7 +1087,7 @@
         </option>
         <option>
           <name>CCStdIncludePath</name>
-          <state>$TOOLKIT_DIR$\INC\</state>
+          <state>###Uninitialized###</state>
         </option>
         <option>
           <name>CCCodeSection</name>
@@ -1156,7 +1112,7 @@
         </option>
         <option>
           <name>CCOptLevelSlave</name>
-          <state>3</state>
+          <state>1</state>
         </option>
         <option>
           <name>CompilerMisraRules98</name>
@@ -1168,18 +1124,6 @@
           <version>0</version>
           <state>111101110010111111111000110111111111111111111111111110010111101111010101111111111111111111111111101111111011111001111011111011111111111111111</state>
         </option>
-        <option>
-          <name>CCPosIndRopi</name>
-          <state>0</state>
-        </option>
-        <option>
-          <name>CCPosIndRwpi</name>
-          <state>0</state>
-        </option>
-        <option>
-          <name>CCPosIndNoDynInit</name>
-          <state>0</state>
-        </option>
       </data>
     </settings>
     <settings>
@@ -1403,7 +1347,7 @@
       <name>ILINK</name>
       <archiveVersion>0</archiveVersion>
       <data>
-        <version>9</version>
+        <version>8</version>
         <wantNonLocal>1</wantNonLocal>
         <debug>0</debug>
         <option>
@@ -1420,7 +1364,7 @@
         </option>
         <option>
           <name>IlinkOutputFile</name>
-          <state>project.out</state>
+          <state>###Unitialized###</state>
         </option>
         <option>
           <name>IlinkDebugInfoEnable</name>
@@ -1456,7 +1400,7 @@
         </option>
         <option>
           <name>IlinkMapFile</name>
-          <state>1</state>
+          <state>0</state>
         </option>
         <option>
           <name>IlinkLogFile</name>
@@ -1480,11 +1424,11 @@
         </option>
         <option>
           <name>IlinkIcfOverride</name>
-          <state>1</state>
+          <state>0</state>
         </option>
         <option>
           <name>IlinkIcfFile</name>
-          <state>$PROJ_DIR$\stm32f10x_flash.icf</state>
+          <state>lnk0t.icf</state>
         </option>
         <option>
           <name>IlinkIcfFileSlave</name>
@@ -1544,7 +1488,7 @@
         </option>
         <option>
           <name>IlinkProgramEntryLabel</name>
-          <state>__iar_program_start</state>
+          <state></state>
         </option>
         <option>
           <name>DoFill</name>
@@ -1617,18 +1561,6 @@
           <name>IlinkIElfToolPostProcess</name>
           <state>0</state>
         </option>
-        <option>
-          <name>IlinkLogAutoLibSelect</name>
-          <state>0</state>
-        </option>
-        <option>
-          <name>IlinkLogRedirSymbols</name>
-          <state>0</state>
-        </option>
-        <option>
-          <name>IlinkLogUnusedFragments</name>
-          <state>0</state>
-        </option>
       </data>
     </settings>
     <settings>
@@ -1658,15 +1590,6 @@
       <data/>
     </settings>
   </configuration>
-  <group>
-    <name>CMSIS</name>
-    <file>
-      <name>$PROJ_DIR$\Libraries\CMSIS\CM3\CoreSupport\core_cm3.c</name>
-    </file>
-    <file>
-      <name>$PROJ_DIR$\system_stm32f10x.c</name>
-    </file>
-  </group>
   <group>
     <name>Filesystem</name>
     <file>
@@ -1969,6 +1892,9 @@
     <file>
       <name>$PROJ_DIR$\sdcard.c</name>
     </file>
+    <file>
+      <name>$PROJ_DIR$\serial.c</name>
+    </file>
     <file>
       <name>$PROJ_DIR$\startup.c</name>
     </file>
@@ -1981,9 +1907,15 @@
   </group>
   <group>
     <name>StdPeriph_Driver</name>
+    <file>
+      <name>$PROJ_DIR$\Libraries\CMSIS\CM3\CoreSupport\core_cm3.c</name>
+    </file>
     <file>
       <name>$PROJ_DIR$\Libraries\STM32F10x_StdPeriph_Driver\src\misc.c</name>
     </file>
+    <file>
+      <name>$PROJ_DIR$\Libraries\CMSIS\CM3\DeviceSupport\ST\STM32F10x\startup\iar\startup_stm32f10x_hd.s</name>
+    </file>
     <file>
       <name>$PROJ_DIR$\Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_adc.c</name>
     </file>
@@ -2047,6 +1979,9 @@
     <file>
       <name>$PROJ_DIR$\Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_wwdg.c</name>
     </file>
+    <file>
+      <name>$PROJ_DIR$\Libraries\CMSIS\CM3\DeviceSupport\ST\STM32F10x\system_stm32f10x.c</name>
+    </file>
   </group>
   <group>
     <name>STM32</name>
@@ -2054,25 +1989,7 @@
       <name>$PROJ_DIR$\..\..\libcpu\arm\stm32\context_iar.S</name>
     </file>
     <file>
-      <name>$PROJ_DIR$\..\..\libcpu\arm\stm32\cpu.c</name>
-    </file>
-    <file>
-      <name>$PROJ_DIR$\..\..\libcpu\arm\stm32\fault.c</name>
-    </file>
-    <file>
-      <name>$PROJ_DIR$\..\..\libcpu\arm\stm32\fault_iar.S</name>
-    </file>
-    <file>
-      <name>$PROJ_DIR$\..\..\libcpu\arm\stm32\interrupt.c</name>
-    </file>
-    <file>
-      <name>$PROJ_DIR$\..\..\libcpu\arm\stm32\serial.c</name>
-    </file>
-    <file>
-      <name>$PROJ_DIR$\..\..\libcpu\arm\stm32\stack.c</name>
-    </file>
-    <file>
-      <name>$PROJ_DIR$\..\..\libcpu\arm\stm32\start_iar.s</name>
+      <name>$PROJ_DIR$\..\..\libcpu\arm\stm32\cpuport.c</name>
     </file>
   </group>
 </project>

+ 11 - 0
bsp/stm32f10x/readme.txt

@@ -0,0 +1,11 @@
+-- cn --
+按需要生成工程文件:
+1. 修改 rtconfig.py :
+CROSS_TOOL='keil'           #使用的工具链
+STM32_TYPE = 'STM32F10X_HD' #STM32对应的型号.
+2. 修改 rtconfig.h 配置需要的功能.
+2. 执行 scons --target=mdk  生成MDK工程文件.
+
+note: 需要安装 python,scons.
+
+-- en --

+ 15 - 2
bsp/stm32f10x/rtconfig.h

@@ -73,8 +73,18 @@
 #define FINSH_USING_DESCRIPTION
 
 /* SECTION: device filesystem */
-#define RT_USING_DFS
+//#define RT_USING_DFS
+/* #define RT_USING_DFS_EFSL */
+/* byte alignment for EFSL */
+#define BYTE_ALIGNMENT
+
 #define RT_USING_DFS_ELMFAT
+#define RT_DFS_ELM_WORD_ACCESS
+#define RT_DFS_ELM_REENTRANT
+#define RT_DFS_ELM_DRIVES			2
+//#define RT_DFS_ELM_USE_LFN
+#define RT_DFS_ELM_MAX_LFN			255
+#define RT_DFS_ELM_MAX_SECTOR_SIZE  512
 
 /* the max number of mounted filesystem */
 #define DFS_FILESYSTEMS_MAX			2
@@ -84,7 +94,7 @@
 #define DFS_CACHE_MAX_NUM   		4
 
 /* SECTION: lwip, a lighwight TCP/IP protocol stack */
-#define RT_USING_LWIP
+//#define RT_USING_LWIP
 /* LwIP uses RT-Thread Memory Management */
 #define RT_LWIP_USING_RT_MEM
 /* Enable ICMP protocol*/
@@ -99,6 +109,9 @@
 /* the number of simulatenously active TCP connections*/
 #define RT_LWIP_TCP_PCB_NUM	5
 
+/* Using DHCP */
+//#define RT_LWIP_DHCP
+
 /* ip address of target*/
 #define RT_LWIP_IPADDR0	192
 #define RT_LWIP_IPADDR1	168

+ 1 - 1
bsp/stm32f10x/rtconfig.py

@@ -1,7 +1,7 @@
 # toolchains options
 ARCH='arm'
 CPU='stm32'
-CROSS_TOOL='gcc'
+CROSS_TOOL='keil'
 
 if  CROSS_TOOL == 'gcc':
 	PLATFORM 	= 'gcc'

+ 12 - 0
bsp/stm32f10x/sdcard.c

@@ -3161,6 +3161,17 @@ static rt_err_t rt_sdcard_control(rt_device_t dev, rt_uint8_t cmd, void *args)
 
 void rt_hw_sdcard_init()
 {
+    /* SDIO POWER */
+    GPIO_InitTypeDef GPIO_InitStructure;
+
+    RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOC,ENABLE);
+    GPIO_InitStructure.GPIO_Pin = GPIO_Pin_6;
+    GPIO_InitStructure.GPIO_Mode  = GPIO_Mode_Out_PP;
+    GPIO_InitStructure.GPIO_Speed = GPIO_Speed_2MHz;
+    GPIO_Init(GPIOC,&GPIO_InitStructure);
+    GPIO_ResetBits(GPIOC,GPIO_Pin_6); /* SD card power up */
+    // delay same time for SD card power up
+
     if (SD_Init() == SD_OK)
 	{
 		SD_Error status;
@@ -3223,4 +3234,5 @@ void rt_hw_sdcard_init()
 
 __return:
 	rt_kprintf("sdcard init failed\n");
+    GPIO_SetBits(GPIOC,GPIO_Pin_6); /* SD card power down */
 }

+ 1 - 6
bsp/stm32f10x/startup.c

@@ -135,13 +135,8 @@ void rtthread_startup(void)
 
 int main(void)
 {
-	rt_uint32_t UNUSED level;
-
 	/* disable interrupt first */
-	level = rt_hw_interrupt_disable();
-
-	/* init system setting */
-	SystemInit();
+	rt_hw_interrupt_disable();
 
 	/* startup RT-Thread RTOS */
 	rtthread_startup();

+ 4 - 4
bsp/stm32f10x/stm32f10x_it.c

@@ -291,21 +291,21 @@ void EXTI0_IRQHandler(void)
 
 #if (STM32_ETH_IF == 1)
 /*******************************************************************************
-* Function Name  : EXTI9_5_IRQHandler
+* Function Name  : EXTI4_IRQHandler
 * Description    : This function handles External lines 9 to 5 interrupt request.
 * Input          : None
 * Output         : None
 * Return         : None
 *******************************************************************************/
-void EXTI9_5_IRQHandler(void)
+void EXTI4_IRQHandler(void)
 {
 	extern void rt_dm9000_isr(void);
 
 	/* enter interrupt */
 	rt_interrupt_enter();
 
-	/* Clear the Key Button EXTI line pending bit */
-	EXTI_ClearITPendingBit(EXTI_Line7);
+	/* Clear the DM9000A EXTI line pending bit */
+	EXTI_ClearITPendingBit(EXTI_Line4);
 
 	rt_dm9000_isr();