mirror of
https://github.com/FreeRTOS/FreeRTOS-Kernel.git
synced 2025-09-15 18:47:45 -04:00
Add support for newlib dynamic reentrancy (#496)
Previously, newlib's _impure_ptr was updated on every context switch to point to the current task's _reent structure. However, this behavior is no longer valid on multi-core systems due to the fact that multiple cores can switch contexts at the same time, thus leading to the corruption of the _impure_ptr. However, Newlib can be compiled with __DYNAMIC_REENT__ enabled which will cause newlib functions to call __getreent() instead in order to obtain the required reent struct. This commit adds dynamic reentrancy support to FreeRTOS: - Added a configNEWLIB_REENTRANT_IS_DYNAMIC to enable dynamic reentrancy support - _impure_ptr is no longer updated with reentrancy is dynamic - Port must provide their own __getreent() that returns the current task's reent struct
This commit is contained in:
parent
a97741a08d
commit
34b8e24d7c
2 changed files with 20 additions and 6 deletions
|
@ -72,6 +72,14 @@
|
|||
#include <reent.h>
|
||||
#endif
|
||||
|
||||
#ifdef configNEWLIB_REENTRANT_IS_DYNAMIC
|
||||
#if ( configUSE_NEWLIB_REENTRANT != 1 )
|
||||
#error configUSE_NEWLIB_REENTRANT must be defined to 1 to enable configNEWLIB_REENTRANT_IS_DYNAMIC
|
||||
#endif
|
||||
#else /* configNEWLIB_REENTRANT_IS_DYNAMIC */
|
||||
#define configNEWLIB_REENTRANT_IS_DYNAMIC 0
|
||||
#endif /* configNEWLIB_REENTRANT_IS_DYNAMIC */
|
||||
|
||||
/*
|
||||
* Check all the required application specific macros have been defined.
|
||||
* These macros are application specific and (as downloaded) are defined
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue