From 1e8cc5ad52f86ca67629949fd1c3c0af6f93f1a0 Mon Sep 17 00:00:00 2001 From: "bernard.xiong" Date: Tue, 22 Dec 2009 15:46:12 +0000 Subject: [PATCH] update for scons command build. git-svn-id: https://rt-thread.googlecode.com/svn/trunk@216 bbd45198-f89e-11dd-88c7-29a3b14d5316 --- bsp/stm3210/SConstruct | 7 +++---- bsp/stm3210/application.c | 14 ++++++++++---- bsp/stm3210/msd.c | 2 +- bsp/stm3210/project_107/msd.c | 10 ++++++---- bsp/stm3210/rtconfig.h | 8 ++++++++ bsp/stm3210/rtconfig.py | 3 ++- bsp/stm3210/startup.c | 3 +++ bsp/stm3210/stm32f10x_it.c | 26 ++++++++++++++++++++++++-- 8 files changed, 57 insertions(+), 16 deletions(-) diff --git a/bsp/stm3210/SConstruct b/bsp/stm3210/SConstruct index 49a59802a1..67451b5922 100644 --- a/bsp/stm3210/SConstruct +++ b/bsp/stm3210/SConstruct @@ -2,7 +2,6 @@ import os import rtconfig RTT_ROOT = os.path.normpath(os.getcwd() + '/../..') -device_type = 'STM32F10X_HD' target = 'rtthread-stm32' # search path for C compiler @@ -15,7 +14,7 @@ env = Environment(tools = ['mingw'], LINK = rtconfig.LINK, LINKFLAGS = rtconfig.LFLAGS) env.PrependENVPath('PATH', rtconfig.EXEC_PATH) env.AppendUnique(CPPPATH = bsp_path) -env.AppendUnique(CCFLAGS = ' -DUSE_STDPERIPH_DRIVER -D' + device_type) +env.AppendUnique(CCFLAGS = ' -DUSE_STDPERIPH_DRIVER -D' + rtconfig.STM32_TYPE) Export('env') Export('RTT_ROOT') @@ -41,13 +40,13 @@ src_bsp = ['application.c', 'startup.c', 'board.c', 'stm32f10x_it.c'] src_drv = ['rtc.c', 'usart.c'] if rtconfig.RT_USING_DFS: - if device_type == 'STM32F10X_HD': + if rtconfig.STM32_TYPE == 'STM32F10X_HD': src_drv += ['sdcard.c'] else: src_drv += ['msd.c'] if rtconfig.RT_USING_LWIP: - if device_type == 'STM32F10X_CL': + if rtconfig.STM32_TYPE == 'STM32F10X_CL': src_drv += ['stm32_eth.c'] else: src_drv += ['enc28j60.c'] diff --git a/bsp/stm3210/application.c b/bsp/stm3210/application.c index 54d1d57208..f929cae172 100644 --- a/bsp/stm3210/application.c +++ b/bsp/stm3210/application.c @@ -77,11 +77,17 @@ void rt_init_thread_entry(void* parameter) /* register ethernetif device */ eth_system_device_init(); -#if STM32_ETH_IF == 0 - rt_hw_enc28j60_init(); -#elif STM32_ETH_IF == 1 - rt_hw_dm9000_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(); diff --git a/bsp/stm3210/msd.c b/bsp/stm3210/msd.c index fc3c1b01cf..f5febf5c0c 100644 --- a/bsp/stm3210/msd.c +++ b/bsp/stm3210/msd.c @@ -746,7 +746,7 @@ u8 MSD_ReadByte(void) *******************************************************************************/ void SPI_Config(void) { - u32 delay; + uint32_t delay; GPIO_InitTypeDef GPIO_InitStructure; SPI_InitTypeDef SPI_InitStructure; diff --git a/bsp/stm3210/project_107/msd.c b/bsp/stm3210/project_107/msd.c index 170bd3f248..da6575701c 100644 --- a/bsp/stm3210/project_107/msd.c +++ b/bsp/stm3210/project_107/msd.c @@ -40,6 +40,7 @@ #define MSD_CS_HIGH() GPIO_SetBits(GPIOC, GPIO_Pin_7) /* MSD Card SPI */ #define MSD_SPI SPI3 +#define MSD_RCC_SPI RCC_APB2Periph_SPI3 /* Private function prototypes -----------------------------------------------*/ static void SPI_Config(void); @@ -756,9 +757,9 @@ void SPI_Config(void) GPIO_PinRemapConfig(GPIO_Remap_SPI3, ENABLE); /* SPI Periph clock enable */ - RCC_APB1PeriphClockCmd(RCC_APB1Periph_SPI3, ENABLE); + RCC_APB2PeriphClockCmd(MSD_RCC_SPI, ENABLE); - /* Configure SPI3 pins: SCK, MISO and MOSI */ + /* Configure SPI pins: SCK, MISO and MOSI */ GPIO_InitStructure.GPIO_Pin = GPIO_Pin_10 | GPIO_Pin_11 | GPIO_Pin_12; GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_PP; @@ -770,7 +771,7 @@ void SPI_Config(void) GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP; GPIO_Init(GPIOC, &GPIO_InitStructure); - /* SPI3 Config */ + /* SPI Config */ SPI_InitStructure.SPI_Direction = SPI_Direction_2Lines_FullDuplex; SPI_InitStructure.SPI_Mode = SPI_Mode_Master; SPI_InitStructure.SPI_DataSize = SPI_DataSize_8b; @@ -785,7 +786,8 @@ void SPI_Config(void) /* SPI enable */ SPI_Cmd(MSD_SPI, ENABLE); - for(delay = 0; delay < 0xfffff; delay++); + /* active SD card */ + for (delay = 0; delay < 0xfffff; delay ++); } /******************* (C) COPYRIGHT 2008 STMicroelectronics *****END OF FILE****/ diff --git a/bsp/stm3210/rtconfig.h b/bsp/stm3210/rtconfig.h index 8ebf2170f9..aa56cbf633 100644 --- a/bsp/stm3210/rtconfig.h +++ b/bsp/stm3210/rtconfig.h @@ -24,6 +24,12 @@ /* Using Hook */ #define RT_USING_HOOK +/* Using Software Timer */ +#define RT_USING_TIMER_SOFT +#define RT_TIMER_THREAD_PRIO 4 +#define RT_TIMER_THREAD_STACK_SIZE 512 +#define RT_TIMER_TICK_PER_SECOND 10 + /* SECTION: IPC */ /* Using Semaphore*/ #define RT_USING_SEMAPHORE @@ -68,6 +74,8 @@ /* SECTION: device filesystem */ #define RT_USING_DFS #define RT_USING_DFS_EFSL +/* #define RT_USING_DFS_ELMFAT */ + /* the max number of mounted filesystem */ #define DFS_FILESYSTEMS_MAX 2 /* the max number of opened files */ diff --git a/bsp/stm3210/rtconfig.py b/bsp/stm3210/rtconfig.py index 5029706788..725a814400 100644 --- a/bsp/stm3210/rtconfig.py +++ b/bsp/stm3210/rtconfig.py @@ -20,10 +20,11 @@ CPU='stm32' #PLATFORM = 'gcc' #EXEC_PATH = 'd:/codesourcery/bin' PLATFORM = 'armcc' -EXEC_PATH = 'c:/Keil' +EXEC_PATH = 'C:/Keil' #PLATFORM = 'iar' #EXEC_PATH = 'E:/Program Files/IAR Systems/Embedded Workbench 5.4/' BUILD = 'debug' +STM32_TYPE = 'STM32F10X_HD' if PLATFORM == 'gcc': # toolchains diff --git a/bsp/stm3210/startup.c b/bsp/stm3210/startup.c index 4b0a81f1d4..a683574de3 100644 --- a/bsp/stm3210/startup.c +++ b/bsp/stm3210/startup.c @@ -99,11 +99,14 @@ void rtthread_startup(void) /* init hardware serial device */ rt_hw_usart_init(); + +#ifdef RT_USING_DFS /* init sdcard driver */ #if STM32_USE_SDIO rt_hw_sdcard_init(); #else rt_hw_msd_init(); +#endif #endif rt_hw_rtc_init(); diff --git a/bsp/stm3210/stm32f10x_it.c b/bsp/stm3210/stm32f10x_it.c index c51749f401..5b131ea50f 100644 --- a/bsp/stm3210/stm32f10x_it.c +++ b/bsp/stm3210/stm32f10x_it.c @@ -250,6 +250,7 @@ void USART3_IRQHandler(void) #endif } +#if defined(RT_USING_DFS) && STM32_USE_SDIO /******************************************************************************* * Function Name : SDIO_IRQHandler * Description : This function handles SDIO global interrupt request. @@ -259,7 +260,6 @@ void USART3_IRQHandler(void) *******************************************************************************/ void SDIO_IRQHandler(void) { -#ifdef RT_USING_DFS extern int SD_ProcessIRQSrc(void); /* enter interrupt */ @@ -270,10 +270,31 @@ void SDIO_IRQHandler(void) /* leave interrupt */ rt_interrupt_leave(); -#endif } +#endif #ifdef RT_USING_LWIP +#ifdef STM32F10X_CL +/******************************************************************************* +* Function Name : ETH_IRQHandler +* Description : This function handles ETH interrupt request. +* Input : None +* Output : None +* Return : None +*******************************************************************************/ +void ETH_IRQHandler(void) +{ + extern void rt_hw_stm32_eth_isr(void); + + /* enter interrupt */ + rt_interrupt_enter(); + + rt_hw_stm32_eth_isr(); + + /* leave interrupt */ + rt_interrupt_leave(); +} +#else #if (STM32_ETH_IF == 0) /******************************************************************************* * Function Name : EXTI0_IRQHandler @@ -323,6 +344,7 @@ void EXTI9_5_IRQHandler(void) rt_interrupt_leave(); } #endif +#endif #endif /* end of RT_USING_LWIP */ /** -- GitLab