Skip to content

Commit 83409c5

Browse files
author
Deepika
committed
Fixed: errno update failure with IAR8.2
errno (part of thread local storage) setting caused hardfault with IAR8.x versions. TLS is not supported, hence using main thread TLS area for all threads.
1 parent 1566395 commit 83409c5

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

platform/mbed_retarget.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -936,7 +936,11 @@ extern "C" WEAK void __iar_file_Mtxdst(__iar_Rmtx *mutex) {}
936936
extern "C" WEAK void __iar_file_Mtxlock(__iar_Rmtx *mutex) {}
937937
extern "C" WEAK void __iar_file_Mtxunlock(__iar_Rmtx *mutex) {}
938938
#if defined(__IAR_SYSTEMS_ICC__ ) && (__VER__ >= 8000000)
939-
extern "C" WEAK void *__aeabi_read_tp (void) { return NULL ;}
939+
#pragma section="__iar_tls$$DATA"
940+
extern "C" WEAK void *__aeabi_read_tp (void) {
941+
// Thread Local storage is not supported, using main thread memory for errno
942+
return __section_begin("__iar_tls$$DATA");
943+
}
940944
#endif
941945
#elif defined(__CC_ARM)
942946
// Do nothing

0 commit comments

Comments
 (0)