Skip to content

Commit c4a7d28

Browse files
tangzz98mysterywolf
authored andcommitted
Add FreeRTOSConfig.h template
1 parent 4ffd937 commit c4a7d28

File tree

2 files changed

+71
-101
lines changed

2 files changed

+71
-101
lines changed

FreeRTOS/include/FreeRTOSConfig.h

Lines changed: 71 additions & 100 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
/*
2-
* FreeRTOS V202112.00
3-
* Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
2+
* FreeRTOS Kernel V10.4.6
3+
* Copyright (C) 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved.
4+
*
5+
* SPDX-License-Identifier: MIT
46
*
57
* Permission is hereby granted, free of charge, to any person obtaining a copy of
68
* this software and associated documentation files (the "Software"), to deal in
@@ -20,128 +22,97 @@
2022
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
2123
*
2224
* https://www.FreeRTOS.org
23-
* https://aws.amazon.com/freertos
25+
* https://github.com/FreeRTOS
2426
*
2527
*/
2628

27-
2829
#ifndef FREERTOS_CONFIG_H
2930
#define FREERTOS_CONFIG_H
3031

31-
/*-----------------------------------------------------------
32-
* Application specific definitions.
33-
*
34-
* These definitions should be adjusted for your particular hardware and
35-
* application requirements.
36-
*
37-
* THESE PARAMETERS ARE DESCRIBED WITHIN THE 'CONFIGURATION' SECTION OF THE
38-
* FreeRTOS API DOCUMENTATION AVAILABLE ON THE FreeRTOS.org WEB SITE.
39-
*
40-
* See http://www.freertos.org/a00110.html
41-
*----------------------------------------------------------*/
42-
43-
//not used
32+
/* The following options are read-only */
4433
#define configUSE_PREEMPTION 1
34+
#define configUSE_TIME_SLICING 1
4535
#define configUSE_PORT_OPTIMISED_TASK_SELECTION 1
46-
#define configUSE_QUEUE_SETS 1
47-
#define configUSE_IDLE_HOOK 0
48-
#define configUSE_TICK_HOOK 1
49-
#define configCPU_CLOCK_HZ ( SystemCoreClock )
50-
#define configTICK_RATE_HZ ( 1000 )
51-
#define configMINIMAL_STACK_SIZE ( ( unsigned short ) 130 )
52-
#define configMAX_TASK_NAME_LEN ( 10 )
53-
#define configUSE_TRACE_FACILITY 1
5436
#define configUSE_16_BIT_TICKS 0
55-
#define configIDLE_SHOULD_YIELD 1
56-
#define configQUEUE_REGISTRY_SIZE 8
57-
#define configCHECK_FOR_STACK_OVERFLOW 2
58-
59-
/* The full demo always has tasks to run so the tick will never be turned off.
60-
The blinky demo will use the default tickless idle implementation to turn the
61-
tick off. */
62-
#define configUSE_TICKLESS_IDLE 0
63-
64-
/* Run time stats gathering definitions. */
65-
#define configGENERATE_RUN_TIME_STATS 0
66-
67-
/* This demo makes use of one or more example stats formatting functions. These
68-
format the raw data provided by the uxTaskGetSystemState() function in to human
69-
readable ASCII form. See the notes in the implementation of vTaskList() within
70-
FreeRTOS/Source/tasks.c for limitations. */
71-
#define configUSE_STATS_FORMATTING_FUNCTIONS 1
7237

