mirror of
https://github.com/FreeRTOS/FreeRTOS-Kernel.git
synced 2025-04-23 15:01:56 -04:00
Introduce configRECORD_STACK_HIGH_ADDRESS, which when set will result in both limits of the stack being saved in the TCB to allow enhanced debug capabilities.
Introduce configINCLUDE_FREERTOS_TASK_C_ADDITIONS_H, which allows a user provided header file to be included at the bottom of the tasks.c source file, which can add user functions and access file scope data. Replace global on/off switches used for lint errors with save/restore switches.
This commit is contained in:
parent
f11912c5de
commit
40201bc253
|
@ -84,7 +84,8 @@
|
||||||
* THESE PARAMETERS ARE DESCRIBED WITHIN THE 'CONFIGURATION' SECTION OF THE
|
* THESE PARAMETERS ARE DESCRIBED WITHIN THE 'CONFIGURATION' SECTION OF THE
|
||||||
* FreeRTOS API DOCUMENTATION AVAILABLE ON THE FreeRTOS.org WEB SITE.
|
* FreeRTOS API DOCUMENTATION AVAILABLE ON THE FreeRTOS.org WEB SITE.
|
||||||
*
|
*
|
||||||
* See http://www.freertos.org/a00110.html.
|
* See http://www.freertos.org/a00110.html for a full list of configuration
|
||||||
|
* options.
|
||||||
*----------------------------------------------------------*/
|
*----------------------------------------------------------*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -93,8 +94,8 @@
|
||||||
* Interrupts that are assigned a priority at or below
|
* Interrupts that are assigned a priority at or below
|
||||||
* configMAX_API_CALL_INTERRUPT_PRIORITY (which counter-intuitively in the ARM
|
* configMAX_API_CALL_INTERRUPT_PRIORITY (which counter-intuitively in the ARM
|
||||||
* generic interrupt controller [GIC] means a priority that has a numerical
|
* generic interrupt controller [GIC] means a priority that has a numerical
|
||||||
* value above configMAX_API_CALL_INTERRUPT_PRIORITY) can call FreeRTOS safe API
|
* value above configMAX_API_CALL_INTERRUPT_PRIORITY) can call interrupt safe
|
||||||
* functions and will nest.
|
* FreeRTOS API functions and will nest.
|
||||||
*
|
*
|
||||||
* Interrupts that are assigned a priority above
|
* Interrupts that are assigned a priority above
|
||||||
* configMAX_API_CALL_INTERRUPT_PRIORITY (which in the GIC means a numerical
|
* configMAX_API_CALL_INTERRUPT_PRIORITY (which in the GIC means a numerical
|
||||||
|
@ -114,7 +115,7 @@
|
||||||
#define configMAX_API_CALL_INTERRUPT_PRIORITY 18
|
#define configMAX_API_CALL_INTERRUPT_PRIORITY 18
|
||||||
|
|
||||||
/* The application will define the array used as the RTOS heap to ensure it can
|
/* The application will define the array used as the RTOS heap to ensure it can
|
||||||
be located in the (faster) on-chip RAM. Whe this parameter is set to 1 the
|
be located in the (faster) on-chip RAM. When this parameter is set to 1 the
|
||||||
application must define an array using the name and size as follows below, but
|
application must define an array using the name and size as follows below, but
|
||||||
is free to locate the array in any suitable RAM region (the faster the better as
|
is free to locate the array in any suitable RAM region (the faster the better as
|
||||||
the stacks used by the tasks are allocated from this array):
|
the stacks used by the tasks are allocated from this array):
|
||||||
|
@ -124,13 +125,11 @@ uint8_t ucHeap[ configTOTAL_HEAP_SIZE ];
|
||||||
*/
|
*/
|
||||||
#define configAPPLICATION_ALLOCATED_HEAP 1
|
#define configAPPLICATION_ALLOCATED_HEAP 1
|
||||||
|
|
||||||
#define configCPU_CLOCK_HZ /* Not used in this portabsciex.com. */
|
#define configCPU_CLOCK_HZ /* Not used in this demo. */
|
||||||
#define configUSE_PORT_OPTIMISED_TASK_SELECTION 1
|
#define configUSE_PORT_OPTIMISED_TASK_SELECTION 1
|
||||||
#define configUSE_TICKLESS_IDLE 0
|
#define configUSE_TICKLESS_IDLE 0
|
||||||
#define configTICK_RATE_HZ ( ( TickType_t ) 1000 )
|
#define configTICK_RATE_HZ ( ( TickType_t ) 1000 )
|
||||||
#define configUSE_PREEMPTION 1
|
#define configUSE_PREEMPTION 1
|
||||||
#define configUSE_IDLE_HOOK 1
|
|
||||||
#define configUSE_TICK_HOOK 1
|
|
||||||
#define configMAX_PRIORITIES ( 7 )
|
#define configMAX_PRIORITIES ( 7 )
|
||||||
#define configMINIMAL_STACK_SIZE ( ( unsigned short ) 200 )
|
#define configMINIMAL_STACK_SIZE ( ( unsigned short ) 200 )
|
||||||
#define configTOTAL_HEAP_SIZE ( 50 * 1024 )
|
#define configTOTAL_HEAP_SIZE ( 50 * 1024 )
|
||||||
|
@ -142,11 +141,16 @@ uint8_t ucHeap[ configTOTAL_HEAP_SIZE ];
|
||||||
#define configQUEUE_REGISTRY_SIZE 8
|
#define configQUEUE_REGISTRY_SIZE 8
|
||||||
#define configCHECK_FOR_STACK_OVERFLOW 2
|
#define configCHECK_FOR_STACK_OVERFLOW 2
|
||||||
#define configUSE_RECURSIVE_MUTEXES 1
|
#define configUSE_RECURSIVE_MUTEXES 1
|
||||||
#define configUSE_MALLOC_FAILED_HOOK 1
|
|
||||||
#define configUSE_APPLICATION_TASK_TAG 0
|
#define configUSE_APPLICATION_TASK_TAG 0
|
||||||
#define configUSE_COUNTING_SEMAPHORES 1
|
#define configUSE_COUNTING_SEMAPHORES 1
|
||||||
#define configUSE_QUEUE_SETS 1
|
#define configUSE_QUEUE_SETS 1
|
||||||
|
|
||||||
|
/* Hook/Callback related definitions. */
|
||||||
|
#define configUSE_MALLOC_FAILED_HOOK 1
|
||||||
|
#define configUSE_IDLE_HOOK 1
|
||||||
|
#define configUSE_TICK_HOOK 1
|
||||||
|
#define configUSE_DAEMON_TASK_STARTUP_HOOK 1
|
||||||
|
|
||||||
/* Co-routine definitions. */
|
/* Co-routine definitions. */
|
||||||
#define configUSE_CO_ROUTINES 0
|
#define configUSE_CO_ROUTINES 0
|
||||||
#define configMAX_CO_ROUTINE_PRIORITIES ( 2 )
|
#define configMAX_CO_ROUTINE_PRIORITIES ( 2 )
|
||||||
|
|
|
@ -408,6 +408,14 @@ extern "C" {
|
||||||
#define configCHECK_FOR_STACK_OVERFLOW 0
|
#define configCHECK_FOR_STACK_OVERFLOW 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef configRECORD_STACK_HIGH_ADDRESS
|
||||||
|
#define configRECORD_STACK_HIGH_ADDRESS 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef configINCLUDE_FREERTOS_TASK_C_ADDITIONS_H
|
||||||
|
#define configINCLUDE_FREERTOS_TASK_C_ADDITIONS_H 0
|
||||||
|
#endif
|
||||||
|
|
||||||
/* The following event macros are embedded in the kernel API calls. */
|
/* The following event macros are embedded in the kernel API calls. */
|
||||||
|
|
||||||
#ifndef traceMOVED_TASK_TO_READY_STATE
|
#ifndef traceMOVED_TASK_TO_READY_STATE
|
||||||
|
@ -917,7 +925,7 @@ typedef struct xSTATIC_TCB
|
||||||
UBaseType_t uxDummy5;
|
UBaseType_t uxDummy5;
|
||||||
void *pxDummy6;
|
void *pxDummy6;
|
||||||
uint8_t ucDummy7[ configMAX_TASK_NAME_LEN ];
|
uint8_t ucDummy7[ configMAX_TASK_NAME_LEN ];
|
||||||
#if ( portSTACK_GROWTH > 0 )
|
#if ( ( portSTACK_GROWTH > 0 ) || ( configRECORD_STACK_HIGH_ADDRESS == 1 ) )
|
||||||
void *pxDummy8;
|
void *pxDummy8;
|
||||||
#endif
|
#endif
|
||||||
#if ( portCRITICAL_NESTING_IN_TCB == 1 )
|
#if ( portCRITICAL_NESTING_IN_TCB == 1 )
|
||||||
|
|
|
@ -75,10 +75,10 @@
|
||||||
#error "include FreeRTOS.h must appear in source files before include timers.h"
|
#error "include FreeRTOS.h must appear in source files before include timers.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*lint -e537 This headers are only multiply included if the application code
|
/*lint -save -e537 This headers are only multiply included if the application code
|
||||||
happens to also be including task.h. */
|
happens to also be including task.h. */
|
||||||
#include "task.h"
|
#include "task.h"
|
||||||
/*lint +e537 */
|
/*lint -restore */
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
|
|
@ -137,6 +137,15 @@ a statically allocated stack and a dynamically allocated TCB. */
|
||||||
#define tskSTATICALLY_ALLOCATED_STACK_ONLY ( ( uint8_t ) 1 )
|
#define tskSTATICALLY_ALLOCATED_STACK_ONLY ( ( uint8_t ) 1 )
|
||||||
#define tskSTATICALLY_ALLOCATED_STACK_AND_TCB ( ( uint8_t ) 2 )
|
#define tskSTATICALLY_ALLOCATED_STACK_AND_TCB ( ( uint8_t ) 2 )
|
||||||
|
|
||||||
|
/* If any of the following are set then task stacks are filled with a known
|
||||||
|
value so the high water mark can be determined. If none of the following are
|
||||||
|
set then don't fill the stack so there is no unnecessary dependency on memset. */
|
||||||
|
#if( ( configCHECK_FOR_STACK_OVERFLOW > 1 ) || ( configUSE_TRACE_FACILITY == 1 ) || ( INCLUDE_uxTaskGetStackHighWaterMark == 1 ) )
|
||||||
|
#define tskSET_NEW_STACKS_TO_KNOWN_VALUE 1
|
||||||
|
#else
|
||||||
|
#define tskSET_NEW_STACKS_TO_KNOWN_VALUE 0
|
||||||
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Macros used by vListTask to indicate which state a task is in.
|
* Macros used by vListTask to indicate which state a task is in.
|
||||||
*/
|
*/
|
||||||
|
@ -304,8 +313,8 @@ typedef struct tskTaskControlBlock
|
||||||
StackType_t *pxStack; /*< Points to the start of the stack. */
|
StackType_t *pxStack; /*< Points to the start of the stack. */
|
||||||
char pcTaskName[ configMAX_TASK_NAME_LEN ];/*< Descriptive name given to the task when created. Facilitates debugging only. */ /*lint !e971 Unqualified char types are allowed for strings and single characters only. */
|
char pcTaskName[ configMAX_TASK_NAME_LEN ];/*< Descriptive name given to the task when created. Facilitates debugging only. */ /*lint !e971 Unqualified char types are allowed for strings and single characters only. */
|
||||||
|
|
||||||
#if ( portSTACK_GROWTH > 0 )
|
#if ( ( portSTACK_GROWTH > 0 ) || ( configRECORD_STACK_HIGH_ADDRESS == 1 ) )
|
||||||
StackType_t *pxEndOfStack; /*< Points to the end of the stack on architectures where the stack grows up from low memory. */
|
StackType_t *pxEndOfStack; /*< Points to the highest valid address for the stack. */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if ( portCRITICAL_NESTING_IN_TCB == 1 )
|
#if ( portCRITICAL_NESTING_IN_TCB == 1 )
|
||||||
|
@ -366,8 +375,8 @@ typedef struct tskTaskControlBlock
|
||||||
below to enable the use of older kernel aware debuggers. */
|
below to enable the use of older kernel aware debuggers. */
|
||||||
typedef tskTCB TCB_t;
|
typedef tskTCB TCB_t;
|
||||||
|
|
||||||
/*lint -e956 A manual analysis and inspection has been used to determine which
|
/*lint -save -e956 A manual analysis and inspection has been used to determine
|
||||||
static variables must be declared volatile. */
|
which static variables must be declared volatile. */
|
||||||
|
|
||||||
PRIVILEGED_DATA TCB_t * volatile pxCurrentTCB = NULL;
|
PRIVILEGED_DATA TCB_t * volatile pxCurrentTCB = NULL;
|
||||||
|
|
||||||
|
@ -421,7 +430,7 @@ PRIVILEGED_DATA static volatile UBaseType_t uxSchedulerSuspended = ( UBaseType_t
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*lint +e956 */
|
/*lint -restore */
|
||||||
|
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
@ -791,12 +800,12 @@ UBaseType_t x;
|
||||||
#endif /* portUSING_MPU_WRAPPERS == 1 */
|
#endif /* portUSING_MPU_WRAPPERS == 1 */
|
||||||
|
|
||||||
/* Avoid dependency on memset() if it is not required. */
|
/* Avoid dependency on memset() if it is not required. */
|
||||||
#if( ( configCHECK_FOR_STACK_OVERFLOW > 1 ) || ( configUSE_TRACE_FACILITY == 1 ) || ( INCLUDE_uxTaskGetStackHighWaterMark == 1 ) )
|
#if( tskSET_NEW_STACKS_TO_KNOWN_VALUE == 1 )
|
||||||
{
|
{
|
||||||
/* Fill the stack with a known value to assist debugging. */
|
/* Fill the stack with a known value to assist debugging. */
|
||||||
( void ) memset( pxNewTCB->pxStack, ( int ) tskSTACK_FILL_BYTE, ( size_t ) ulStackDepth * sizeof( StackType_t ) );
|
( void ) memset( pxNewTCB->pxStack, ( int ) tskSTACK_FILL_BYTE, ( size_t ) ulStackDepth * sizeof( StackType_t ) );
|
||||||
}
|
}
|
||||||
#endif /* ( ( configCHECK_FOR_STACK_OVERFLOW > 1 ) || ( ( configUSE_TRACE_FACILITY == 1 ) || ( INCLUDE_uxTaskGetStackHighWaterMark == 1 ) ) ) */
|
#endif /* tskSET_NEW_STACKS_TO_KNOWN_VALUE */
|
||||||
|
|
||||||
/* Calculate the top of stack address. This depends on whether the stack
|
/* Calculate the top of stack address. This depends on whether the stack
|
||||||
grows from high memory to low (as per the 80x86) or vice versa.
|
grows from high memory to low (as per the 80x86) or vice versa.
|
||||||
|
@ -809,6 +818,14 @@ UBaseType_t x;
|
||||||
|
|
||||||
/* Check the alignment of the calculated top of stack is correct. */
|
/* Check the alignment of the calculated top of stack is correct. */
|
||||||
configASSERT( ( ( ( portPOINTER_SIZE_TYPE ) pxTopOfStack & ( portPOINTER_SIZE_TYPE ) portBYTE_ALIGNMENT_MASK ) == 0UL ) );
|
configASSERT( ( ( ( portPOINTER_SIZE_TYPE ) pxTopOfStack & ( portPOINTER_SIZE_TYPE ) portBYTE_ALIGNMENT_MASK ) == 0UL ) );
|
||||||
|
|
||||||
|
#if( configRECORD_STACK_HIGH_ADDRESS == 1 )
|
||||||
|
{
|
||||||
|
/* Also record the stack's high address, which may assist
|
||||||
|
debugging. */
|
||||||
|
pxNewTCB->pxEndOfStack = pxTopOfStack;
|
||||||
|
}
|
||||||
|
#endif /* configRECORD_STACK_HIGH_ADDRESS */
|
||||||
}
|
}
|
||||||
#else /* portSTACK_GROWTH */
|
#else /* portSTACK_GROWTH */
|
||||||
{
|
{
|
||||||
|
@ -4792,8 +4809,26 @@ const TickType_t xConstTickCount = xTickCount;
|
||||||
#endif /* INCLUDE_vTaskSuspend */
|
#endif /* INCLUDE_vTaskSuspend */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Code below here allows additional code to be inserted into this source file,
|
||||||
|
especially where access to file scope functions and data is needed (for example
|
||||||
|
when performing module tests). */
|
||||||
|
|
||||||
#ifdef FREERTOS_MODULE_TEST
|
#ifdef FREERTOS_MODULE_TEST
|
||||||
#include "tasks_test_access_functions.h"
|
#include "tasks_test_access_functions.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#if( configINCLUDE_FREERTOS_TASK_C_ADDITIONS_H == 1 )
|
||||||
|
|
||||||
|
#include "freertos_tasks_c_additions.h"
|
||||||
|
|
||||||
|
static void freertos_tasks_c_additions_init( void )
|
||||||
|
{
|
||||||
|
#ifdef FREERTOS_TASKS_C_ADDITIONS_INIT
|
||||||
|
FREERTOS_TASKS_C_ADDITIONS_INIT();
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -158,8 +158,8 @@ typedef struct tmrTimerQueueMessage
|
||||||
} u;
|
} u;
|
||||||
} DaemonTaskMessage_t;
|
} DaemonTaskMessage_t;
|
||||||
|
|
||||||
/*lint -e956 A manual analysis and inspection has been used to determine which
|
/*lint -save -e956 A manual analysis and inspection has been used to determine
|
||||||
static variables must be declared volatile. */
|
which static variables must be declared volatile. */
|
||||||
|
|
||||||
/* The list in which active timers are stored. Timers are referenced in expire
|
/* The list in which active timers are stored. Timers are referenced in expire
|
||||||
time order, with the nearest expiry time at the front of the list. Only the
|
time order, with the nearest expiry time at the front of the list. Only the
|
||||||
|
@ -173,7 +173,7 @@ PRIVILEGED_DATA static List_t *pxOverflowTimerList;
|
||||||
PRIVILEGED_DATA static QueueHandle_t xTimerQueue = NULL;
|
PRIVILEGED_DATA static QueueHandle_t xTimerQueue = NULL;
|
||||||
PRIVILEGED_DATA static TaskHandle_t xTimerTaskHandle = NULL;
|
PRIVILEGED_DATA static TaskHandle_t xTimerTaskHandle = NULL;
|
||||||
|
|
||||||
/*lint +e956 */
|
/*lint -restore */
|
||||||
|
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue