4
0
mirror of https://github.com/RT-Thread/rt-thread.git synced 2025-01-16 20:43:30 +08:00
Man, Jianting (Meco) bb1084556f [console] 解决在没有定义RT_USING_DEVICE的情况下使用device报错的问题
* [console] 解决在没有定义RT_USING_DEVICE的情况下使用device报错的问题

* format codes

* [libc] 整理格式

* refresh projects
2022-01-09 00:20:32 +08:00

52 lines
1.1 KiB
C

#include <stdint.h>
#include <rthw.h>
#include <rtthread.h>
#include "cy_device_headers.h"
#include "board.h"
#include "uart.h"
#include "cy_systick.h"
#include "cycfg.h"
#define configTOTAL_HEAP_SIZE (24*1024)
/* Allocate the memory for the heap. */
ALIGN(RT_ALIGN_SIZE)
static uint8_t ucHeap[ configTOTAL_HEAP_SIZE ];
/**
* This is the timer interrupt service routine.
*
*/
void SysTick_Handler_CB(void)
{
/* enter interrupt */
rt_interrupt_enter();
rt_tick_increase();
/* leave interrupt */
rt_interrupt_leave();
}
void rt_hw_board_init()
{
/* init systick */
init_cycfg_all();
SystemCoreClockUpdate();
Cy_SysTick_Init(CY_SYSTICK_CLOCK_SOURCE_CLK_CPU, SystemCoreClock/RT_TICK_PER_SECOND);
Cy_SysTick_SetCallback(0, SysTick_Handler_CB);
Cy_SysTick_EnableInterrupt();
rt_system_heap_init((void*)ucHeap, (void*)(ucHeap+configTOTAL_HEAP_SIZE));
/* initialize UART device */
rt_hw_uart_init();
#if defined(RT_USING_CONSOLE) && defined(RT_USING_DEVICE)
rt_console_set_device(RT_CONSOLE_DEVICE_NAME);
#endif
}
/*@}*/