/* FreeRTOSConfig.h - STM32F103RC (Cortex-M3, Keil ARMCC) 定制配置 * * 内存预算(RAM 总计 48KB): * 裸机存量 ZI ~36.3KB(U2_CopyBuff 20K + Rx_Buf 8K + OTA块 3K + 杂项) * FreeRTOS 堆 10KB:net任务栈 3KB + app任务栈 2KB + sys任务栈 1KB * + idle任务 512B + TCB/互斥锁 + 余量 * 合计 ~46.3KB < 48KB * * HAL 时基:SysTick 归 FreeRTOS 当 tick,HAL 时基改用 TIM2 * (见 Src/stm32f1xx_hal_timebase_tim.c),两者都是 1ms。 */ #ifndef FREERTOS_CONFIG_H #define FREERTOS_CONFIG_H #if defined(__ICCARM__) || defined(__CC_ARM) || defined(__GNUC__) #include extern uint32_t SystemCoreClock; #endif #define configUSE_PREEMPTION 1 #define configSUPPORT_STATIC_ALLOCATION 0 #define configSUPPORT_DYNAMIC_ALLOCATION 1 #define configUSE_IDLE_HOOK 1 /* idle 钩子里喂 IWDG */ #define configUSE_TICK_HOOK 0 #define configCPU_CLOCK_HZ ( SystemCoreClock ) #define configTICK_RATE_HZ ((TickType_t)1000) #define configMAX_PRIORITIES ( 5 ) #define configMINIMAL_STACK_SIZE ((uint16_t)128) #define configTOTAL_HEAP_SIZE ((size_t)10240) #define configMAX_TASK_NAME_LEN ( 16 ) #define configUSE_16_BIT_TICKS 0 #define configUSE_MUTEXES 1 #define configUSE_RECURSIVE_MUTEXES 1 #define configQUEUE_REGISTRY_SIZE 8 #define configUSE_PORT_OPTIMISED_TASK_SELECTION 1 #define configUSE_TIMERS 0 #define configCHECK_FOR_STACK_OVERFLOW 2 #define configUSE_MALLOC_FAILED_HOOK 1 /* Co-routine definitions. */ #define configUSE_CO_ROUTINES 0 #define configMAX_CO_ROUTINE_PRIORITIES ( 2 ) /* Set the following definitions to 1 to include the API function, or zero to exclude the API function. */ #define INCLUDE_vTaskPrioritySet 0 #define INCLUDE_uxTaskPriorityGet 0 #define INCLUDE_vTaskDelete 0 #define INCLUDE_vTaskCleanUpResources 0 #define INCLUDE_vTaskSuspend 1 #define INCLUDE_vTaskDelayUntil 1 #define INCLUDE_vTaskDelay 1 #define INCLUDE_xTaskGetSchedulerState 1 /* Cortex-M specific definitions. */ #ifdef __NVIC_PRIO_BITS #define configPRIO_BITS __NVIC_PRIO_BITS #else #define configPRIO_BITS 4 #endif /* 可调用中断安全 FreeRTOS API 的最高中断优先级(数值越小优先级越高)。 * 本工程 UART/DMA 中断(0~3级)不调 RTOS API,无需改动其优先级。 */ #define configLIBRARY_LOWEST_INTERRUPT_PRIORITY 15 #define configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY 5 #define configKERNEL_INTERRUPT_PRIORITY ( configLIBRARY_LOWEST_INTERRUPT_PRIORITY << (8 - configPRIO_BITS) ) #define configMAX_SYSCALL_INTERRUPT_PRIORITY ( configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY << (8 - configPRIO_BITS) ) #define configASSERT( x ) if ((x) == 0) {taskDISABLE_INTERRUPTS(); for( ;; );} /* 中断向量映射到 CMSIS 标准名:it.c 里不再重复定义这三个 Handler */ #define vPortSVCHandler SVC_Handler #define xPortPendSVHandler PendSV_Handler #define xPortSysTickHandler SysTick_Handler #endif /* FREERTOS_CONFIG_H */