1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
| /*
* FreeRTOS Kernel V10.2.0
* Copyright (C) 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
* http://www.FreeRTOS.org
* http://aws.amazon.com/freertos
*
* 1 tab == 4 spaces!
*/
#ifndef FREERTOS_CONFIG_H
#define FREERTOS_CONFIG_H
/*-----------------------------------------------------------
* Application specific definitions.
*
* These definitions should be adjusted for your particular hardware and
* application requirements.
*
* THESE PARAMETERS ARE DESCRIBED WITHIN THE 'CONFIGURATION' SECTION OF THE
* FreeRTOS API DOCUMENTATION AVAILABLE ON THE FreeRTOS.org WEB SITE.
*
* See http://www.freertos.org/a00110.html
*----------------------------------------------------------*/
#if (defined(__ARMCC_VERSION) || defined(__GNUC__) || defined(__ICCARM__))
#include <stdint.h>
extern uint32_t SystemCoreClock;
#endif
/* Constants that describe the hardware and memory usage. */
#define configCPU_CLOCK_HZ (SystemCoreClock)//系统时钟频率
#define configTICK_RATE_HZ ((TickType_t)1000)//系统节拍中断的频率
#define configTOTAL_HEAP_SIZE ((size_t)36*1024) //堆总量,修改为36*1024
#define configMINIMAL_STACK_SIZE ((uint16_t)128)//空闲任务堆栈大小,修改为128
#define configSUPPORT_DYNAMIC_ALLOCATION 1 //动态内存分配,1:启用 0:不使用 默认启用
#define configSUPPORT_STATIC_ALLOCATION 0 //静态内存分配,1:启用 0:不使用 默认不使用,设置启用后,必须提供两个回调函数 vApplicationGetIdleTaskMemory()提供用于RTOS空闲任务的内存,以及(如果configUSE_TIMERS设置为1)vApplicationGetTimerTaskMemory()提供用于以下RTOS守护程序/计时器服务任务的内存
/* Constants related to the behaviour or the scheduler. */
#define configMAX_PRIORITIES 5 //可使用的最大优先级
#define configUSE_PREEMPTION 1 //1:抢占式RTOS调度程序 0:协作式RTOS调度程序
#define configUSE_TIME_SLICING 1 //1:每个RTOS滴答中断时在优先级相同的任务之间切换 0:不切换
#define configIDLE_SHOULD_YIELD 1 //空闲任务放弃CPU 使用权给其他同优先级的用户任务 0:不放弃
#define configMAX_TASK_NAME_LEN (16)//任务名字最大长度,改为16
#define configUSE_16_BIT_TICKS 0 //系统节拍计数器变量数据类型,1 表示为16 位无符号整形,0 表示为32 位无符号整形
/* Software timer definitions. */
#define configUSE_TIMERS 0 //软件计时器 1:启用 0:不使用
#define configTIMER_TASK_PRIORITY 2 //软件计时器服务/守护程序任务的优先级
#define configTIMER_QUEUE_LENGTH 5 //软件计时器命令队列的长度
#define configTIMER_TASK_STACK_DEPTH (configMINIMAL_STACK_SIZE * 2) //设置分配给软件计时器服务/守护程序任务的堆栈深度
/* Constants that build features in or out. */
#define configUSE_MUTEXES 1 //互斥功能 1:启用 0:不使用
#define configUSE_RECURSIVE_MUTEXES 1 //递归互斥功能 1:启用 0:不使用
#define configUSE_COUNTING_SEMAPHORES 1 //信号量计数 1:启用 0:不使用
#define configUSE_QUEUE_SETS 1 //队列 1:启用 0:不使用
#define configUSE_TASK_NOTIFICATIONS 1 //通知 1:启用 0:不使用 默认启用
#define configUSE_TRACE_FACILITY 1 //可视化跟踪调试 1:启用 0:不使用
#define configUSE_TICKLESS_IDLE 0 //低功耗滴答 1:低功耗无滴答 0:始终保持滴答中断运行
#define configUSE_APPLICATION_TASK_TAG 0 //任务标记
#define configUSE_NEWLIB_REENTRANT 0 //newlib功能 1:启用 0:不使用
#define configUSE_CO_ROUTINES 0 //协程功能 1:启用 0:不使用
/* Constants provided for debugging and optimisation assistance. */
/**
* 0:不检测
* 1:在RTOS内核将任务从“运行”状态换出后,堆栈很可能会达到其最大(最深)的值,因为此时堆栈将包含任务上下文。此时,RTOS内核可以检查处理器堆栈指针是否保留在有效堆栈空间内
* 2:首次创建任务时,其堆栈会填充一个已知值。当将任务从运行状态换出时,RTOS内核可以检查有效堆栈范围内的最后16个字节,以确保任务或中断活动未覆盖这些已知值。如果这16个字节中的任何一个不保持其初始值,则调用堆栈溢出钩子函数
*/
#define configCHECK_FOR_STACK_OVERFLOW 0 //堆栈溢出检测方法
#define configQUEUE_REGISTRY_SIZE 0 //可以注册最大队列个数
#define configASSERT( x ) if( ( x ) == 0 ) { taskDISABLE_INTERRUPTS(); for( ;; ); } //断言
/* Constants that define which hook (callback) functions should be used. */
#define configUSE_IDLE_HOOK 0 //空闲回调函数 1:启用 0:不使用 启用后需实现函数 vApplicationIdleHook(void)
#define configUSE_TICK_HOOK 0 //时间片回调函数 1:启用 0:不使用 启用后需实现函数 void vApplicationTickHook(void)
#define configUSE_DAEMON_TASK_STARTUP_HOOK 0 //计时器服务程序任务启动回调函数 1:启用 0:不使用 启用后需实现函数 vApplicationDaemonTaskStartupHook(void)
#define configUSE_MALLOC_FAILED_HOOK 0 //内存分配失败回调函数 1:启用 0:不使用 启用后需实现函数 vApplicationMallocFailedHook(void)
/* Port specific configuration. */ //仅在 ARMv8M ports 使用
#define configENABLE_MPU 0 //MPU支持
#define configENABLE_FPU 1 //FPU支持
#define configENABLE_TRUSTZONE 1 //TRUSTZONE支持
#define configMINIMAL_SECURE_STACK_SIZE ((uint32_t)1024) //安全堆栈大小
#define configRUN_FREERTOS_SECURE_ONLY 0 //仅安全状态运行 1:启用 0:不使用
/* Cortex-M specific definitions. *///中断位设置,在STM32F10x.h中已定义为4,所以我们修改为4
#ifdef __NVIC_PRIO_BITS
/* __NVIC_PRIO_BITS will be specified when CMSIS is being used. */
#define configPRIO_BITS __NVIC_PRIO_BITS
#else
/* 7 priority levels */
#define configPRIO_BITS 4
#endif
/* The lowest interrupt priority that can be used in a call to a "set priority" function. */
#define configLIBRARY_LOWEST_INTERRUPT_PRIORITY 0x0F //最低优先级,这里改为15
/* The highest interrupt priority that can be used by any interrupt service
* routine that makes calls to interrupt safe FreeRTOS API functions. DO NOT
* CALL INTERRUPT SAFE FREERTOS API FUNCTIONS FROM ANY INTERRUPT THAT HAS A
* HIGHER PRIORITY THAN THIS! (higher priorities are lower numeric values). */
#define configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY 5 //最高中断优先级
/* Interrupt priorities used by the kernel port layer itself. These are generic
* to all Cortex-M ports, and do not rely on any particular library functions. */
#define configKERNEL_INTERRUPT_PRIORITY (configLIBRARY_LOWEST_INTERRUPT_PRIORITY << (8 - configPRIO_BITS)) //对需要配置的SysTick 与PendSV 进行偏移
/* !!!! configMAX_SYSCALL_INTERRUPT_PRIORITY must not be set to zero !!!!
* See http://www.FreeRTOS.org/RTOS-Cortex-M3-M4.html. */
#define configMAX_SYSCALL_INTERRUPT_PRIORITY (configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY << (8 - configPRIO_BITS)) //屏蔽优先级
/* Set the following definitions to 1 to include the API function, or zero
* to exclude the API function. NOTE: Setting an INCLUDE_ parameter to 0 is
* only necessary if the linker does not automatically remove functions that are
* not referenced anyway. */
#define INCLUDE_vTaskPrioritySet 1 //设置任务优先级
#define INCLUDE_uxTaskPriorityGet 1 //获取任务优先级
#define INCLUDE_vTaskDelete 1 //删除任务
#define INCLUDE_vTaskSuspend 1 //任务挂起
#define INCLUDE_vTaskDelayUntil 1 //绝对延时
#define INCLUDE_vTaskDelay 1 //相对延时
#define INCLUDE_xTaskGetIdleTaskHandle 1 //获得空闲任务句柄
#define INCLUDE_xTaskAbortDelay 1 //中止延时
#define INCLUDE_xQueueGetMutexHolder 1 //队列获取互斥锁持有者
#define INCLUDE_xSemaphoreGetMutexHolder 1 //信号获取互斥锁持有者
#define INCLUDE_xTaskGetHandle 1 //根据任务名字获取任务句柄
#define INCLUDE_uxTaskGetStackHighWaterMark 1 //查询栈剩余
#define INCLUDE_uxTaskGetStackHighWaterMark2 1 //查询栈剩余
#define INCLUDE_eTaskGetState 1 //获取任务状态
#define INCLUDE_xTaskResumeFromISR 1 //任务从中断中重启
#define INCLUDE_xTimerPendFunctionCall 0 //将功能的执行附加到计时器服务,必须打开计时器服务才可使用
#define INCLUDE_xTaskGetSchedulerState 1 //获取任务调度器状态
#define INCLUDE_xTaskGetCurrentTaskHandle 1 //获取当前任务的句柄
/* Map the FreeRTOS port interrupt handlers to their CMSIS standard names. */
#define xPortPendSVHandler PendSV_Handler
#define vPortSVCHandler SVC_Handler
#define xPortSysTickHandler SysTick_Handler
#if (defined(__ARMCC_VERSION) || defined(__GNUC__) || defined(__ICCARM__))
/* Include debug event definitions */
#include "freertos_evr.h"
#endif
#endif /* FREERTOS_CONFIG_H */
|