<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Newlib + FreeRTOS thread safety in MCUXpresso IDE</title>
    <link>https://community.nxp.com/t5/MCUXpresso-IDE/Newlib-FreeRTOS-thread-safety/m-p/1167682#M6222</link>
    <description>&lt;P&gt;&lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/85883"&gt;@v_canoz&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Could you provide more context as to your problems?&amp;nbsp; What happens if you #ifdef out the newlib method calls?&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I wanted to respond to the comments made by&amp;nbsp;&lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/17173"&gt;@ErichStyger&lt;/a&gt;&amp;nbsp;- the newlib ssprint_f code is not reentrant (or "thread safe").&amp;nbsp; I did a quick look at the&amp;nbsp;&amp;nbsp;&lt;A href="https://github.com/32bitmicro/newlib-nano-1.0/blob/master/newlib/libc/stdio/vfprintf.c" target="_self"&gt;vfprintf.c Source Code&lt;/A&gt;&amp;nbsp;and there is no check to see if the method is already running.&amp;nbsp; I'm not surprised at this as making IO library code reentrant is extremely difficult and most authors leave it as an exercise for the application developers (ie you).&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I should point out that it's extremely unlikely that you're going to have reentrancy problems with printf statements unless you've littered them *everywhere* including, interrupt service routines (which you should never do).&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Having said that, I do agree with&amp;nbsp;&lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/17173"&gt;@ErichStyger&lt;/a&gt;&amp;nbsp;that your problems are most likely of your own making and a good place to look is your stack size.&amp;nbsp; Erich quoted that you should have 50 bytes extra for each task and I would consider that the bare minimum, especially if interrupts are being used in your application.&amp;nbsp; For very high reliability applications, I have calculated the worst case for the task (context registers + local variables (for all called methods)&amp;nbsp; + number of method calls * size of data), but when it comes right down to it, I specify a lot bigger stack than I need (who cares if I use up the device's SRAM) and verify it with the process outlined in Erich's blog post:&amp;nbsp;&lt;A href="https://mcuoneclipse.com/2018/08/02/tutorial-using-runtime-statistics-with-amazon-freertos-v10/" target="_self"&gt;Tutorial: Using Runtime Statistics with Amazon FreeRTOS V10&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Good luck,&lt;/P&gt;&lt;P&gt;myke&lt;/P&gt;</description>
    <pubDate>Wed, 14 Oct 2020 20:20:46 GMT</pubDate>
    <dc:creator>myke_predko</dc:creator>
    <dc:date>2020-10-14T20:20:46Z</dc:date>
    <item>
      <title>Newlib + FreeRTOS thread safety</title>
      <link>https://community.nxp.com/t5/MCUXpresso-IDE/Newlib-FreeRTOS-thread-safety/m-p/1167371#M6217</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;We are using FreeRTOS + Newlib + C++ on several NXP MCUs. After&amp;nbsp;&lt;SPAN&gt;a few random&amp;nbsp;hard faults in a new project, we've discovered that the Newlib version provided by NXP is not thread safe!&lt;BR /&gt;&lt;BR /&gt;We've tried using &lt;A href="http://www.nadler.com/embedded/NXP_newlibAndFreeRTOS.html" target="_self"&gt;Dave Nadler's solution&lt;/A&gt; shipped with McuXpresso v11.2.1 using&amp;nbsp;&lt;STRONG&gt;&lt;I&gt;heap_useNewlib.c&amp;nbsp;&lt;/I&gt;&lt;/STRONG&gt;for heap management. We also added&amp;nbsp;&lt;STRONG&gt;&lt;I&gt;configUSE_NEWLIB_REENTRANT&lt;/I&gt;&lt;/STRONG&gt;&amp;nbsp; set to 1 in the &lt;EM&gt;&lt;STRONG&gt;FreeRTOSConfig.h&lt;/STRONG&gt;&lt;/EM&gt; file.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Despite this, we still have random hard faults, for example in the &lt;EM&gt;&lt;STRONG&gt;__ssprint_r&lt;/STRONG&gt; &lt;/EM&gt;newlib&amp;nbsp;function.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Can NXP provide a thread safe example of FreeRTOS used with Newlib? Do you think&amp;nbsp;&lt;EM&gt;&lt;STRONG&gt;__ssprint_r&amp;nbsp;&lt;/STRONG&gt;&lt;/EM&gt;has a bug, or is it a thread safety related problem?&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 14 Oct 2020 09:55:36 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MCUXpresso-IDE/Newlib-FreeRTOS-thread-safety/m-p/1167371#M6217</guid>
      <dc:creator>v_canoz</dc:creator>
      <dc:date>2020-10-14T09:55:36Z</dc:date>
    </item>
    <item>
      <title>Re: Newlib + FreeRTOS thread safety</title>
      <link>https://community.nxp.com/t5/MCUXpresso-IDE/Newlib-FreeRTOS-thread-safety/m-p/1167390#M6218</link>
      <description>&lt;P&gt;I have been using Dave's wrappers for more than 3 years (see&amp;nbsp;&lt;A href="https://mcuoneclipse.com/2017/07/02/using-freertos-with-newlib-and-newlib-nano/" target="_blank"&gt;https://mcuoneclipse.com/2017/07/02/using-freertos-with-newlib-and-newlib-nano/&lt;/A&gt;) and have not seen any reentrancy issue with it.&lt;/P&gt;&lt;P&gt;If you get hard faults, it is probably more because of stack overflows or inadequate buffers: I recommend you turn on Code Analysis (see&amp;nbsp;&lt;A href="https://mcuoneclipse.com/2013/01/06/free-static-code-analysis-with-eclipse/" target="_blank"&gt;https://mcuoneclipse.com/2013/01/06/free-static-code-analysis-with-eclipse/&lt;/A&gt;) which is able to catch some application bugs plus turn on stack analysis&amp;nbsp;&lt;A href="https://mcuoneclipse.com/2015/08/21/gnu-static-stack-usage-analysis/" target="_self"&gt;https://mcuoneclipse.com/2015/08/21/gnu-static-stack-usage-analysis/.&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Have a look as well at the FreeRTOS task view (stack usage: I always keep around 50 bytes spare space)&lt;/P&gt;&lt;P&gt;I hope this helps,&lt;/P&gt;&lt;P&gt;Erich&lt;/P&gt;</description>
      <pubDate>Wed, 14 Oct 2020 10:37:46 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MCUXpresso-IDE/Newlib-FreeRTOS-thread-safety/m-p/1167390#M6218</guid>
      <dc:creator>ErichStyger</dc:creator>
      <dc:date>2020-10-14T10:37:46Z</dc:date>
    </item>
    <item>
      <title>Re: Newlib + FreeRTOS thread safety</title>
      <link>https://community.nxp.com/t5/MCUXpresso-IDE/Newlib-FreeRTOS-thread-safety/m-p/1167497#M6219</link>
      <description>&lt;P&gt;[edit] moved post, can be deleted&lt;/P&gt;</description>
      <pubDate>Wed, 14 Oct 2020 14:25:54 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MCUXpresso-IDE/Newlib-FreeRTOS-thread-safety/m-p/1167497#M6219</guid>
      <dc:creator>v_canoz</dc:creator>
      <dc:date>2020-10-14T14:25:54Z</dc:date>
    </item>
    <item>
      <title>Re: Newlib + FreeRTOS thread safety</title>
      <link>https://community.nxp.com/t5/MCUXpresso-IDE/Newlib-FreeRTOS-thread-safety/m-p/1167535#M6220</link>
      <description>&lt;P&gt;Hello Erich,&lt;/P&gt;&lt;P&gt;Thank you for your answer. It's &lt;SPAN&gt;reassuring&amp;nbsp;&lt;/SPAN&gt;to know that you have been using it for 3 years.&lt;/P&gt;&lt;P&gt;I'm narrowing down the problem, it seems to be related to the conversion of floats to strings.&lt;/P&gt;&lt;P&gt;I've pasted here :&amp;nbsp;&lt;A href="https://godbolt.org/z/zKqaox" target="_self"&gt;https://godbolt.org/z/zKqaox&lt;/A&gt;&amp;nbsp;the code that is sufficient to induce hardfault. In particular&amp;nbsp;std::to_string(some_float) is the culprit.&lt;/P&gt;&lt;P&gt;Is it a known issue?&lt;/P&gt;&lt;P&gt;Many thanks,&lt;BR /&gt;Victor&lt;/P&gt;</description>
      <pubDate>Wed, 14 Oct 2020 14:26:20 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MCUXpresso-IDE/Newlib-FreeRTOS-thread-safety/m-p/1167535#M6220</guid>
      <dc:creator>v_canoz</dc:creator>
      <dc:date>2020-10-14T14:26:20Z</dc:date>
    </item>
    <item>
      <title>Re: Newlib + FreeRTOS thread safety</title>
      <link>https://community.nxp.com/t5/MCUXpresso-IDE/Newlib-FreeRTOS-thread-safety/m-p/1167547#M6221</link>
      <description>&lt;P&gt;[edit] I still have random crashes in&amp;nbsp;&lt;EM&gt;&lt;STRONG&gt;__ssprint_r&amp;nbsp;&lt;/STRONG&gt;&lt;/EM&gt;even if I am using integers (no floats). I've pasted below the disassembly code. The last instruction fetched is the last one (0x17838). I'm using newlib-nohost and the optimisation flags are set to -O3&lt;BR /&gt;&lt;BR /&gt;__ssprint_r:&lt;BR /&gt;00017790: ldr r3, [r2, #8]&lt;BR /&gt;00017792: stmdb sp!, {r4, r5, r6, r7, r8, r9, r10, r11, lr}&lt;BR /&gt;00017796: mov r9, r2&lt;BR /&gt;00017798: sub sp, #12&lt;BR /&gt;0001779a: cmp r3, #0&lt;BR /&gt;0001779c: beq.n 0x1788c &amp;lt;__ssprint_r+252&amp;gt;&lt;BR /&gt;0001779e: ldr r7, [r2, #0]&lt;BR /&gt;000177a0: mov r8, r0&lt;BR /&gt;000177a2: mov r4, r1&lt;BR /&gt;000177a4: ldr r0, [r1, #0]&lt;BR /&gt;000177a6: adds r7, #8&lt;BR /&gt;000177a8: ldr r5, [r1, #8]&lt;BR /&gt;000177aa: b.n 0x17844 &amp;lt;__ssprint_r+180&amp;gt;&lt;BR /&gt;000177ac: ldrh.w r12, [r4, #12]&lt;BR /&gt;000177b0: tst.w r12, #1152 ; 0x480&lt;BR /&gt;000177b4: beq.n 0x17820 &amp;lt;__ssprint_r+144&amp;gt;&lt;BR /&gt;000177b6: ldrd r1, r2, [r4, #16]&lt;BR /&gt;000177ba: adds.w r2, r2, r2, lsl #1&lt;BR /&gt;000177be: sub.w r5, r0, r1&lt;BR /&gt;000177c2: it mi&lt;BR /&gt;000177c4: addmi r2, #1&lt;BR /&gt;000177c6: adds r0, r5, r6&lt;BR /&gt;000177c8: mov.w r11, r2, asr #1&lt;BR /&gt;000177cc: adds r0, #1&lt;BR /&gt;000177ce: cmp r0, r11&lt;BR /&gt;000177d0: mov r2, r11&lt;BR /&gt;000177d2: bls.n 0x177d8 &amp;lt;__ssprint_r+72&amp;gt;&lt;BR /&gt;000177d4: mov r11, r0&lt;BR /&gt;000177d6: mov r2, r0&lt;BR /&gt;000177d8: tst.w r12, #1024 ; 0x400&lt;BR /&gt;000177dc: str r3, [sp, #4]&lt;BR /&gt;000177de: beq.n 0x17858 &amp;lt;__ssprint_r+200&amp;gt;&lt;BR /&gt;000177e0: mov r1, r2&lt;BR /&gt;000177e2: mov r0, r8&lt;BR /&gt;000177e4: bl 0x15fa4 &amp;lt;_malloc_r&amp;gt;&lt;BR /&gt;000177e8: ldr r3, [sp, #4]&lt;BR /&gt;000177ea: mov r10, r0&lt;BR /&gt;000177ec: cmp r0, #0&lt;BR /&gt;000177ee: beq.n 0x1786e &amp;lt;__ssprint_r+222&amp;gt;&lt;BR /&gt;000177f0: mov r2, r5&lt;BR /&gt;000177f2: ldr r1, [r4, #16]&lt;BR /&gt;000177f4: str r3, [sp, #4]&lt;BR /&gt;000177f6: bl 0x16540 &amp;lt;memcpy&amp;gt;&lt;BR /&gt;000177fa: ldrh r2, [r4, #12]&lt;BR /&gt;000177fc: ldr r3, [sp, #4]&lt;BR /&gt;000177fe: bic.w r2, r2, #1152 ; 0x480&lt;BR /&gt;00017802: orr.w r2, r2, #128 ; 0x80&lt;BR /&gt;00017806: strh r2, [r4, #12]&lt;BR /&gt;00017808: add.w r0, r10, r5&lt;BR /&gt;0001780c: sub.w r2, r11, r5&lt;BR /&gt;00017810: str.w r10, [r4, #16]&lt;BR /&gt;00017814: mov r5, r6&lt;BR /&gt;00017816: mov r10, r6&lt;BR /&gt;00017818: str r0, [r4, #0]&lt;BR /&gt;0001781a: str r2, [r4, #8]&lt;BR /&gt;0001781c: str.w r11, [r4, #20]&lt;BR /&gt;00017820: mov r1, r3&lt;BR /&gt;00017822: mov r2, r10&lt;BR /&gt;00017824: bl 0x1662c &amp;lt;memmove&amp;gt;&lt;BR /&gt;00017828: ldr r0, [r4, #8]&lt;BR /&gt;0001782a: ldr.w r1, [r9, #8]&lt;BR /&gt;0001782e: ldr r3, [r4, #0]&lt;BR /&gt;00017830: subs r5, r0, r5&lt;BR /&gt;00017832: subs r6, r1, r6&lt;BR /&gt;00017834: add.w r0, r3, r10&lt;BR /&gt;00017838: str r5, [r4, #8]&lt;BR /&gt;&lt;BR /&gt;The more tasks I run in parallel, the more likely it is to produce a hardfault quickly.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 14 Oct 2020 14:45:57 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MCUXpresso-IDE/Newlib-FreeRTOS-thread-safety/m-p/1167547#M6221</guid>
      <dc:creator>v_canoz</dc:creator>
      <dc:date>2020-10-14T14:45:57Z</dc:date>
    </item>
    <item>
      <title>Re: Newlib + FreeRTOS thread safety</title>
      <link>https://community.nxp.com/t5/MCUXpresso-IDE/Newlib-FreeRTOS-thread-safety/m-p/1167682#M6222</link>
      <description>&lt;P&gt;&lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/85883"&gt;@v_canoz&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Could you provide more context as to your problems?&amp;nbsp; What happens if you #ifdef out the newlib method calls?&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I wanted to respond to the comments made by&amp;nbsp;&lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/17173"&gt;@ErichStyger&lt;/a&gt;&amp;nbsp;- the newlib ssprint_f code is not reentrant (or "thread safe").&amp;nbsp; I did a quick look at the&amp;nbsp;&amp;nbsp;&lt;A href="https://github.com/32bitmicro/newlib-nano-1.0/blob/master/newlib/libc/stdio/vfprintf.c" target="_self"&gt;vfprintf.c Source Code&lt;/A&gt;&amp;nbsp;and there is no check to see if the method is already running.&amp;nbsp; I'm not surprised at this as making IO library code reentrant is extremely difficult and most authors leave it as an exercise for the application developers (ie you).&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I should point out that it's extremely unlikely that you're going to have reentrancy problems with printf statements unless you've littered them *everywhere* including, interrupt service routines (which you should never do).&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Having said that, I do agree with&amp;nbsp;&lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/17173"&gt;@ErichStyger&lt;/a&gt;&amp;nbsp;that your problems are most likely of your own making and a good place to look is your stack size.&amp;nbsp; Erich quoted that you should have 50 bytes extra for each task and I would consider that the bare minimum, especially if interrupts are being used in your application.&amp;nbsp; For very high reliability applications, I have calculated the worst case for the task (context registers + local variables (for all called methods)&amp;nbsp; + number of method calls * size of data), but when it comes right down to it, I specify a lot bigger stack than I need (who cares if I use up the device's SRAM) and verify it with the process outlined in Erich's blog post:&amp;nbsp;&lt;A href="https://mcuoneclipse.com/2018/08/02/tutorial-using-runtime-statistics-with-amazon-freertos-v10/" target="_self"&gt;Tutorial: Using Runtime Statistics with Amazon FreeRTOS V10&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Good luck,&lt;/P&gt;&lt;P&gt;myke&lt;/P&gt;</description>
      <pubDate>Wed, 14 Oct 2020 20:20:46 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MCUXpresso-IDE/Newlib-FreeRTOS-thread-safety/m-p/1167682#M6222</guid>
      <dc:creator>myke_predko</dc:creator>
      <dc:date>2020-10-14T20:20:46Z</dc:date>
    </item>
    <item>
      <title>Re: Newlib + FreeRTOS thread safety</title>
      <link>https://community.nxp.com/t5/MCUXpresso-IDE/Newlib-FreeRTOS-thread-safety/m-p/1169137#M6234</link>
      <description>&lt;P&gt;Hello,&lt;BR /&gt;&lt;BR /&gt;Thanks for your answers.&lt;/P&gt;&lt;P&gt;As a reminder&amp;nbsp;&lt;SPAN&gt;we are using&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;&lt;I&gt;heap_useNewlib.c&amp;nbsp;&lt;/I&gt;&lt;/STRONG&gt;&lt;SPAN&gt;for heap management. We also added&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;&lt;I&gt;configUSE_NEWLIB_REENTRANT&lt;/I&gt;&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp; set to 1 in the&amp;nbsp;&lt;/SPAN&gt;&lt;EM&gt;&lt;STRONG&gt;FreeRTOSConfig.h&lt;/STRONG&gt;&lt;/EM&gt;&lt;SPAN&gt;&amp;nbsp;file. The Newlib binaries used are &lt;EM&gt;&lt;STRONG&gt;Newlib-none (NOT nano).&lt;BR /&gt;&lt;/STRONG&gt;&lt;BR /&gt;&lt;/EM&gt;We wrote a simple test bench to check wether&amp;nbsp;&lt;EM&gt;&lt;STRONG&gt;vsnprintf&amp;nbsp;&lt;/STRONG&gt;&lt;/EM&gt;is thread safe. We tried to read the newlib sources &lt;A href="https://sourceware.org/newlib/" target="_self"&gt;from here&lt;/A&gt;, but given we don't know what flags NXP uses, we don't know exactly what implementation is used by McuExpresso (By the way, can NXP provide the sources of Newlib with their own settings, this should be open source, isn't it?).&lt;BR /&gt;&lt;BR /&gt;The test bench is&lt;A href="https://godbolt.org/z/qczjhx" target="_self"&gt; available here&lt;/A&gt;. We have a thread safe task that we instantiate&amp;nbsp;20 times with different levels of priority, in order to create context switches in runtime. In the tasks loops, we just run&amp;nbsp;&lt;EM&gt;&lt;STRONG&gt;vsnprintf&amp;nbsp;&lt;/STRONG&gt;&lt;/EM&gt;with some integers into a buffer. This test may not represent a real use case, but I sleep better when I know my programs do not contain big random flaws.&lt;BR /&gt;&lt;BR /&gt;This test bench almost instantly generates an hardfault. However, if I replace&amp;nbsp;&lt;EM&gt;&lt;STRONG&gt;vsnprintf&amp;nbsp;&lt;/STRONG&gt;&lt;/EM&gt;with my custom made &lt;STRONG&gt;int&lt;/STRONG&gt; to &lt;EM&gt;&lt;STRONG&gt;string&lt;/STRONG&gt; &lt;/EM&gt;function, it works flawlessly!&lt;BR /&gt;&lt;BR /&gt;So my conclusion is&amp;nbsp;&lt;EM&gt;&lt;STRONG&gt;vsnprintf&amp;nbsp;&lt;/STRONG&gt;&lt;/EM&gt;is NOT thread safe at all !&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;I would be so grateful&amp;nbsp;if you guys (&lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/58763"&gt;@myke_predko&lt;/a&gt; and&amp;nbsp;&lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/17173"&gt;@ErichStyger&lt;/a&gt;&amp;nbsp;) can corroborate our findings. Unless I am mistaking, I really think one should never use the printf family function in mcuxpresso with Freertos. But now I wonder, what others functions of newlib are broken too??&lt;BR /&gt;&lt;BR /&gt;Many thanks,&lt;BR /&gt;Victor&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 17 Oct 2020 16:26:17 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MCUXpresso-IDE/Newlib-FreeRTOS-thread-safety/m-p/1169137#M6234</guid>
      <dc:creator>v_canoz</dc:creator>
      <dc:date>2020-10-17T16:26:17Z</dc:date>
    </item>
    <item>
      <title>Re: Newlib + FreeRTOS thread safety</title>
      <link>https://community.nxp.com/t5/MCUXpresso-IDE/Newlib-FreeRTOS-thread-safety/m-p/1169758#M6240</link>
      <description>&lt;P&gt;As detailed in the SoftwareContentRegister.txt file provided in LPCXpresso, NXP take their GCC directly from the ARM Embedded Toolchain project&lt;/P&gt;&lt;P&gt;&lt;A href="https://developer.arm.com/tools-and-software/open-source-software/developer-tools/gnu-toolchain/gnu-rm/downloads" target="_blank"&gt;https://developer.arm.com/tools-and-software/open-source-software/developer-tools/gnu-toolchain/gnu-rm/downloads&lt;/A&gt;&lt;/P&gt;&lt;P&gt;This project provides full source code downloads, build instructions (including all of the settings used). You just need to match up the version you are using with the appropriate release.&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is what it says in v11.1.1 (the version I am using)&lt;/P&gt;&lt;P&gt;GNU Tools for ARM Embedded Processors&lt;BR /&gt;A GNU toolchain built by ARM&lt;BR /&gt;Licenses: GPL-2.0, GPL-3.0, LGPL-2.0, LGPL-2.1, LGPL-3.0, GPL-2.0-with-GCC-exception, BSD-3-Clause, and further licences (see below)&lt;BR /&gt;Further Licenses: The Newlib and Newlib-nano packages within this component are subject&lt;BR /&gt;to a collection of licenses, listed in the License File. The Expat package is&lt;BR /&gt;subject to a license whose text is given in the License File.&lt;BR /&gt;License File: ./ide/plugins/com.nxp.mcuxpresso.tools.*/tools/share/doc/gcc-arm-none-eabi/license.txt&lt;BR /&gt;Distribution Type: Source &amp;amp; Binary&lt;BR /&gt;Version: 8-2019-q3-update&lt;BR /&gt;plus gdb 7.12 binaries taken from 6_3-2017q2 (and labelled "-712")&lt;BR /&gt;Location: ./ide/plugins/com.nxp.mcuxpresso.tools.*/tools&lt;BR /&gt;Website: &lt;A href="https://developer.arm.com/open-source/gnu-toolchain/gnu-rm" target="_blank"&gt;https://developer.arm.com/open-source/gnu-toolchain/gnu-rm&lt;/A&gt;&lt;BR /&gt;Source URL: &lt;A href="https://developer.arm.com/open-source/gnu-toolchain/gnu-rm/downloads" target="_blank"&gt;https://developer.arm.com/open-source/gnu-toolchain/gnu-rm/downloads&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 19 Oct 2020 15:54:42 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MCUXpresso-IDE/Newlib-FreeRTOS-thread-safety/m-p/1169758#M6240</guid>
      <dc:creator>converse</dc:creator>
      <dc:date>2020-10-19T15:54:42Z</dc:date>
    </item>
    <item>
      <title>Re: Newlib + FreeRTOS thread safety</title>
      <link>https://community.nxp.com/t5/MCUXpresso-IDE/Newlib-FreeRTOS-thread-safety/m-p/1169838#M6242</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/85883"&gt;@v_canoz&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Honestly, I don't have the time to create a new application to test NewLib/printf reentrancy in FreeRTOS, it sounds like you've done a good job on your own.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;However, If I can make a few comments;&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;Based on what you've written here, it sounds like you've found a bug in the float to string functionality. I suggest that you join the &lt;A href="https://sourceware.org/newlib/" target="_self"&gt;New Lib Mail Server&lt;/A&gt;&amp;nbsp;and report the bug.&amp;nbsp;&amp;nbsp;&lt;/LI&gt;&lt;LI&gt;As I said before it's very difficult to make IO functions reenterant - I always recommend that the developer provide either serialization or virtualization code to access to an IO method if it is going to be accessed by more than one task.&amp;nbsp; The ideal is to not to call an IO method and the hardware it accesses by more than one task (then you don't have to worry about serializing or virtualiztng the IO method).&amp;nbsp;&amp;nbsp;&lt;/LI&gt;&lt;LI&gt;I use printf's constantly in my FreeRTOS applications without any problems.&amp;nbsp; But, I follow a fairly rigorous set of rules for their use, namely a printf at the start of each task so that I can see the task has started, a printf when an execution error is detected and printfs fairly liberally in the application execution task (which performs no IO).&amp;nbsp;&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;&lt;STRONG&gt;ALL&lt;/STRONG&gt; printf statements are encased in "#if (2 != SDK_DEBUGCONSOLE)"/"#endif" so that when I want to release the code I can disable&amp;nbsp;all of them by changing the DEBUGCONSOLE build variable.&amp;nbsp; &amp;nbsp;&lt;/P&gt;&lt;P&gt;My placement of printfs is designed to not affect the timing of IO operations (unless there is an error, at which point I don't care and then causing an execution fault is not necessarily a bad thing) so that I can run with or without them and not worry how the application performs.&amp;nbsp; I've been using NewLib for 7+ years, first with MQX and then with FreeRTOS without any issues (although I haven't been using it with floats).&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I detailed how I use printfs in FreeRTOS because I'm not sure how you are putting printfs in your code.&amp;nbsp; From what you've written, it sounds like you put them everywhere which means that you're going to have a hodge podge of messages piling up on the screen that can be very difficult to decypher when you have a problem to resolve.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would suggest that you be somewhat more strategic in how you use printfs in your code and reentrancy should not be an issue (although you still have the float issue to deal with).&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Good luck,&lt;/P&gt;&lt;P&gt;myke&lt;/P&gt;</description>
      <pubDate>Mon, 19 Oct 2020 20:09:54 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MCUXpresso-IDE/Newlib-FreeRTOS-thread-safety/m-p/1169838#M6242</guid>
      <dc:creator>myke_predko</dc:creator>
      <dc:date>2020-10-19T20:09:54Z</dc:date>
    </item>
  </channel>
</rss>

