[BSP] update stm32f7-disco

code cleanup.
This commit is contained in:
Bernard Xiong 2015-09-24 16:03:09 +08:00
parent 91ae73e4e6
commit 3faca6d5df
5 changed files with 38 additions and 51 deletions

View File

@ -26,35 +26,9 @@
#include <rtthread.h>
#include <components.h>
#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;
}
/*@}*/

View File

@ -21,9 +21,22 @@
* Date Author Notes
* 2015-08-01 xiaonong the first version
*/
#include <rtthread.h>
#include <board.h>
#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);

View File

@ -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

View File

@ -14,7 +14,7 @@
// <item description="256">256</item>
// </integer>
#define RT_THREAD_PRIORITY_MAX 32
// <integer name="RT_TICK_PER_SECOND" description="OS tick per second" default="100" />
// <integer name="RT_TICK_PER_SECOND" description="OS tick per second" default="1000" />
#define RT_TICK_PER_SECOND 1000
// <integer name="IDLE_THREAD_STACK_SIZE" description="The stack size of idle thread" default="512" />
#define IDLE_THREAD_STACK_SIZE 512
@ -141,16 +141,16 @@
// <item description="LFN with dynamic LFN working buffer on the heap">3</item>
// </integer>
#define RT_DFS_ELM_USE_LFN 3
// <integer name="RT_DFS_ELM_CODE_PAGE" description="OEM code page" default="936">
#define RT_DFS_ELM_CODE_PAGE 936
// <integer name="RT_DFS_ELM_CODE_PAGE" description="OEM code page" default="437">
#define RT_DFS_ELM_CODE_PAGE 437
// <bool name="RT_DFS_ELM_CODE_PAGE_FILE" description="Using OEM code page file" default="false" />
#define RT_DFS_ELM_CODE_PAGE_FILE
// #define RT_DFS_ELM_CODE_PAGE_FILE
// <integer name="RT_DFS_ELM_MAX_LFN" description="Maximal size of file name length" default="256" />
#define RT_DFS_ELM_MAX_LFN 256
// <integer name="RT_DFS_ELM_MAX_SECTOR_SIZE" description="Maximal size of sector" default="512" />
#define RT_DFS_ELM_MAX_SECTOR_SIZE 4096
// <bool name="RT_DFS_ELM_USE_ERASE" description="Enable erase feature for flash" default="true" />
#define RT_DFS_ELM_USE_ERASE
// #define RT_DFS_ELM_USE_ERASE
// <bool name="RT_USING_DFS_YAFFS2" description="Using YAFFS2" default="false" />
// #define RT_USING_DFS_YAFFS2
// <bool name="RT_USING_DFS_UFFS" description="Using UFFS" default="false" />
@ -160,7 +160,7 @@
// <bool name="RT_USING_DFS_ROMFS" description="Using ROMFS" default="false" />
//#define RT_USING_DFS_ROMFS
// <bool name="RT_USING_DFS_NFS" description="Using NFS" default="false" />
#define RT_USING_DFS_NFS
// #define RT_USING_DFS_NFS
// <string name="RT_NFS_HOST_EXPORT" description="The exported NFS host path" default="192.168.1.10:/" />
#define RT_NFS_HOST_EXPORT "192.168.137.1:/"
// </section>
@ -223,6 +223,7 @@
// </section>
// </RDTConfigurator>
/* enable SDRAM */
#define RT_USING_EXT_SDRAM

View File

@ -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