diff --git a/bsp/stm3210/project_filesystem/startup.c b/bsp/stm3210/project_filesystem/startup.c index 36fe4b37a..fcc5e453b 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 5b131ea50..8411987ae 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 c0b5b3a25..b7d9f4d41 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 dbbe524b8..4cbd469b0 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 695b6c8be..0107d126e 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 24d3b66e8..bfe5d6714 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 8efccc26a..9588e44a4 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 5b131ea50..8411987ae 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 f47292e14..b17602999 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 0c452762d..46a828f7a 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 5b131ea50..8411987ae 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.