]> begriffs open source - freertos/commit
Add Thread Local Storage (TLS) support using Picolibc functions (#343)
authorKeith Packard <keithp@keithp.com>
Thu, 2 Mar 2023 16:26:04 +0000 (08:26 -0800)
committerGitHub <noreply@github.com>
Thu, 2 Mar 2023 16:26:04 +0000 (21:56 +0530)
commitc3e1df031e3f988780afb2a743fde93c12135005
treed8531ffb584f2e44a84f3a9a0108f01cdca49606
parente6514fb1edacbf2535aa8e5d16b7ae06a18f57e3
Add Thread Local Storage (TLS) support using Picolibc functions (#343)

* Pass top of stack to configINIT_TLS_BLOCK

Picolibc wants to allocate the per-task TLS block within the stack
segment, so it will need to modify the top of stack value. Pass the
pxTopOfStack variable to make this explicit.

Signed-off-by: Keith Packard <keithpac@amazon.com>
* Move newlib-specific definitions to separate file

This reduces the clutter in FreeRTOS.h caused by having newlib-specific
macros present there.

Signed-off-by: Keith Packard <keithpac@amazon.com>
* Make TLS code depend only on configUSE_C_RUNTIME_TLS_SUPPORT

Remove reference to configUSE_NEWLIB_REENTRANT as that only works
when using newlib. configUSE_C_RUNTIME_TLS_SUPPORT is always
set when configUSE_NEWLIB_REENTRANT is set, so using both was
redundant in that case.

Signed-off-by: Keith Packard <keithpac@amazon.com>
* portable-ARC: Adapt ARC support to use generalized TLS support

With generalized thread local storage (TLS) support present in the
core, the two ARC ports need to have the changes to the TCB mirrored
to them.

Signed-off-by: Keith Packard <keithpac@amazon.com>
* Add Thread Local Storage (TLS) support using Picolibc functions

This patch provides definitions of the general TLS support macros in
terms of the Picolibc TLS support functions.

Picolibc is normally configured to use TLS internally for all
variables that are intended to be task-local, so these changes are
necessary for picolibc to work correctly with FreeRTOS.

The picolibc helper functions rely on elements within the linker
script to arrange the TLS data in memory and define some symbols.
Applications wanting to use this mechanism will need changes in their
linker script when migrating to picolibc.

Signed-off-by: Keith Packard <keithpac@amazon.com>
---------

Signed-off-by: Keith Packard <keithpac@amazon.com>
Co-authored-by: Keith Packard <keithpac@amazon.com>
Co-authored-by: Gaurav-Aggarwal-AWS <33462878+aggarg@users.noreply.github.com>
.github/lexicon.txt
include/FreeRTOS.h
include/newlib-freertos.h [new file with mode: 0644]
include/picolibc-freertos.h [new file with mode: 0644]
portable/ThirdParty/GCC/ARC_EM_HS/port.c
portable/ThirdParty/GCC/ARC_v1/port.c
tasks.c