73-
/* Co-routine definitions. */
74-
#define configUSE_CO_ROUTINES 0
75-
#define configMAX_CO_ROUTINE_PRIORITIES ( 2 )
76-
77-
/* Software timer definitions. */
78-
#define configTIMER_TASK_PRIORITY ( configMAX_PRIORITIES - 1 )
79-
#define configTIMER_QUEUE_LENGTH 5
80-
#define configTIMER_TASK_STACK_DEPTH ( configMINIMAL_STACK_SIZE * 2 )
81-
82-
/* Set the following definitions to 1 to include the API function, or zero
83-
to exclude the API function. */
84-
#define INCLUDE_vTaskCleanUpResources 1
85-
#define INCLUDE_xTimerPendFunctionCall 1
38+
/* The following read-only options are controlled by rtconfig.h. */
39+
#define configTICK_RATE_HZ RT_TICK_PER_SECOND
40+
#define configMAX_PRIORITIES RT_THREAD_PRIORITY_MAX
41+
#define configMAX_TASK_NAME_LEN RT_NAME_MAX
42+
43+
#ifdef RT_USING_TIMER_SOFT
44+
#define configUSE_TIMERS 1
45+
#define configTIMER_TASK_PRIORITY (RT_THREAD_PRIORITY_MAX - 1 - RT_TIMER_THREAD_PRIO)
46+
/* RT-Thread does not use a timer queue. This option is not used. */
47+
#define configTIMER_QUEUE_LENGTH 0
48+
#define configTIMER_TASK_STACK_DEPTH RT_TIMER_THREAD_STACK_SIZE
49+
#endif
8650

87-
/* Cortex-M specific definitions. */
88-
#ifdef __NVIC_PRIO_BITS
89-
/* __BVIC_PRIO_BITS will be specified when CMSIS is being used. */
90-
#define configPRIO_BITS __NVIC_PRIO_BITS
91-
#else
92-
#define configPRIO_BITS 4 /* 15 priority levels */
51+
/* These options can be modified to selectively disable recursive mutex */
52+
/* Take effect only if RT_USING_MUTEX is defined */
53+
#ifdef RT_USING_MUTEX
54+
#define configUSE_RECURSIVE_MUTEXES 1
55+
#define configUSE_MUTEXES 1
9356
#endif
9457

95-
/* The lowest interrupt priority that can be used in a call to a "set priority"
96-
function. */
97-
#define configLIBRARY_LOWEST_INTERRUPT_PRIORITY 15
58+
/* These options can be modified to selectively disable counting semaphore */
59+
/* Take effect only if RT_USING_SEMAPHORE is defined */
60+
#ifdef RT_USING_SEMAPHORE
61+
#define configUSE_COUNTING_SEMAPHORES 1
62+
#endif
9863

99-
/* The highest interrupt priority that can be used by any interrupt service
100-
routine that makes calls to interrupt safe FreeRTOS API functions. DO NOT CALL
101-
INTERRUPT SAFE FREERTOS API FUNCTIONS FROM ANY INTERRUPT THAT HAS A HIGHER
102-
PRIORITY THAN THIS! (higher priorities are lower numeric values. */
103-
#define configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY 4
64+
/* Memory allocation related definitions. */
65+
#define configSUPPORT_STATIC_ALLOCATION 1
66+
#ifdef RT_USING_HEAP
67+
#define configSUPPORT_DYNAMIC_ALLOCATION 1
68+
#define configTOTAL_HEAP_SIZE 10240
69+
#define configAPPLICATION_ALLOCATED_HEAP 0
70+
#endif
10471

105-
/* Interrupt priorities used by the kernel port layer itself. These are generic
106-
to all Cortex-M ports, and do not rely on any particular library functions. */
107-
#define configKERNEL_INTERRUPT_PRIORITY ( configLIBRARY_LOWEST_INTERRUPT_PRIORITY << (8 - configPRIO_BITS) )
108-
/* !!!! configMAX_SYSCALL_INTERRUPT_PRIORITY must not be set to zero !!!!
109-
See http://www.FreeRTOS.org/RTOS-Cortex-M3-M4.html. */
110-
#define configMAX_SYSCALL_INTERRUPT_PRIORITY ( configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY << (8 - configPRIO_BITS) )
72+
/* Hook functions are not supported. */
73+
#define configUSE_IDLE_HOOK 0
74+
#define configUSE_TICK_HOOK 0
75+
#define configCHECK_FOR_STACK_OVERFLOW 0
76+
#define configUSE_MALLOC_FAILED_HOOK 0
77+
#define configUSE_DAEMON_TASK_STARTUP_HOOK 0
78+
79+
/* The following features are not supported. */
80+
#define INCLUDE_xTimerPendFunctionCall 0
81+
#define configNUM_THREAD_LOCAL_STORAGE_POINTERS 0
82+
#define configUSE_CO_ROUTINES 0
83+
#define configQUEUE_REGISTRY_SIZE 0
84+
#define configUSE_QUEUE_SETS 0
85+
#define configUSE_NEWLIB_REENTRANT 0
86+
#define configUSE_TICKLESS_IDLE 0
87+
#define configQUEUE_REGISTRY_SIZE 0
88+
#define configGENERATE_RUN_TIME_STATS 0
89+
#define configUSE_TRACE_FACILITY 0
90+
#define configUSE_STATS_FORMATTING_FUNCTIONS 0
11191

