diff --git a/bsp/stm3210/project.Uv2 b/bsp/stm3210/project.Uv2 index cb4a498ae..43b1d34ff 100644 --- a/bsp/stm3210/project.Uv2 +++ b/bsp/stm3210/project.Uv2 @@ -219,7 +219,7 @@ Options 1,0,0 // Target 'RT-Thread STM32' ADSLDDW () 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 } + FLASH1 { 9,0,0,0,1,0,0,0,6,16,0,0,0,0,0,0,0,0,0,0 } FLASH2 (Segger\JL2CM3.dll) FLASH3 ("" ()) FLASH4 () diff --git a/bsp/stm3210/project_107/application.c b/bsp/stm3210/project_107/application.c index b88e7dee5..f929cae17 100644 --- a/bsp/stm3210/project_107/application.c +++ b/bsp/stm3210/project_107/application.c @@ -17,13 +17,12 @@ */ /*@{*/ +#include #include #ifdef RT_USING_DFS /* dfs init */ #include -/* dfs filesystem:FAT filesystem init */ -#include /* dfs filesystem:EFS filesystem init */ #include /* dfs Filesystem APIs */ @@ -33,6 +32,7 @@ #ifdef RT_USING_LWIP #include #include +#include #endif void rt_init_thread_entry(void* parameter) @@ -73,7 +73,24 @@ void rt_init_thread_entry(void* parameter) #ifdef RT_USING_LWIP { extern void lwip_sys_init(void); - + + /* register ethernetif device */ + eth_system_device_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(); + /* init lwip system */ lwip_sys_init(); rt_kprintf("TCP/IP initialized!\n"); diff --git a/bsp/stm3210/project_107/board.h b/bsp/stm3210/project_107/board.h index 63fc9c0d5..5ac2de062 100644 --- a/bsp/stm3210/project_107/board.h +++ b/bsp/stm3210/project_107/board.h @@ -42,14 +42,24 @@ // Default: 1 #define STM32_CONSOLE_USART 2 +// Ethernet Interface: <0=> Microchip ENC28J60 <1=> Davicom DM9000A +// Default: 0 +#define STM32_ETH_IF 0 + void rt_hw_board_led_on(int n); void rt_hw_board_led_off(int n); void rt_hw_board_init(void); void rt_hw_usart_init(void); + +/* SD Card init function */ void rt_hw_sdcard_init(void); void rt_hw_msd_init(void); +/* ETH interface init function */ +void rt_hw_enc28j60_init(void); +void rt_hw_dm9000_init(void); + #endif // <<< Use Configuration Wizard in Context Menu >>> diff --git a/bsp/stm3210/project_107/rtconfig.h b/bsp/stm3210/project_107/rtconfig.h index 20685cce7..f1488d3c6 100644 --- a/bsp/stm3210/project_107/rtconfig.h +++ b/bsp/stm3210/project_107/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 @@ -69,6 +75,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/project_full/application.c b/bsp/stm3210/project_full/application.c index 3e7458ed4..f929cae17 100644 --- a/bsp/stm3210/project_full/application.c +++ b/bsp/stm3210/project_full/application.c @@ -73,18 +73,23 @@ void rt_init_thread_entry(void* parameter) #ifdef RT_USING_LWIP { extern void lwip_sys_init(void); -#ifdef RT_USING_LWIP - eth_system_device_init(); /* register ethernetif device */ -#if STM32_ETH_IF == 0 - rt_hw_enc28j60_init(); -#elif STM32_ETH_IF == 1 - rt_hw_dm9000_init(); + eth_system_device_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(); -#endif /* init lwip system */ lwip_sys_init(); diff --git a/bsp/stm3210/project_full/project.Uv2 b/bsp/stm3210/project_full/project.Uv2 index a2b5efcf9..43b1d34ff 100644 --- a/bsp/stm3210/project_full/project.Uv2 +++ b/bsp/stm3210/project_full/project.Uv2 @@ -217,9 +217,9 @@ Options 1,0,0 // Target 'RT-Thread STM32' ADSLDMC (--keep __fsym_* --keep __vsym_*) ADSLDIF () ADSLDDW () - OPTDL (SARMCM3.DLL)()(DARMSTM.DLL)(-pSTM32F107xCSchedule)(SARMCM3.DLL)()(TARMSTM.DLL)(-pSTM32F107xC) + 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 } + FLASH1 { 9,0,0,0,1,0,0,0,6,16,0,0,0,0,0,0,0,0,0,0 } FLASH2 (Segger\JL2CM3.dll) FLASH3 ("" ()) FLASH4 () diff --git a/bsp/stm3210/project_full/rtconfig.h b/bsp/stm3210/project_full/rtconfig.h index a4df21072..170addbbb 100644 --- a/bsp/stm3210/project_full/rtconfig.h +++ b/bsp/stm3210/project_full/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 @@ -67,6 +73,9 @@ /* 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/project_full/startup.c b/bsp/stm3210/project_full/startup.c index 4b0a81f1d..8efccc26a 100644 --- a/bsp/stm3210/project_full/startup.c +++ b/bsp/stm3210/project_full/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(); @@ -120,6 +123,9 @@ void rtthread_startup(void) finsh_set_device("uart1"); #endif + /* init timer thread */ + rt_system_timer_thread_init(); + /* init idle thread */ rt_thread_idle_init(); diff --git a/bsp/stm3210/project_full/stm32f10x_it.c b/bsp/stm3210/project_full/stm32f10x_it.c index c51749f40..5b131ea50 100644 --- a/bsp/stm3210/project_full/stm32f10x_it.c +++ b/bsp/stm3210/project_full/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 */ /** diff --git a/bsp/stm3210/startup.c b/bsp/stm3210/startup.c index a683574de..8efccc26a 100644 --- a/bsp/stm3210/startup.c +++ b/bsp/stm3210/startup.c @@ -123,6 +123,9 @@ void rtthread_startup(void) finsh_set_device("uart1"); #endif + /* init timer thread */ + rt_system_timer_thread_init(); + /* init idle thread */ rt_thread_idle_init();