You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Thread local storage is needed for exceptions to work. Technically exceptions can work without TLS but it can be slow and is currently not implemented yet in estell-exceptions.
There may be other useful utilities to supporting Tls as well. Potential it could be used for an io_waiter for task notification, but that wouldn't actually work as the interrupt for a driver could happen anywhere on any thread.
Linker scripts will have a TLS section with symbols for tls_data_begin and end as well as bss begin and end. These sections must be contiguous in the linker script.
The idea is to only utilize a single pointer in the FreeRTOS TCB (thread control block) and have it point to data on the top of thread's stack or allocate the memory using some sort of polymorphic memory allocator just for TLS data.
Or if it is somehow possible to know the absolute size of a TLS section at compile/link time, this would be the most ideal option as it would allow the developers to get the exact size of their TLS vs having to guess and check their values after a build, like is done with thread stack sizes.
This support would also have to hook into and provide __emu_tls clang and gcc functions in order to allow C++'s thread_local variable to actually work. That function should use the FreeRTOS TLS first pointer in the TCB and then return a pointer to the value within the TLS section.
The API for this should be a single function a dev calls at the start of their stack. If and when a C++ thread or a hal::freertos::thread is created it should do this automatically for the user before calling their thread.
The text was updated successfully, but these errors were encountered:
Thread local storage is needed for exceptions to work. Technically exceptions can work without TLS but it can be slow and is currently not implemented yet in estell-exceptions.
There may be other useful utilities to supporting Tls as well. Potential it could be used for an io_waiter for task notification, but that wouldn't actually work as the interrupt for a driver could happen anywhere on any thread.
Linker scripts will have a TLS section with symbols for tls_data_begin and end as well as bss begin and end. These sections must be contiguous in the linker script.
The idea is to only utilize a single pointer in the FreeRTOS TCB (thread control block) and have it point to data on the top of thread's stack or allocate the memory using some sort of polymorphic memory allocator just for TLS data.
Or if it is somehow possible to know the absolute size of a TLS section at compile/link time, this would be the most ideal option as it would allow the developers to get the exact size of their TLS vs having to guess and check their values after a build, like is done with thread stack sizes.
This support would also have to hook into and provide __emu_tls clang and gcc functions in order to allow C++'s
thread_local
variable to actually work. That function should use the FreeRTOS TLS first pointer in the TCB and then return a pointer to the value within the TLS section.The API for this should be a single function a dev calls at the start of their stack. If and when a C++ thread or a hal::freertos::thread is created it should do this automatically for the user before calling their thread.
The text was updated successfully, but these errors were encountered: