diff --git a/bsp/stm3210/project_filesystem/startup.c b/bsp/stm3210/project_filesystem/startup.c index 36fe4b37a033751e2217e8d459f3c2485018d878..fcc5e453bc0cbd99c27bac70b1df20923198dd4a 100644 --- a/bsp/stm3210/project_filesystem/startup.c +++ b/bsp/stm3210/project_filesystem/startup.c @@ -96,8 +96,6 @@ void rtthread_startup(void) /* init scheduler system */ rt_system_scheduler_init(); - /* init hardware serial device */ - rt_hw_usart_init(); /* init sdcard driver */ #if STM32_USE_SDIO rt_hw_sdcard_init(); diff --git a/bsp/stm3210/project_filesystem/stm32f10x_it.c b/bsp/stm3210/project_filesystem/stm32f10x_it.c index 5b131ea50ff69606febc852db9c8be3bb2ccb8b1..8411987ae9758a33ef3abe3eab169a08c1a1f67a 100644 --- a/bsp/stm3210/project_filesystem/stm32f10x_it.c +++ b/bsp/stm3210/project_filesystem/stm32f10x_it.c @@ -156,31 +156,6 @@ void DMA1_Channel2_IRQHandler(void) #endif } -/******************************************************************************* -* Function Name : DMA1_Channel6_IRQHandler -* Description : This function handles DMA1 Channel 6 interrupt request. -* Input : None -* Output : None -* Return : None -*******************************************************************************/ -void DMA1_Channel6_IRQHandler(void) -{ -#ifdef RT_USING_UART2 - extern struct rt_device uart2_device; - extern void rt_hw_serial_dma_rx_isr(struct rt_device *device); - - /* enter interrupt */ - rt_interrupt_enter(); - - /* clear DMA flag */ - DMA_ClearFlag(DMA1_FLAG_TC6 | DMA1_FLAG_TE6); - rt_hw_serial_dma_rx_isr(&uart2_device); - - /* leave interrupt */ - rt_interrupt_leave(); -#endif -} - /******************************************************************************* * Function Name : USART1_IRQHandler * Description : This function handles USART1 global interrupt request. diff --git a/bsp/stm3210/project_finsh/startup.c b/bsp/stm3210/project_finsh/startup.c index c0b5b3a25e851823f0d682230e488ad612e81cc3..b7d9f4d4173187e297bb8b3bd6ab2536f6405d75 100644 --- a/bsp/stm3210/project_finsh/startup.c +++ b/bsp/stm3210/project_finsh/startup.c @@ -96,8 +96,6 @@ void rtthread_startup(void) /* init scheduler system */ rt_system_scheduler_init(); - /* init hardware serial device */ - rt_hw_usart_init(); /* init all device */ rt_device_init_all(); diff --git a/bsp/stm3210/project_finsh/stm32f10x_it.c b/bsp/stm3210/project_finsh/stm32f10x_it.c index dbbe524b86b65112d13cf4ae9cab62f8248251f9..4cbd469b0b08a6b75b4aa935502cf99c676ecd8c 100644 --- a/bsp/stm3210/project_finsh/stm32f10x_it.c +++ b/bsp/stm3210/project_finsh/stm32f10x_it.c @@ -156,31 +156,6 @@ void DMA1_Channel2_IRQHandler(void) #endif } -/******************************************************************************* -* Function Name : DMA1_Channel6_IRQHandler -* Description : This function handles DMA1 Channel 6 interrupt request. -* Input : None -* Output : None -* Return : None -*******************************************************************************/ -void DMA1_Channel6_IRQHandler(void) -{ -#ifdef RT_USING_UART2 - extern struct rt_device uart2_device; - extern void rt_hw_serial_dma_rx_isr(struct rt_device *device); - - /* enter interrupt */ - rt_interrupt_enter(); - - /* clear DMA flag */ - DMA_ClearFlag(DMA1_FLAG_TC6 | DMA1_FLAG_TE6); - rt_hw_serial_dma_rx_isr(&uart2_device); - - /* leave interrupt */ - rt_interrupt_leave(); -#endif -} - /******************************************************************************* * Function Name : USART1_IRQHandler * Description : This function handles USART1 global interrupt request. diff --git a/bsp/stm3210/project_full/board.h b/bsp/stm3210/project_full/board.h index 695b6c8bef46fe797f87c84e454a4735a2aa46ed..0107d126e558c6a48b6612415e8c1bee1ff32cc1 100644 --- a/bsp/stm3210/project_full/board.h +++ b/bsp/stm3210/project_full/board.h @@ -1,7 +1,7 @@ /* * File : board.h * This file is part of RT-Thread RTOS - * COPYRIGHT (C) 2006, RT-Thread Develop Team + * COPYRIGHT (C) 2009, RT-Thread Development Team * * The license and distribution terms for this file may be * found in the file LICENSE in this distribution or at @@ -50,6 +50,16 @@ void rt_hw_board_led_on(int n); void rt_hw_board_led_off(int n); void rt_hw_board_init(void); +#if STM32_CONSOLE_USART == 0 +#define CONSOLE_DEVICE "no" +#elif STM32_CONSOLE_USART == 1 +#define CONSOLE_DEVICE "uart1" +#elif STM32_CONSOLE_USART == 2 +#define CONSOLE_DEVICE "uart2" +#elif STM32_CONSOLE_USART == 3 +#define CONSOLE_DEVICE "uart3" +#endif + void rt_hw_usart_init(void); /* SD Card init function */ diff --git a/bsp/stm3210/project_full/rtconfig.h b/bsp/stm3210/project_full/rtconfig.h index 24d3b66e8416c26799a5ded9bb42581070cd1d78..bfe5d6714ef1490ba28167db89b66a0250466fba 100644 --- a/bsp/stm3210/project_full/rtconfig.h +++ b/bsp/stm3210/project_full/rtconfig.h @@ -73,8 +73,7 @@ /* SECTION: device filesystem */ #define RT_USING_DFS -#define RT_USING_DFS_EFSL -/* #define RT_USING_DFS_ELMFAT */ +#define RT_USING_DFS_ELMFAT /* the max number of mounted filesystem */ #define DFS_FILESYSTEMS_MAX 2 diff --git a/bsp/stm3210/project_full/startup.c b/bsp/stm3210/project_full/startup.c index 8efccc26a14565ebd96454918eb8c0aba54ccd92..9588e44a45af3670c4592c4154344f7710580709 100644 --- a/bsp/stm3210/project_full/startup.c +++ b/bsp/stm3210/project_full/startup.c @@ -97,9 +97,6 @@ void rtthread_startup(void) /* init scheduler system */ rt_system_scheduler_init(); - /* init hardware serial device */ - rt_hw_usart_init(); - #ifdef RT_USING_DFS /* init sdcard driver */ #if STM32_USE_SDIO diff --git a/bsp/stm3210/project_full/stm32f10x_it.c b/bsp/stm3210/project_full/stm32f10x_it.c index 5b131ea50ff69606febc852db9c8be3bb2ccb8b1..8411987ae9758a33ef3abe3eab169a08c1a1f67a 100644 --- a/bsp/stm3210/project_full/stm32f10x_it.c +++ b/bsp/stm3210/project_full/stm32f10x_it.c @@ -156,31 +156,6 @@ void DMA1_Channel2_IRQHandler(void) #endif } -/******************************************************************************* -* Function Name : DMA1_Channel6_IRQHandler -* Description : This function handles DMA1 Channel 6 interrupt request. -* Input : None -* Output : None -* Return : None -*******************************************************************************/ -void DMA1_Channel6_IRQHandler(void) -{ -#ifdef RT_USING_UART2 - extern struct rt_device uart2_device; - extern void rt_hw_serial_dma_rx_isr(struct rt_device *device); - - /* enter interrupt */ - rt_interrupt_enter(); - - /* clear DMA flag */ - DMA_ClearFlag(DMA1_FLAG_TC6 | DMA1_FLAG_TE6); - rt_hw_serial_dma_rx_isr(&uart2_device); - - /* leave interrupt */ - rt_interrupt_leave(); -#endif -} - /******************************************************************************* * Function Name : USART1_IRQHandler * Description : This function handles USART1 global interrupt request. diff --git a/bsp/stm3210/project_led_simple/project.Uv2 b/bsp/stm3210/project_led_simple/project.Uv2 index f47292e1473937712b40cc63b0aa025e10e58f0e..b17602999c83d46acad3d3c3dfc174ffd14bca8b 100644 --- a/bsp/stm3210/project_led_simple/project.Uv2 +++ b/bsp/stm3210/project_led_simple/project.Uv2 @@ -2,6 +2,7 @@ ### 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) @@ -16,6 +17,7 @@ File 1,1,<.\startup.c> File 1,1,<.\led.c> File 1,5,<.\rtconfig.h> File 1,5,<.\board.h> +File 1,1,<.\usart.c> 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> @@ -60,6 +62,7 @@ File 5,1,<..\..\libcpu\arm\stm32\stack.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 5,1,<..\..\libcpu\arm\stm32\serial.c> Options 1,0,0 // Target 'RT-Thread STM32' @@ -144,11 +147,101 @@ Options 1,0,0 // Target 'RT-Thread STM32' ADSLDMC () ADSLDIF () ADSLDDW () - OPTDL (SARMCM3.DLL)()(DARMSTM.DLL)(-pSTM32F107xCSchedule)(SARMCM3.DLL)()(TARMSTM.DLL)(-pSTM32F107xC) - OPTDBG 49149,7,()()()()()()()()()() (Segger\JL2CM3.dll)()()() + 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_lwip/startup.c b/bsp/stm3210/project_lwip/startup.c index 0c452762d731fd022705b6d942c044f03f26288a..46a828f7a99fe571cc6b1ab43040328f0efb2af6 100644 --- a/bsp/stm3210/project_lwip/startup.c +++ b/bsp/stm3210/project_lwip/startup.c @@ -96,12 +96,6 @@ void rtthread_startup(void) /* init scheduler system */ rt_system_scheduler_init(); - /* init hardware serial device */ - rt_hw_usart_init(); - - /* init all device */ - rt_device_init_all(); - /* init application */ rt_application_init(); diff --git a/bsp/stm3210/project_lwip/stm32f10x_it.c b/bsp/stm3210/project_lwip/stm32f10x_it.c index 5b131ea50ff69606febc852db9c8be3bb2ccb8b1..8411987ae9758a33ef3abe3eab169a08c1a1f67a 100644 --- a/bsp/stm3210/project_lwip/stm32f10x_it.c +++ b/bsp/stm3210/project_lwip/stm32f10x_it.c @@ -156,31 +156,6 @@ void DMA1_Channel2_IRQHandler(void) #endif } -/******************************************************************************* -* Function Name : DMA1_Channel6_IRQHandler -* Description : This function handles DMA1 Channel 6 interrupt request. -* Input : None -* Output : None -* Return : None -*******************************************************************************/ -void DMA1_Channel6_IRQHandler(void) -{ -#ifdef RT_USING_UART2 - extern struct rt_device uart2_device; - extern void rt_hw_serial_dma_rx_isr(struct rt_device *device); - - /* enter interrupt */ - rt_interrupt_enter(); - - /* clear DMA flag */ - DMA_ClearFlag(DMA1_FLAG_TC6 | DMA1_FLAG_TE6); - rt_hw_serial_dma_rx_isr(&uart2_device); - - /* leave interrupt */ - rt_interrupt_leave(); -#endif -} - /******************************************************************************* * Function Name : USART1_IRQHandler * Description : This function handles USART1 global interrupt request.