mirror of
https://github.com/FreeRTOS/FreeRTOS-Kernel.git
synced 2025-04-20 05:21:59 -04:00
Add Newlib reent support.
This commit is contained in:
parent
4444b4ee68
commit
59f75a12f6
|
@ -576,6 +576,10 @@ typedef portBASE_TYPE (*pdTASK_HOOK_CODE)( void * );
|
||||||
#define configINCLUDE_APPLICATION_DEFINED_PRIVILEGED_FUNCTIONS 0
|
#define configINCLUDE_APPLICATION_DEFINED_PRIVILEGED_FUNCTIONS 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef configUSE_NEWLIB_REENTRANT
|
||||||
|
#define configUSE_NEWLIB_REENTRANT 0
|
||||||
|
#endif
|
||||||
|
|
||||||
/* For backward compatability. */
|
/* For backward compatability. */
|
||||||
#define eTaskStateGet eTaskGetState
|
#define eTaskStateGet eTaskGetState
|
||||||
|
|
||||||
|
|
|
@ -146,6 +146,14 @@ typedef struct tskTaskControlBlock
|
||||||
unsigned long ulRunTimeCounter; /*< Stores the amount of time the task has spent in the Running state. */
|
unsigned long ulRunTimeCounter; /*< Stores the amount of time the task has spent in the Running state. */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if ( configUSE_NEWLIB_REENTRANT == 1 )
|
||||||
|
/* Allocate a Newlib reent structure that is specific to this task.
|
||||||
|
Note Newlib support has been included by popular demand, but is not
|
||||||
|
used by the FreeRTOS maintainers themselves, and therefore receives
|
||||||
|
less rigorous testing than the rest of the FreeRTOS code. */
|
||||||
|
struct _reent xNewLib_reent;
|
||||||
|
#endif
|
||||||
|
|
||||||
} tskTCB;
|
} tskTCB;
|
||||||
|
|
||||||
|
|
||||||
|
@ -1858,6 +1866,14 @@ void vTaskSwitchContext( void )
|
||||||
taskSELECT_HIGHEST_PRIORITY_TASK();
|
taskSELECT_HIGHEST_PRIORITY_TASK();
|
||||||
|
|
||||||
traceTASK_SWITCHED_IN();
|
traceTASK_SWITCHED_IN();
|
||||||
|
|
||||||
|
#if ( configUSE_NEWLIB_REENTRANT == 1 )
|
||||||
|
{
|
||||||
|
/* Switch Newlib's _impure_ptr variable to point to the _reent
|
||||||
|
structure specific to this task. */
|
||||||
|
_impure_ptr = &( pxCurrentTCB->xNewLib_reent );
|
||||||
|
}
|
||||||
|
#endif /* configUSE_NEWLIB_REENTRANT */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
@ -2319,6 +2335,13 @@ portBASE_TYPE x;
|
||||||
( void ) usStackDepth;
|
( void ) usStackDepth;
|
||||||
}
|
}
|
||||||
#endif /* portUSING_MPU_WRAPPERS */
|
#endif /* portUSING_MPU_WRAPPERS */
|
||||||
|
|
||||||
|
#if ( configUSE_NEWLIB_REENTRANT == 1 )
|
||||||
|
{
|
||||||
|
/* Initialise this task's Newlib reent structure. */
|
||||||
|
_REENT_INIT_PTR( ( &( pxTCB->xNewLib_reent ) ) );
|
||||||
|
}
|
||||||
|
#endif /* configUSE_NEWLIB_REENTRANT */
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue