From 3faca6d5dfeef3b3248c4358bdda7342d80a7c45 Mon Sep 17 00:00:00 2001 From: Bernard Xiong Date: Thu, 24 Sep 2015 16:03:09 +0800 Subject: [PATCH] [BSP] update stm32f7-disco code cleanup. --- bsp/stm32f7-disco/applications/application.c | 32 +------------------- bsp/stm32f7-disco/drivers/drv_led.c | 29 +++++++++++++++++- bsp/stm32f7-disco/drivers/stm32f7xx_it.c | 13 -------- bsp/stm32f7-disco/rtconfig.h | 13 ++++---- libcpu/arm/cortex-m7/context_rvds.S | 2 ++ 5 files changed, 38 insertions(+), 51 deletions(-) diff --git a/bsp/stm32f7-disco/applications/application.c b/bsp/stm32f7-disco/applications/application.c index c8491a53f9..e1dafdf5b2 100644 --- a/bsp/stm32f7-disco/applications/application.c +++ b/bsp/stm32f7-disco/applications/application.c @@ -26,35 +26,9 @@ #include #include -#include "drv_led.h" - -static void led_thread_entry(void *parameter) -{ - - led_hw_init(); - - while (1) - { - led_on(); - rt_thread_delay(RT_TICK_PER_SECOND); - led_off(); - rt_thread_delay(RT_TICK_PER_SECOND); - } -} - void rt_init_thread_entry(void *parameter) { - - rt_thread_t tid; - rt_components_init(); - - tid = rt_thread_create("led", - led_thread_entry, RT_NULL, - 512, 12, 5); - - if (tid != RT_NULL) - rt_thread_startup(tid); } int rt_application_init() @@ -64,11 +38,7 @@ int rt_application_init() tid = rt_thread_create("init", rt_init_thread_entry, RT_NULL, 2048, RT_THREAD_PRIORITY_MAX / 3, 20); - - if (tid != RT_NULL) - rt_thread_startup(tid); + if (tid != RT_NULL) rt_thread_startup(tid); return 0; } - -/*@}*/ diff --git a/bsp/stm32f7-disco/drivers/drv_led.c b/bsp/stm32f7-disco/drivers/drv_led.c index a58c5f3b6b..be86615b2f 100644 --- a/bsp/stm32f7-disco/drivers/drv_led.c +++ b/bsp/stm32f7-disco/drivers/drv_led.c @@ -21,9 +21,22 @@ * Date Author Notes * 2015-08-01 xiaonong the first version */ - +#include #include +#include "drv_led.h" + +static void led_thread_entry(void *parameter) +{ + while (1) + { + led_on(); + rt_thread_delay(RT_TICK_PER_SECOND); + led_off(); + rt_thread_delay(RT_TICK_PER_SECOND); + } +} + int led_hw_init(void) { GPIO_InitTypeDef GPIO_InitStruct; @@ -39,5 +52,19 @@ int led_hw_init(void) HAL_GPIO_Init(GPIOI, &GPIO_InitStruct); return 0; } +INIT_BOARD_EXPORT(led_hw_init); +int led_init(void) +{ + rt_thread_t tid; + + tid = rt_thread_create("led", + led_thread_entry, RT_NULL, + 512, 12, 5); + if (tid != RT_NULL) + rt_thread_startup(tid); + + return 0; +} +INIT_APP_EXPORT(led_init); diff --git a/bsp/stm32f7-disco/drivers/stm32f7xx_it.c b/bsp/stm32f7-disco/drivers/stm32f7xx_it.c index aa3baef2f2..899d4da11d 100644 --- a/bsp/stm32f7-disco/drivers/stm32f7xx_it.c +++ b/bsp/stm32f7-disco/drivers/stm32f7xx_it.c @@ -69,19 +69,6 @@ void NMI_Handler(void) { } -/** - * @brief This function handles Memory Manage exception. - * @param None - * @retval None - */ -void MemManage_Handler(void) -{ - /* Go to infinite loop when Memory Manage exception occurs */ - while (1) - { - } -} - /** * @brief This function handles Bus Fault exception. * @param None diff --git a/bsp/stm32f7-disco/rtconfig.h b/bsp/stm32f7-disco/rtconfig.h index 98c2599d20..bd0aaed397 100644 --- a/bsp/stm32f7-disco/rtconfig.h +++ b/bsp/stm32f7-disco/rtconfig.h @@ -14,7 +14,7 @@ // 256 // #define RT_THREAD_PRIORITY_MAX 32 -// +// #define RT_TICK_PER_SECOND 1000 // #define IDLE_THREAD_STACK_SIZE 512 @@ -141,16 +141,16 @@ // 3 // #define RT_DFS_ELM_USE_LFN 3 -// -#define RT_DFS_ELM_CODE_PAGE 936 +// +#define RT_DFS_ELM_CODE_PAGE 437 // -#define RT_DFS_ELM_CODE_PAGE_FILE +// #define RT_DFS_ELM_CODE_PAGE_FILE // #define RT_DFS_ELM_MAX_LFN 256 // #define RT_DFS_ELM_MAX_SECTOR_SIZE 4096 // -#define RT_DFS_ELM_USE_ERASE +// #define RT_DFS_ELM_USE_ERASE // // #define RT_USING_DFS_YAFFS2 // @@ -160,7 +160,7 @@ // //#define RT_USING_DFS_ROMFS // -#define RT_USING_DFS_NFS +// #define RT_USING_DFS_NFS // #define RT_NFS_HOST_EXPORT "192.168.137.1:/" // @@ -223,6 +223,7 @@ // // + /* enable SDRAM */ #define RT_USING_EXT_SDRAM diff --git a/libcpu/arm/cortex-m7/context_rvds.S b/libcpu/arm/cortex-m7/context_rvds.S index fa7a1c90f8..53a3756783 100644 --- a/libcpu/arm/cortex-m7/context_rvds.S +++ b/libcpu/arm/cortex-m7/context_rvds.S @@ -221,7 +221,9 @@ rt_hw_interrupt_thread_switch PROC IMPORT rt_hw_hard_fault_exception EXPORT HardFault_Handler + EXPORT MemManage_Handler HardFault_Handler PROC +MemManage_Handler ; get current context MRS r0, psp ; get fault thread stack pointer -- GitLab