update for scons command build.

git-svn-id: https://rt-thread.googlecode.com/svn/trunk@216 bbd45198-f89e-11dd-88c7-29a3b14d5316
This commit is contained in:
bernard.xiong 2009-12-22 15:46:12 +00:00
parent 8c8aa4418b
commit 1e8cc5ad52
8 changed files with 57 additions and 16 deletions

View File

@ -2,7 +2,6 @@ import os
import rtconfig import rtconfig
RTT_ROOT = os.path.normpath(os.getcwd() + '/../..') RTT_ROOT = os.path.normpath(os.getcwd() + '/../..')
device_type = 'STM32F10X_HD'
target = 'rtthread-stm32' target = 'rtthread-stm32'
# search path for C compiler # search path for C compiler
@ -15,7 +14,7 @@ env = Environment(tools = ['mingw'],
LINK = rtconfig.LINK, LINKFLAGS = rtconfig.LFLAGS) LINK = rtconfig.LINK, LINKFLAGS = rtconfig.LFLAGS)
env.PrependENVPath('PATH', rtconfig.EXEC_PATH) env.PrependENVPath('PATH', rtconfig.EXEC_PATH)
env.AppendUnique(CPPPATH = bsp_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('env')
Export('RTT_ROOT') Export('RTT_ROOT')
@ -41,13 +40,13 @@ src_bsp = ['application.c', 'startup.c', 'board.c', 'stm32f10x_it.c']
src_drv = ['rtc.c', 'usart.c'] src_drv = ['rtc.c', 'usart.c']
if rtconfig.RT_USING_DFS: if rtconfig.RT_USING_DFS:
if device_type == 'STM32F10X_HD': if rtconfig.STM32_TYPE == 'STM32F10X_HD':
src_drv += ['sdcard.c'] src_drv += ['sdcard.c']
else: else:
src_drv += ['msd.c'] src_drv += ['msd.c']
if rtconfig.RT_USING_LWIP: if rtconfig.RT_USING_LWIP:
if device_type == 'STM32F10X_CL': if rtconfig.STM32_TYPE == 'STM32F10X_CL':
src_drv += ['stm32_eth.c'] src_drv += ['stm32_eth.c']
else: else:
src_drv += ['enc28j60.c'] src_drv += ['enc28j60.c']

View File

@ -77,11 +77,17 @@ void rt_init_thread_entry(void* parameter)
/* register ethernetif device */ /* register ethernetif device */
eth_system_device_init(); eth_system_device_init();
#if STM32_ETH_IF == 0 #ifdef STM32F10X_CL
rt_hw_enc28j60_init(); rt_hw_stm32_eth_init();
#elif STM32_ETH_IF == 1 #else
rt_hw_dm9000_init(); /* STM32F103 */
#if STM32_ETH_IF == 0
rt_hw_enc28j60_init();
#elif STM32_ETH_IF == 1
rt_hw_dm9000_init();
#endif
#endif #endif
/* re-init device driver */ /* re-init device driver */
rt_device_init_all(); rt_device_init_all();

View File

@ -746,7 +746,7 @@ u8 MSD_ReadByte(void)
*******************************************************************************/ *******************************************************************************/
void SPI_Config(void) void SPI_Config(void)
{ {
u32 delay; uint32_t delay;
GPIO_InitTypeDef GPIO_InitStructure; GPIO_InitTypeDef GPIO_InitStructure;
SPI_InitTypeDef SPI_InitStructure; SPI_InitTypeDef SPI_InitStructure;

View File

@ -40,6 +40,7 @@
#define MSD_CS_HIGH() GPIO_SetBits(GPIOC, GPIO_Pin_7) #define MSD_CS_HIGH() GPIO_SetBits(GPIOC, GPIO_Pin_7)
/* MSD Card SPI */ /* MSD Card SPI */
#define MSD_SPI SPI3 #define MSD_SPI SPI3
#define MSD_RCC_SPI RCC_APB2Periph_SPI3
/* Private function prototypes -----------------------------------------------*/ /* Private function prototypes -----------------------------------------------*/
static void SPI_Config(void); static void SPI_Config(void);
@ -756,9 +757,9 @@ void SPI_Config(void)
GPIO_PinRemapConfig(GPIO_Remap_SPI3, ENABLE); GPIO_PinRemapConfig(GPIO_Remap_SPI3, ENABLE);
/* SPI Periph clock 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_Pin = GPIO_Pin_10 | GPIO_Pin_11 | GPIO_Pin_12;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_PP; 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_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;
GPIO_Init(GPIOC, &GPIO_InitStructure); GPIO_Init(GPIOC, &GPIO_InitStructure);
/* SPI3 Config */ /* SPI Config */
SPI_InitStructure.SPI_Direction = SPI_Direction_2Lines_FullDuplex; SPI_InitStructure.SPI_Direction = SPI_Direction_2Lines_FullDuplex;
SPI_InitStructure.SPI_Mode = SPI_Mode_Master; SPI_InitStructure.SPI_Mode = SPI_Mode_Master;
SPI_InitStructure.SPI_DataSize = SPI_DataSize_8b; SPI_InitStructure.SPI_DataSize = SPI_DataSize_8b;
@ -785,7 +786,8 @@ void SPI_Config(void)
/* SPI enable */ /* SPI enable */
SPI_Cmd(MSD_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****/ /******************* (C) COPYRIGHT 2008 STMicroelectronics *****END OF FILE****/

View File

@ -24,6 +24,12 @@
/* Using Hook */ /* Using Hook */
#define RT_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 */ /* SECTION: IPC */
/* Using Semaphore*/ /* Using Semaphore*/
#define RT_USING_SEMAPHORE #define RT_USING_SEMAPHORE
@ -68,6 +74,8 @@
/* SECTION: device filesystem */ /* SECTION: device filesystem */
#define RT_USING_DFS #define RT_USING_DFS
#define RT_USING_DFS_EFSL #define RT_USING_DFS_EFSL
/* #define RT_USING_DFS_ELMFAT */
/* the max number of mounted filesystem */ /* the max number of mounted filesystem */
#define DFS_FILESYSTEMS_MAX 2 #define DFS_FILESYSTEMS_MAX 2
/* the max number of opened files */ /* the max number of opened files */

View File

@ -20,10 +20,11 @@ CPU='stm32'
#PLATFORM = 'gcc' #PLATFORM = 'gcc'
#EXEC_PATH = 'd:/codesourcery/bin' #EXEC_PATH = 'd:/codesourcery/bin'
PLATFORM = 'armcc' PLATFORM = 'armcc'
EXEC_PATH = 'c:/Keil' EXEC_PATH = 'C:/Keil'
#PLATFORM = 'iar' #PLATFORM = 'iar'
#EXEC_PATH = 'E:/Program Files/IAR Systems/Embedded Workbench 5.4/' #EXEC_PATH = 'E:/Program Files/IAR Systems/Embedded Workbench 5.4/'
BUILD = 'debug' BUILD = 'debug'
STM32_TYPE = 'STM32F10X_HD'
if PLATFORM == 'gcc': if PLATFORM == 'gcc':
# toolchains # toolchains

View File

@ -99,11 +99,14 @@ void rtthread_startup(void)
/* init hardware serial device */ /* init hardware serial device */
rt_hw_usart_init(); rt_hw_usart_init();
#ifdef RT_USING_DFS
/* init sdcard driver */ /* init sdcard driver */
#if STM32_USE_SDIO #if STM32_USE_SDIO
rt_hw_sdcard_init(); rt_hw_sdcard_init();
#else #else
rt_hw_msd_init(); rt_hw_msd_init();
#endif
#endif #endif
rt_hw_rtc_init(); rt_hw_rtc_init();

View File

@ -250,6 +250,7 @@ void USART3_IRQHandler(void)
#endif #endif
} }
#if defined(RT_USING_DFS) && STM32_USE_SDIO
/******************************************************************************* /*******************************************************************************
* Function Name : SDIO_IRQHandler * Function Name : SDIO_IRQHandler
* Description : This function handles SDIO global interrupt request. * Description : This function handles SDIO global interrupt request.
@ -259,7 +260,6 @@ void USART3_IRQHandler(void)
*******************************************************************************/ *******************************************************************************/
void SDIO_IRQHandler(void) void SDIO_IRQHandler(void)
{ {
#ifdef RT_USING_DFS
extern int SD_ProcessIRQSrc(void); extern int SD_ProcessIRQSrc(void);
/* enter interrupt */ /* enter interrupt */
@ -270,10 +270,31 @@ void SDIO_IRQHandler(void)
/* leave interrupt */ /* leave interrupt */
rt_interrupt_leave(); rt_interrupt_leave();
#endif
} }
#endif
#ifdef RT_USING_LWIP #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) #if (STM32_ETH_IF == 0)
/******************************************************************************* /*******************************************************************************
* Function Name : EXTI0_IRQHandler * Function Name : EXTI0_IRQHandler
@ -323,6 +344,7 @@ void EXTI9_5_IRQHandler(void)
rt_interrupt_leave(); rt_interrupt_leave();
} }
#endif #endif
#endif
#endif /* end of RT_USING_LWIP */ #endif /* end of RT_USING_LWIP */
/** /**