Initial commit: CCU621_M firmware project with BLE debug link support.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
+58
@@ -0,0 +1,58 @@
|
||||
#include "gd32h7xx.h"
|
||||
#include "sys_drv_init.h"
|
||||
#include "FreeRTOS.h"
|
||||
#include "task.h"
|
||||
#include "app_init/app_init.h"
|
||||
|
||||
/** IAP 占用 0x08000000..0x08007FFF(32KB),APP 链接 @ 0x08008000(见 GD32H759_APP.sct) */
|
||||
#define APP_VECTOR_TABLE_OFFSET 0x8000U
|
||||
|
||||
int main(void)
|
||||
{
|
||||
/* SystemInit 默认 VTOR=0x08000000;在此重定位到 APP 向量表,不修改 CMSIS 库文件 */
|
||||
nvic_vector_table_set(NVIC_VECTTAB_FLASH, APP_VECTOR_TABLE_OFFSET);
|
||||
|
||||
//初始化
|
||||
v_sys_hardware_init();
|
||||
|
||||
// 初始化应用任务并启动调度器
|
||||
app_os_init();
|
||||
vTaskStartScheduler();
|
||||
|
||||
// 理论上不会执行到这里;若调度器异常返回,则进入运行灯闪烁兜底
|
||||
while(1)
|
||||
{
|
||||
RUN_LED_TOGGLE();
|
||||
delay_ms(1000U);
|
||||
}
|
||||
}
|
||||
|
||||
/* FreeRTOS 空闲任务钩子函数:当系统无就绪任务时会反复进入此回调。
|
||||
* 当前用于输出“系统空闲心跳”(慢闪运行灯),便于观察系统仍在正常调度。 */
|
||||
void vApplicationIdleHook(void)
|
||||
{
|
||||
/* Run LED heartbeat moved to timer ISR (v_app_tim_tick_1ms). */
|
||||
}
|
||||
|
||||
/* FreeRTOS 栈溢出钩子:检测到任务栈溢出时回调。
|
||||
* 处理策略:关闭中断并进入故障灯循环,故障码为 5。 */
|
||||
void vApplicationStackOverflowHook(TaskHandle_t xTask, char *pcTaskName)
|
||||
{
|
||||
(void)xTask;
|
||||
(void)pcTaskName;
|
||||
/* 编码 5:FreeRTOS 栈溢出 */
|
||||
taskDISABLE_INTERRUPTS();
|
||||
v_fault_blink_code_loop(5U);
|
||||
}
|
||||
|
||||
/* FreeRTOS 内存申请失败钩子:pvPortMalloc 分配失败时回调。
|
||||
* 处理策略:关闭中断并进入故障灯循环,故障码为 6。 */
|
||||
void vApplicationMallocFailedHook(void)
|
||||
{
|
||||
/* 编码 6:FreeRTOS malloc 失败 */
|
||||
taskDISABLE_INTERRUPTS();
|
||||
v_fault_blink_code_loop(6U);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user