使用rtthread
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
|
||||
#include "stm32h7xx.h"
|
||||
#include "stm32mp1xx.h"
|
||||
#include <rthw.h>
|
||||
#include <rtthread.h>
|
||||
#include "board.h"
|
||||
@@ -36,7 +36,7 @@ static uint32_t _SysTick_Config(rt_uint32_t ticks)
|
||||
}
|
||||
|
||||
#if defined(RT_USING_USER_MAIN) && defined(RT_USING_HEAP)
|
||||
static uint32_t g_heap[64*1024/4];
|
||||
static uint32_t g_heap[32*1024/4];
|
||||
RT_WEAK void *rt_heap_begin_get(void)
|
||||
{
|
||||
return (void *)g_heap;
|
||||
@@ -44,7 +44,7 @@ RT_WEAK void *rt_heap_begin_get(void)
|
||||
|
||||
RT_WEAK void *rt_heap_end_get(void)
|
||||
{
|
||||
return (void *)(g_heap+(64*1024/4));
|
||||
return (void *)(g_heap+(32*1024/4));
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -57,10 +57,10 @@ void rt_hw_board_init()
|
||||
{
|
||||
//NVIC_SetVectorTable(NVIC_VectTab_FLASH,0x20000);
|
||||
// 1msһ<73><D2BB>tick
|
||||
_SysTick_Config (400000000/1000);
|
||||
_SysTick_Config (HAL_RCC_GetMCUFreq()/1000);
|
||||
rt_system_heap_init(rt_heap_begin_get(),rt_heap_end_get());
|
||||
mem_init();
|
||||
tempptr_init();
|
||||
//mem_init();
|
||||
//tempptr_init();
|
||||
delay_init();
|
||||
signal_init();
|
||||
|
||||
@@ -75,6 +75,23 @@ void SysTick_Handler(void)
|
||||
}
|
||||
|
||||
|
||||
uint32_t HAL_GetTick(void)
|
||||
{
|
||||
return rt_tick_get();
|
||||
}
|
||||
|
||||
|
||||
void HAL_Delay(uint32_t Delay)
|
||||
{
|
||||
rt_thread_mdelay(Delay);
|
||||
}
|
||||
|
||||
HAL_StatusTypeDef HAL_InitTick(uint32_t TickPriority)
|
||||
{
|
||||
return HAL_OK;
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
void *dev_get(const char *name)
|
||||
@@ -223,25 +240,25 @@ void cpy4byte(uint32_t *dst,uint32_t *src,int num_4byte)
|
||||
|
||||
|
||||
|
||||
#pragma import(__use_no_semihosting)
|
||||
//#pragma import(__use_no_semihosting)
|
||||
|
||||
struct __FILE
|
||||
{
|
||||
int handle;
|
||||
};
|
||||
//struct __FILE
|
||||
//{
|
||||
// int handle;
|
||||
//};
|
||||
|
||||
FILE __stdout;
|
||||
//FILE __stdout;
|
||||
|
||||
void _sys_exit(int x)
|
||||
{
|
||||
x = x;
|
||||
}
|
||||
//void _sys_exit(int x)
|
||||
//{
|
||||
// x = x;
|
||||
//}
|
||||
|
||||
int fputc(int ch, FILE *f)
|
||||
{
|
||||
// SEGGER_RTT_PutChar(0,ch);
|
||||
return ch;
|
||||
}
|
||||
//int fputc(int ch, FILE *f)
|
||||
//{
|
||||
//// SEGGER_RTT_PutChar(0,ch);
|
||||
// return ch;
|
||||
//}
|
||||
|
||||
|
||||
|
||||
|
@@ -5,7 +5,7 @@
|
||||
#include "rtthread.h"
|
||||
#include <rthw.h>
|
||||
#include "string.h"
|
||||
#include "stm32h7xx.h"
|
||||
#include "stm32mp1xx.h"
|
||||
|
||||
|
||||
struct dev_struct{
|
||||
|
@@ -1,4 +1,4 @@
|
||||
#include "stm32h7xx.h"
|
||||
#include "stm32mp1xx.h"
|
||||
#include "core_delay.h"
|
||||
#include "rtthread.h"
|
||||
#include <rthw.h>
|
||||
@@ -17,7 +17,7 @@
|
||||
//<2F><>ȡϵͳ<CFB5><CDB3>Ƶ
|
||||
static uint32_t get_sys_clocks_freq (void)
|
||||
{
|
||||
return HAL_RCC_GetSysClockFreq();
|
||||
return HAL_RCC_GetMCUFreq();
|
||||
}
|
||||
|
||||
|
||||
|
@@ -217,13 +217,13 @@ rt_hw_interrupt_thread_switch PROC
|
||||
BX lr
|
||||
ENDP
|
||||
|
||||
IMPORT bk_reboot_hard_err
|
||||
;IMPORT bk_reboot_hard_err
|
||||
IMPORT rt_hw_hard_fault_exception
|
||||
EXPORT HardFault_Handler
|
||||
HardFault_Handler PROC
|
||||
|
||||
; get current context
|
||||
BL bk_reboot_hard_err
|
||||
;BL bk_reboot_hard_err
|
||||
B .
|
||||
TST lr, #0x04 ; if(!EXC_RETURN[2])
|
||||
ITE EQ
|
||||
|
Reference in New Issue
Block a user