FreeRTOS Config Start macro

Source: Internet
Author: User
Tags assert mutex semaphore cpu usage

FreeRTOSConfig.h can be customized in the system configuration file, default values are defined in FreeRTOS.h

Configapplication_allocated_heap
By default, the heap memory of FreeRTOS is allocated by the compiler, and the macro configapplication_allocated_heap is defined as 1, so the heap memory can be set by the user (heap_1.c, heap_2.c, heap_3.c, HEAP_4.C and HEAP_5.C)

/* Allocate the memory for the heap. *
/#if (configapplication_allocated_heap = = 1)/
    * The application writer has already defined the array used for T He RTOS
    heap-probably so it can be placed in a special segment or address. */
    extern uint8_t ucheap[configtotal _heap_size];
#else
    static uint8_t ucheap[configtotal_heap_size];
#endif/* Configapplication_allocated_heap */

Configassert
Assert, similar to the Assert () function in the C standard library, you can check if the incoming parameters are reasonable when debugging the code (used in the debug phase)

#ifndef configassert
    #define CONFIGASSERT (x)
    #define configassert_defined 0
#else
    #define configassert_defined 1
#endif

Configcheck_for_stack_overflow
Set up stack overflow detection, and each task has a task stack. If you use the function xtaskcreate () to create a task, then the stack of the task is automatically allocated from the FreeRTOS heap (ucheap). If you create a task using the function xtaskcreatestatic (), the task stack is set by the user, and the parameter pxstackbuffer is the task stack, which is typically an array

The Enable stack detection function (Configcheck_for_stack_overflow is greater than 0), and the user must provide a hook function (callback function). This hook function is called when the kernel detects a stack overflow

/* Callback function prototypes. --------------------------*
/#if (  configcheck_for_stack_overflow > 0)
    extern void Vapplicationstackoverflowhook (taskhandle_t xtask, Char *pctaskname);
#endif

Configcheck_for_stack_overflow==1: Stack Overflow detection Method 1. The advantage is fast
configcheck_for_stack_overflow==2: Stack Overflow detection Method 2. can detect almost any stack overflow

configcpu_clock_hz
Frequency of the CPU

#define CONFIGCPU_CLOCK_HZ          ((unsigned long) 72000000)  

configsupport_dynamic_allocation
1 (default): The RAM required to dynamically acquire memory from the FreeRTOS heap when creating FreeRTOS kernel objects
0: The required RAM needs to be provided by the user

#ifndef configsupport_dynamic_allocation/
    * Defaults to 1 for backward compatibility. */
    #define Configsupport_ Dynamic_allocation 1
#endif

configenable_backward_compatibility

#ifndef configenable_backward_compatibility
    #define Configenable_backward_compatibility 1
#endif
#if configenable_backward_compatibility = = 1 #define Etaskstateget etaskgetstate #define Portticktype ticktype_t
    #define XTASKHANDLE taskhandle_t #define XQUEUEHANDLE queuehandle_t #define Xsemaphorehandle semaphorehandle_t #define XQUEUESETHANDLE queuesethandle_t #define XQUEUESETMEMBERHANDLE queuesetmemberhandle_t #define Xtimeout Type timeout_t #define Xmemoryregion memoryregion_t #define Xtaskparameters taskparameters_t #define Xtaskstat Ustype taskstatus_t #define Xtimerhandle timerhandle_t #define XCOROUTINEHANDLE coroutinehandle_t #define PdTA Sk_hook_code taskhookfunction_t #define Porttick_rate_ms Porttick_period_ms #define PCTASKGETTASKNAME pcTaskGetNam E #define PCTIMERGETTIMERNAME pctimergetname #define PCQUEUEGETQUEUENAME pcqueuegetname #define Vtaskgettaskin FO vtaskgetinfo/* Backward compatibility within the scheduler code Only-these definitions is not really requi Red but is included for Completeness. */#define TMRTIMER_CALLBACK timercallbackfunction_t #define PDTASK_CODE taskfunction_t #define Xlistitem List item_t #define XLIST list_t #endif/* configenable_backward_compatibility */

These data types are used in FreeRTOS prior to V8.0.0

Configgenerate_run_time_stats
1: Turn On time statistics function
0: Turn off time statistics function

#if (Configgenerate_run_time_stats = = 1) #ifndef portconfigure_timer_for_run_time_stats/* Initializes a peripheral to serve as the reference clock for TIME statistics */ #error If configgenerate_run_time_stats is defined then Portconfigure_timer_for_run_time_stats must also be defined  .  Portconfigure_timer_for_run_time_stats should call a port layer function to setup a peripheral timer/counter so can then
    be used as the run time counter time base.
        #endif/* portconfigure_timer_for_run_time_stats */#ifndef portget_run_time_counter_value/* Returns the clock value of the current reference clock */ #ifndef portalt_get_run_time_counter_value #error If configgenerate_run_time_stats is defined then either PO  Rtget_run_time_counter_value or portalt_get_run_time_counter_value must also be defined.
        See the examples provided and the FreeRTOS Web site for more information. #endif/* Portalt_get_run_time_counter_value */#endif/* portget_run_time_counter_value */#endif//Configgenerate_ Run_time_stats * *

