MiaoUI/User/FreeRTOSConfig.h

316 lines
14 KiB
C
Raw Normal View History

2023-06-30 04:50:02 +00:00
/*
FreeRTOS V9.0.0 - Copyright (C) 2016 Real Time Engineers Ltd.
All rights reserved
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
This file is part of the FreeRTOS distribution.
FreeRTOS is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License (version 2) as published by the
Free Software Foundation >>>> AND MODIFIED BY <<<< the FreeRTOS exception.
***************************************************************************
>>! NOTE: The modification to the GPL is included to allow you to !<<
>>! distribute a combined work that includes FreeRTOS without being !<<
>>! obliged to provide the source code for proprietary components !<<
>>! outside of the FreeRTOS kernel. !<<
***************************************************************************
FreeRTOS is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. Full license text is available on the following
link: http://www.freertos.org/a00114.html
***************************************************************************
* *
* FreeRTOS provides completely free yet professionally developed, *
* robust, strictly quality controlled, supported, and cross *
* platform software that is more than just the market leader, it *
* is the industry's de facto standard. *
* *
* Help yourself get started quickly while simultaneously helping *
* to support the FreeRTOS project by purchasing a FreeRTOS *
* tutorial book, reference manual, or both: *
* http://www.FreeRTOS.org/Documentation *
* *
***************************************************************************
http://www.FreeRTOS.org/FAQHelp.html - Having a problem? Start by reading
the FAQ page "My application does not run, what could be wrong?". Have you
defined configASSERT()?
http://www.FreeRTOS.org/support - In return for receiving this top quality
embedded software for free we request you assist our global community by
participating in the support forum.
http://www.FreeRTOS.org/training - Investing in training allows your team to
be as productive as possible as early as possible. Now you can receive
FreeRTOS training directly from Richard Barry, CEO of Real Time Engineers
Ltd, and the world's leading authority on the world's leading RTOS.
http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,
including FreeRTOS+Trace - an indispensable productivity tool, a DOS
compatible FAT file system, and our tiny thread aware UDP/IP stack.
http://www.FreeRTOS.org/labs - Where new FreeRTOS products go to incubate.
Come and try FreeRTOS+TCP, our new open source TCP/IP stack for FreeRTOS.
http://www.OpenRTOS.com - Real Time Engineers ltd. license FreeRTOS to High
Integrity Systems ltd. to sell under the OpenRTOS brand. Low cost OpenRTOS
licenses offer ticketed support, indemnification and commercial middleware.
http://www.SafeRTOS.com - High Integrity Systems also provide a safety
engineered and independently SIL3 certified version for use in safety and
mission critical applications that require provable dependability.
*/
#ifndef FREERTOS_CONFIG_H
#define FREERTOS_CONFIG_H
#include "stm32f10x.h"
#include "bsp_usart.h"
2023-12-08 14:22:57 +00:00
//针对不同的编译器调用不同的stdint.h文件
2023-06-30 04:50:02 +00:00
#if defined(__ICCARM__) || defined(__CC_ARM) || defined(__GNUC__)
#include <stdint.h>
extern uint32_t SystemCoreClock;
#endif
2023-12-08 14:22:57 +00:00
//断言
2023-06-30 04:50:02 +00:00
#define vAssertCalled(char,int) printf("Error:%s,%d\r\n",char,int)
#define configASSERT(x) if((x)==0) vAssertCalled(__FILE__,__LINE__)
/************************************************************************
2023-12-08 14:22:57 +00:00
* FreeRTOS基础配置配置选项
2023-06-30 04:50:02 +00:00
*********************************************************************/
2023-12-08 14:22:57 +00:00
/* 置1RTOS使用抢占式调度器置0RTOS使用协作式调度器时间片
2023-06-30 04:50:02 +00:00
*
2023-12-08 14:22:57 +00:00
*
* CPU后
*
2023-06-30 04:50:02 +00:00
*/
#define configUSE_PREEMPTION 1
2023-12-08 14:22:57 +00:00
//1使能时间片调度(默认式使能的)
2023-06-30 04:50:02 +00:00
#define configUSE_TIME_SLICING 1
2023-12-08 14:22:57 +00:00
/* 某些运行FreeRTOS的硬件有两种方法选择下一个要执行的任务
*
2023-06-30 04:50:02 +00:00
*
2023-12-08 14:22:57 +00:00
*
* 1.configUSE_PORT_OPTIMISED_TASK_SELECTION 0
* 2.FreeRTOS支持的硬件
* 3.C实现
* 4.
*
* 1.configUSE_PORT_OPTIMISED_TASK_SELECTION设置为1
* 2.[CLZ]
* 3.
* 4.32
* 使MCU没有这些硬件指令的话此宏应该设置为0
2023-06-30 04:50:02 +00:00
*/
#define configUSE_PORT_OPTIMISED_TASK_SELECTION 1
2023-12-08 14:22:57 +00:00
/* 置1使能低功耗tickless模式置0保持系统节拍tick中断一直运行
* ,
2023-06-30 04:50:02 +00:00
*
2023-12-08 14:22:57 +00:00
*
* 1.
* 2.
2023-06-30 04:50:02 +00:00
*
2023-12-08 14:22:57 +00:00
* 1.线 BOOT 0 (3.3V)
* 2.
2023-06-30 04:50:02 +00:00
*
2023-12-08 14:22:57 +00:00
* 1.使FlyMcu擦除一下芯片
* STMISP -> (z)
2023-06-30 04:50:02 +00:00
*/
#define configUSE_TICKLESS_IDLE 0
/*
2023-12-08 14:22:57 +00:00
* CPU内核时钟频率CPU指令执行频率Fclk
* Fclk为供给CPU内核的时钟信号cpu主频为 XX MHz
* 1/Fclk即为cpu时钟周期
2023-06-30 04:50:02 +00:00
*/
#define configCPU_CLOCK_HZ (SystemCoreClock)
2023-12-08 14:22:57 +00:00
//RTOS系统节拍中断的频率。即一秒中断的次数每次中断RTOS都会进行任务调度
2023-06-30 04:50:02 +00:00
#define configTICK_RATE_HZ (( TickType_t )1000)
2023-12-08 14:22:57 +00:00
//可使用的最大优先级
2023-06-30 04:50:02 +00:00
#define configMAX_PRIORITIES (32)
2023-12-08 14:22:57 +00:00
//空闲任务使用的堆栈大小
2023-06-30 04:50:02 +00:00
#define configMINIMAL_STACK_SIZE ((unsigned short)128)
2023-12-08 14:22:57 +00:00
//任务名字字符串长度
2023-06-30 04:50:02 +00:00
#define configMAX_TASK_NAME_LEN (16)
2023-12-08 14:22:57 +00:00
//系统节拍计数器变量数据类型1表示为16位无符号整形0表示为32位无符号整形
2023-06-30 04:50:02 +00:00
#define configUSE_16_BIT_TICKS 0
2023-12-08 14:22:57 +00:00
//空闲任务放弃CPU使用权给其他同优先级的用户任务
2023-06-30 04:50:02 +00:00
#define configIDLE_SHOULD_YIELD 1
2023-12-08 14:22:57 +00:00
//启用队列
2023-06-30 04:50:02 +00:00
#define configUSE_QUEUE_SETS 0
2023-12-08 14:22:57 +00:00
//开启任务通知功能,默认开启
2023-06-30 04:50:02 +00:00
#define configUSE_TASK_NOTIFICATIONS 1
2023-12-08 14:22:57 +00:00
//使用互斥信号量
#define configUSE_MUTEXES 0
2023-06-30 04:50:02 +00:00
2023-12-08 14:22:57 +00:00
//使用递归互斥信号量
2023-06-30 04:50:02 +00:00
#define configUSE_RECURSIVE_MUTEXES 0
2023-12-08 14:22:57 +00:00
//为1时使用计数信号量
2023-06-30 04:50:02 +00:00
#define configUSE_COUNTING_SEMAPHORES 0
2023-12-08 14:22:57 +00:00
/* 设置可以注册的信号量和消息队列个数 */
2023-06-30 04:50:02 +00:00
#define configQUEUE_REGISTRY_SIZE 10
#define configUSE_APPLICATION_TASK_TAG 0
/*****************************************************************
2023-12-08 14:22:57 +00:00
FreeRTOS与内存申请有关配置选项
2023-06-30 04:50:02 +00:00
*****************************************************************/
2023-12-08 14:22:57 +00:00
//支持动态内存申请
2023-06-30 04:50:02 +00:00
#define configSUPPORT_DYNAMIC_ALLOCATION 1
2023-12-08 14:22:57 +00:00
//支持静态内存
2023-06-30 04:50:02 +00:00
#define configSUPPORT_STATIC_ALLOCATION 0
2023-12-08 14:22:57 +00:00
//系统所有总的堆大小
#define configTOTAL_HEAP_SIZE ((size_t)(36*1024))
2023-06-30 04:50:02 +00:00
/***************************************************************
2023-12-08 14:22:57 +00:00
FreeRTOS与钩子函数有关的配置选项
2023-06-30 04:50:02 +00:00
**************************************************************/
2023-12-08 14:22:57 +00:00
/* 置1使用空闲钩子Idle Hook类似于回调函数置0忽略空闲钩子
2023-06-30 04:50:02 +00:00
*
2023-12-08 14:22:57 +00:00
*
* FreeRTOS规定了函数的名字和参数void vApplicationIdleHook(void )
*
* RTOS任务
* CPU执行
* 使CPU进入省电模式是很常见的
* API函数
2023-06-30 04:50:02 +00:00
*/
#define configUSE_IDLE_HOOK 0
2023-12-08 14:22:57 +00:00
/* 置1使用时间片钩子Tick Hook置0忽略时间片钩子
2023-06-30 04:50:02 +00:00
*
*
2023-12-08 14:22:57 +00:00
*
* FreeRTOS规定了函数的名字和参数void vApplicationTickHook(void )
*
* 使
* FromISR""FROM_ISRAPI函数
2023-06-30 04:50:02 +00:00
*/
2023-12-08 14:22:57 +00:00
/*xTaskIncrementTick函数是在xPortSysTickHandler中断函数中被调用的。因此vApplicationTickHook()函数执行的时间必须很短才行*/
2023-06-30 04:50:02 +00:00
#define configUSE_TICK_HOOK 0
2023-12-08 14:22:57 +00:00
//使用内存申请失败钩子函数
2023-06-30 04:50:02 +00:00
#define configUSE_MALLOC_FAILED_HOOK 0
/*
2023-12-08 14:22:57 +00:00
* 0使
* 使
* 12 */
2023-06-30 04:50:02 +00:00
#define configCHECK_FOR_STACK_OVERFLOW 0
/********************************************************************
2023-12-08 14:22:57 +00:00
FreeRTOS与运行时间和任务状态收集有关的配置选项
2023-06-30 04:50:02 +00:00
**********************************************************************/
2023-12-08 14:22:57 +00:00
//启用运行时间统计功能
2023-06-30 04:50:02 +00:00
#define configGENERATE_RUN_TIME_STATS 0
2023-12-08 14:22:57 +00:00
//启用可视化跟踪调试
2023-06-30 04:50:02 +00:00
#define configUSE_TRACE_FACILITY 0
2023-12-08 14:22:57 +00:00
/* 与宏configUSE_TRACE_FACILITY同时为1时会编译下面3个函数
2023-06-30 04:50:02 +00:00
* prvWriteNameToBuffer()
* vTaskList(),
* vTaskGetRunTimeStats()
*/
#define configUSE_STATS_FORMATTING_FUNCTIONS 1
/********************************************************************
2023-12-08 14:22:57 +00:00
FreeRTOS与协程有关的配置选项
2023-06-30 04:50:02 +00:00
*********************************************************************/
2023-12-08 14:22:57 +00:00
//启用协程启用协程以后必须添加文件croutine.c
2023-06-30 04:50:02 +00:00
#define configUSE_CO_ROUTINES 0
2023-12-08 14:22:57 +00:00
//协程的有效优先级数目
2023-06-30 04:50:02 +00:00
#define configMAX_CO_ROUTINE_PRIORITIES ( 2 )
/***********************************************************************
2023-12-08 14:22:57 +00:00
FreeRTOS与软件定时器有关的配置选项
2023-06-30 04:50:02 +00:00
**********************************************************************/
2023-12-08 14:22:57 +00:00
//启用软件定时器
2023-06-30 04:50:02 +00:00
#define configUSE_TIMERS 0
2023-12-08 14:22:57 +00:00
//软件定时器优先级
2023-06-30 04:50:02 +00:00
#define configTIMER_TASK_PRIORITY (configMAX_PRIORITIES-1)
2023-12-08 14:22:57 +00:00
//软件定时器队列长度
2023-06-30 04:50:02 +00:00
#define configTIMER_QUEUE_LENGTH 10
2023-12-08 14:22:57 +00:00
//软件定时器任务堆栈大小
2023-06-30 04:50:02 +00:00
#define configTIMER_TASK_STACK_DEPTH (configMINIMAL_STACK_SIZE*2)
/************************************************************
2023-12-08 14:22:57 +00:00
FreeRTOS可选函数配置选项
2023-06-30 04:50:02 +00:00
************************************************************/
#define INCLUDE_xTaskGetSchedulerState 1
#define INCLUDE_vTaskPrioritySet 1
#define INCLUDE_uxTaskPriorityGet 1
#define INCLUDE_vTaskDelete 1
#define INCLUDE_vTaskCleanUpResources 1
#define INCLUDE_vTaskSuspend 1
#define INCLUDE_vTaskDelayUntil 1
#define INCLUDE_vTaskDelay 1
#define INCLUDE_eTaskGetState 1
#define INCLUDE_xTimerPendFunctionCall 0
//#define INCLUDE_xTaskGetCurrentTaskHandle 1
2023-12-08 14:22:57 +00:00
//#define INCLUDE_uxTaskGetStackHighWaterMark 0
2023-06-30 04:50:02 +00:00
//#define INCLUDE_xTaskGetIdleTaskHandle 0
/******************************************************************
2023-12-08 14:22:57 +00:00
FreeRTOS与中断有关的配置选项
2023-06-30 04:50:02 +00:00
******************************************************************/
#ifdef __NVIC_PRIO_BITS
#define configPRIO_BITS __NVIC_PRIO_BITS
#else
#define configPRIO_BITS 4
#endif
2023-12-08 14:22:57 +00:00
//中断最低优先级
2023-06-30 04:50:02 +00:00
#define configLIBRARY_LOWEST_INTERRUPT_PRIORITY 15
2023-12-08 14:22:57 +00:00
//系统可管理的最高中断优先级
2023-06-30 04:50:02 +00:00
#define configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY 5
#define configKERNEL_INTERRUPT_PRIORITY ( configLIBRARY_LOWEST_INTERRUPT_PRIORITY << (8 - configPRIO_BITS) ) /* 240 */
#define configMAX_SYSCALL_INTERRUPT_PRIORITY ( configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY << (8 - configPRIO_BITS) )
/****************************************************************
2023-12-08 14:22:57 +00:00
FreeRTOS与中断服务函数有关的配置选项
2023-06-30 04:50:02 +00:00
****************************************************************/
#define xPortPendSVHandler PendSV_Handler
#define vPortSVCHandler SVC_Handler
2023-12-08 14:22:57 +00:00
/* 以下为使用Percepio Tracealyzer需要的东西不需要时将 configUSE_TRACE_FACILITY 定义为 0 */
2023-06-30 04:50:02 +00:00
#if ( configUSE_TRACE_FACILITY == 1 )
#include "trcRecorder.h"
2023-12-08 14:22:57 +00:00
#define INCLUDE_xTaskGetCurrentTaskHandle 1 // 启用一个可选函数(该函数被 Trace源码使用默认该值为0 表示不用)
2023-06-30 04:50:02 +00:00
#endif
#endif /* FREERTOS_CONFIG_H */