Override function that returns thread-local storage pointer on armr5

Jeroen Koekkoek jeroen@koekkoek.nl
Tue May 14 15:05:00 GMT 2019


Hi Everyone,

I hope I'm phrasing this question correctly(?)

I'm trying to run a combination of FreeRTOS+lwIP on an ARM Cortex-R5 
(Xilinx SDK 2018.2, gcc 7.2.1). The project I'm working on makes use of 
thread-local storage through the use of the __thread keyword. However, 
each FreeRTOS task is returned the same pointer. To work around this 
issue, I'm planning on overriding the function that returns the pointer 
to the thread-local storage area to make use of the 
pvTaskGetThreadLocalStoragePointer function offered by FreeRTOS. I've 
used this trick before on a MicroBlaze based platform, where I simply 
implemented the __get_tls_addr function and once on a Cortex-M4, where I 
only needed to implement the __aeabi_read_tp function. The latter was 
not using gcc by the way. The armr5-none-eabi-gcc compiler mentions the 
-mtp= flag. By specifying -mtp=soft and implementing __aeabi_read_tp I 
was hoping to achieve what I envisioned but the function doesn't seem to 
be called.

Hopefully someone can point me in the right direction?

Exact version of the compiler: armr5-none-eabi-gcc (GNU Tools for ARM 
Embedded Processors) 7.2.1 20170904 (release) [ARM/embedded-7-branch 
revision 255204]

Thanks in advance.

Best Regards,
Jeroen Koekkoek



More information about the Gcc-help mailing list