Configidle_should_yield
1: Idle task yields CPU usage for user tasks of equal priority
0: Idle task does not give up CPU access for other tasks in the same priority
It is recommended that this feature be turned off because idle tasks do not take much time

#define Configidle_should_yield     1

configmax_co_routine_priorities
Sets the maximum priority that can be assigned to the co-process. The priority of the process can be from 0 to Configmax_co_routine_priorities-1, where 0 is the lowest priority

#define CONFIGMAX_CO_ROUTINE_PRIORITIES (2)

configmax_priorities
Sets the priority number of tasks. Ditto

#define Configmax_priorities        (5)

Configmax_task_name_len
Set Task Name Maximum length

#define Configmax_task_name_len     (16)

configminimal_stack_size
Sets the minimum task stack size for idle tasks. In words. For example, if the STM32 is set to 100, then the real stack size is 100*4=400 bytes.

#define Configminimal_stack_size    ((unsigned short) 128)

confignum_thread_local_storage_pointers
Set the local storage pointer array size for each task

#ifndef confignum_thread_local_storage_pointers
    #define Confignum_thread_local_storage_pointers 0
#endif

configqueue_registry_size
Sets the maximum number of queues and semaphores that can be registered. When using the kernel debugger to view semaphores and queues, you need to
To set this macro

#ifndef configqueue_registry_size
    #define Configqueue_registry_size 0U
#endif

configsupport_static_allocation
1: Users are required to specify RAM when creating some kernel objects
0: Use the dynamic memory management function in HEAP.C to automatically request RAM

#ifndef configsupport_static_allocation/
    * Defaults to 0 for backward compatibility. */
    #define Configsupport_ Static_allocation 0
#endif

configtick_rate_hz
Set the system clock beat frequency for the FreeRTOS in Hz

#define CONFIGTICK_RATE_HZ          ((ticktype_t) 1000)

Configtimer_queue_length
Configure the FreeRTOS software timer. The FreeRTOS Software Timer API function sends a message to the software Timer task via the command queue, which is used to set the command queue length for this software timer

configtimer_task_priority
Set task priority for software timer tasks

configtimer_task_stack_depth
Set the task stack size for the Timer service task

configtotal_heap_size
Sets the heap size. If dynamic memory management is used

/* Allocate the memory for the heap. *
/#if (configapplication_allocated_heap = = 1)/
    * The application writer has already defined the array used for T He RTOS
    heap-probably so it can be placed in a special segment or address. */
    extern uint8_t ucheap[configtotal _heap_size];
#else
    static uint8_t ucheap[configtotal_heap_size];
#endif/* Configapplication_allocated_heap */

Configuse_16_bit_ticks
Set the system Beat counter variable data type
1:ticktype_t is 16-bit.
0:ticktype_t is 32-bit.

#define Configuse_16_bit_ticks      0

Configuse_co_routines
1: Enable the co-process to save overhead
0: Off. Recommended Close

#define Configuse_co_routines       0

Configuse_counting_semaphores
1: Enable count semaphore

#ifndef configuse_counting_semaphores
    #define Configuse_counting_semaphores 0
#endif

Configuse_idle_hook
1: Use the idle task hook function. User needs to implement idle task hook function

#define Configuse_idle_hook         0

Configuse_malloc_failed_hook
1: Use memory allocation failure hook function. User needs to implement memory allocation failure hook function

#ifndef configuse_malloc_failed_hook
    #define Configuse_malloc_failed_hook 0
#endif

configuse_mutexes
1: Use mutex semaphore

#ifndef configuse_mutexes
    #define CONFIGUSE_MUTEXES 0
#endif

configuse_port_optimised_task_selection
Select the next task to run
1: Special Instructions for hardware
0:c language to achieve

#ifndef configuse_port_optimised_task_selection
    #define Configuse_port_optimised_task_selection 0
# endif

configuse_preemption
1: Use a preemptive scheduler. Task switching in each clock beat interrupt
0: Use the co-process. Task switching:

A task called the Function Taskyield ()
A task invokes an API function that enables the task to enter a blocking state
The application explicitly defines the context switch to be performed in the interrupt

#define Configuse_preemption        1

configuse_queue_sets
1: Enable queue set Feature

#ifndef configuse_queue_sets
    #define CONFIGUSE_QUEUE_SETS 0
#endif

configuse_recursive_mutexes
1: Use recursive mutex semaphore

#ifndef configuse_recursive_mutexes
    #define CONFIGUSE_RECURSIVE_MUTEXES 0
#endif

configuse_task_notifications
1: Use the task notification feature

#ifndef configuse_task_notifications
    #define Configuse_task_notifications 1
#endif

Configuse_tick_hook
1: Enable time slice hook function. User needs to implement time slice hook function

#define Configuse_tick_hook         0

Configuse_tickless_idle
1: Enable low power tickless mode

#ifndef configuse_tickless_idle
    #define CONFIGUSE_TICKLESS_IDLE 0
#endif

configuse_timers
1: Using the software timer

#ifndef configuse_timers
    #define Configuse_timers 0
#endif

configuse_time_slicing
0: Task switch not performing the same priority task in clock-beat interrupt

#ifndef configuse_time_slicing
    #define Configuse_time_slicing 1
#endif

configuse_trace_facility
1: Enable visual trace Debugging

#define Configuse_trace_facility    0

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.