Commit b64595f
committed
Add Thread Local Storage (TLS) support using Picolibc functions
Thread Local Storage (TLS) offers a platform-native mechanism for
managing per-task variables that doesn't rely on custom support in
FreeRTOS for things like errno.
Picolibc uses TLS internally for all variables that are intended to be
task-local. Because of the TLS architecture, only variables which are
actually used end up getting allocate space in the TLS block. Contrast
this with the newlib 'struct _reent' block which holds all possible
task-local values, even for APIs not used by the application.
Picolibc also has TLS helper functions that provide the necessary
platform-specific code which makes the FreeRTOS changes platform
independent. This patch uses those hooks instead of providing the
platform specific code in FreeRTOS itself.
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 <keithp@keithp.com>1 parent eec4233 commit b64595f
3 files changed
Lines changed: 64 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1063 | 1063 | | |
1064 | 1064 | | |
1065 | 1065 | | |
| 1066 | + | |
1066 | 1067 | | |
1067 | 1068 | | |
1068 | 1069 | | |
| |||
1344 | 1345 | | |
1345 | 1346 | | |
1346 | 1347 | | |
| 1348 | + | |
1347 | 1349 | | |
1348 | 1350 | | |
1349 | 1351 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
74 | 74 | | |
75 | 75 | | |
76 | 76 | | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
77 | 85 | | |
78 | 86 | | |
79 | 87 | | |
| |||
1216 | 1224 | | |
1217 | 1225 | | |
1218 | 1226 | | |
| 1227 | + | |
| 1228 | + | |
| 1229 | + | |
1219 | 1230 | | |
1220 | 1231 | | |
1221 | 1232 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
58 | 58 | | |
59 | 59 | | |
60 | 60 | | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
61 | 72 | | |
62 | 73 | | |
63 | 74 | | |
| |||
328 | 339 | | |
329 | 340 | | |
330 | 341 | | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
331 | 349 | | |
332 | 350 | | |
333 | 351 | | |
| |||
986 | 1004 | | |
987 | 1005 | | |
988 | 1006 | | |
| 1007 | + | |
| 1008 | + | |
| 1009 | + | |
| 1010 | + | |
| 1011 | + | |
| 1012 | + | |
| 1013 | + | |
| 1014 | + | |
| 1015 | + | |
| 1016 | + | |
| 1017 | + | |
| 1018 | + | |
| 1019 | + | |
| 1020 | + | |
| 1021 | + | |
| 1022 | + | |
| 1023 | + | |
| 1024 | + | |
| 1025 | + | |
| 1026 | + | |
| 1027 | + | |
| 1028 | + | |
| 1029 | + | |
989 | 1030 | | |
990 | 1031 | | |
991 | 1032 | | |
| |||
2068 | 2109 | | |
2069 | 2110 | | |
2070 | 2111 | | |
| 2112 | + | |
| 2113 | + | |
| 2114 | + | |
| 2115 | + | |
| 2116 | + | |
2071 | 2117 | | |
2072 | 2118 | | |
2073 | 2119 | | |
| |||
3081 | 3127 | | |
3082 | 3128 | | |
3083 | 3129 | | |
| 3130 | + | |
| 3131 | + | |
| 3132 | + | |
| 3133 | + | |
| 3134 | + | |
3084 | 3135 | | |
3085 | 3136 | | |
3086 | 3137 | | |
| |||
0 commit comments