RT-Thread学习(一)-基于keil移植GD32
1 前言
啊啊啊,纠结了很久,一直在纠结学哪种rtos,在freertos和rt之间反复横跳,一直在想以后工作了会用什么,但是因为现在自己的项目用了GD32,既然国产了,那就继续国产吧,认真好好学rt
2 参考资料
PS:因为我很懒,不想自己配置,所以就想用keil直接解决
- https://aijishu.com/a/1060000000367440 (技术贴)
- https://www.rt-thread.org/document/site/#/rt-thread-version/rt-thread-nano/nano-port-keil/an0039-nano-port-keil (官方教程)
3 硬件电路
GD32F427RK(买的开发板)
GD32F427VE(自己画的板子)
4 移植过程
详细的移植过程根据前面的参照资料一步步来就行
特意记录的部分:
board.c中会有这个
点击查看代码
//#error "TODO 1: OS Tick Configuration."
/*
* TODO 1: OS Tick Configuration
* Enable the hardware timer and call the rt_os_tick_callback function
* periodically with the frequency RT_TICK_PER_SECOND.
*/
void rt_hw_board_init(void)
{
//#error "TODO 1: OS Tick Configuration."
/*
* TODO 1: OS Tick Configuration
* Enable the hardware timer and call the rt_os_tick_callback function
* periodically with the frequency RT_TICK_PER_SECOND.
*/
/* 1、系统、时钟初始化 */
systick_config(); // 配置系统时钟
SystemCoreClockUpdate(); // 对系统时钟进行更新
/* 2、OS Tick 频率配置,RT_TICK_PER_SECOND = 1000 表示 1ms 触发一次中断 */
SysTick_Config(SystemCoreClock / RT_TICK_PER_SECOND);
/* Call components board initial (use INIT_BOARD_EXPORT()) */
#ifdef RT_USING_COMPONENTS_INIT
rt_components_board_init();
#endif
#if defined(RT_USING_USER_MAIN) && defined(RT_USING_HEAP)
rt_system_heap_init(rt_heap_begin_get(), rt_heap_end_get());
#endif
}
注意包含头文件systick.h和gd32f4xx.h