112-
/* Definitions that map the FreeRTOS port interrupt handlers to their CMSIS
113-
standard names. */
114-
#define xPortPendSVHandler PendSV_Handler
115-
#define vPortSVCHandler SVC_Handler
116-
#define xPortSysTickHandler SysTick_Handler
92+
/* Can be modified */
93+
#define configMINIMAL_STACK_SIZE 128
11794

118-
//used
119-
#define configUSE_MUTEXES 1
120-
#define configSUPPORT_DYNAMIC_ALLOCATION 1
121-
#define configSUPPORT_STATIC_ALLOCATION 1
122-
#define configUSE_RECURSIVE_MUTEXES 1
123-
#define configTOTAL_HEAP_SIZE ( ( size_t ) ( 46 * 1024 ) )
124-
#define configUSE_COUNTING_SEMAPHORES 1
125-
#define configUSE_MALLOC_FAILED_HOOK 0
126-
#define INCLUDE_vTaskDelete 1
127-
#define INCLUDE_vTaskDelayUntil 1
128-
#define INCLUDE_vTaskDelay 1
129-
#define INCLUDE_vTaskSuspend 1
130-
#define INCLUDE_xTaskResumeFromISR 1
95+
/* Optional functions */
13196
#define INCLUDE_vTaskPrioritySet 1
13297
#define INCLUDE_uxTaskPriorityGet 1
133-
#define INCLUDE_xTaskGetCurrentTaskHandle 1
98+
#define INCLUDE_vTaskDelete 1
99+
#define INCLUDE_vTaskSuspend 1
100+
#define INCLUDE_xTaskDelayUntil 1
101+
#define INCLUDE_vTaskDelay 1
102+
#define INCLUDE_xTaskGetIdleTaskHandle 1
134103
#define INCLUDE_xTaskAbortDelay 1
104+
#define INCLUDE_xSemaphoreGetMutexHolder 1
135105
#define INCLUDE_xTaskGetHandle 1
136-
#define configUSE_APPLICATION_TASK_TAG 1
137-
#define INCLUDE_xTaskGetIdleTaskHandle 1
138106
#define INCLUDE_uxTaskGetStackHighWaterMark 1
139107
#define INCLUDE_uxTaskGetStackHighWaterMark2 1
140-
#define configUSE_TASK_NOTIFICATIONS 1
141108
#define INCLUDE_eTaskGetState 1
142-
#define configMAX_PRIORITIES ( 32 )
143-
#define configUSE_TIMERS 1
109+
#define INCLUDE_xTaskResumeFromISR 1
144110
#define INCLUDE_xTaskGetSchedulerState 1
145-
#define INCLUDE_xSemaphoreGetMutexHolder 1
111+
#define INCLUDE_xTaskGetCurrentTaskHandle 1
112+
#define configUSE_APPLICATION_TASK_TAG 1
113+
#define configUSE_TASK_NOTIFICATIONS 1
114+
#define configTASK_NOTIFICATION_ARRAY_ENTRIES 3
115+
116+
/* Other definitions can go here, e.g. configAssert*/
146117

147118
#endif /* FREERTOS_CONFIG_H */

FreeRTOS/tasks.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@
3434
#include "FreeRTOS.h"
3535
#include "task.h"
3636

37-
//TODO: check configMAX_PRIORITIES == RT_THREAD_PRIORITY_MAX
3837
#define FREERTOS_PRIORITY_TO_RTTHREAD(priority) ( configMAX_PRIORITIES - 1 - ( priority ) )
3938
#define RTTHREAD_PRIORITY_TO_FREERTOS(priority) ( RT_THREAD_PRIORITY_MAX - 1 - ( priority ) )
4039

0 commit comments

Comments
 (0)