<?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: sprintf with KDS 3.2.0 in Kinetis Design Studio</title>
    <link>https://community.nxp.com/t5/Kinetis-Design-Studio/sprintf-with-KDS-3-2-0/m-p/629853#M8108</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Erich,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you very much for your fast answer!&lt;/P&gt;&lt;P&gt;I started my project with one of your templates for my microcontroller, the one in this link:&lt;/P&gt;&lt;P&gt;&lt;A class="link-titled" href="https://github.com/ErichStyger/mcuoneclipse/tree/master/Examples/KDS/FRDM-KE06Z/FRDM-KE06Z" title="https://github.com/ErichStyger/mcuoneclipse/tree/master/Examples/KDS/FRDM-KE06Z/FRDM-KE06Z"&gt;mcuoneclipse/Examples/KDS/FRDM-KE06Z/FRDM-KE06Z at master · ErichStyger/mcuoneclipse · GitHub&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So that I have tried to recompile the original projects (directly yours) by adding only the following:&lt;/P&gt;&lt;P&gt;#include &amp;lt;stdio.h&amp;gt;&lt;/P&gt;&lt;P&gt;char test[100];&lt;/P&gt;&lt;P&gt;sprintf(test,"number=%d",5);&lt;/P&gt;&lt;P&gt;to the main function and it crashes with the same error:&lt;/P&gt;&lt;P&gt;"&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Invoking: Cross ARM C++ Linker&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;arm-none-eabi-g++ -mcpu=cortex-m0plus -mthumb -O0 -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections&amp;nbsp; -g3 -T "C:/IoT/KDS/WS_KE06Z/20160810_KE06Z/Project_Settings/Linker_Files/ProcessorExpert.ld" -Xlinker --gc-sections -L"C:/IoT/KDS/WS_KE06Z/20160810_KE06Z/Project_Settings/Linker_Files" -Wl,-Map,"20160810_KE06Z.map" --specs=nano.specs -o "20160810_KE06Z.elf"&amp;nbsp; ./Static_Code/System/CPU_Init.o ./Static_Code/System/Peripherals_Init.o ./Static_Code/System/Vectors.o&amp;nbsp; ./Sources/Events.o ./Sources/main.o&amp;nbsp; ./Project_Settings/Startup_Code/startup.o&amp;nbsp; ./Generated_Code/BitIoLdd1.o ./Generated_Code/BitIoLdd2.o ./Generated_Code/BitIoLdd3.o ./Generated_Code/BitIoLdd4.o ./Generated_Code/BitIoLdd5.o ./Generated_Code/Cpu.o ./Generated_Code/FRTOS1.o ./Generated_Code/KIN1.o ./Generated_Code/KSDK1.o ./Generated_Code/LEDB.o ./Generated_Code/LEDG.o ./Generated_Code/LEDR.o ./Generated_Code/LEDpin1.o ./Generated_Code/LEDpin2.o ./Generated_Code/LEDpin3.o ./Generated_Code/PE_LDD.o ./Generated_Code/PTD2.o ./Generated_Code/PTF1.o ./Generated_Code/Pins1.o ./Generated_Code/TU1.o ./Generated_Code/UTIL1.o ./Generated_Code/WAIT1.o ./Generated_Code/croutine.o ./Generated_Code/event_groups.o ./Generated_Code/heap_1.o ./Generated_Code/heap_2.o ./Generated_Code/heap_3.o ./Generated_Code/heap_4.o ./Generated_Code/heap_5.o ./Generated_Code/list.o ./Generated_Code/port.o ./Generated_Code/queue.o ./Generated_Code/tasks.o ./Generated_Code/timers.o&amp;nbsp; &amp;nbsp;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;c:/freescale/kds_v3/toolchain/bin/../lib/gcc/arm-none-eabi/4.8.4/../../../../arm-none-eabi/lib/armv6-m\libg_s.a(lib_a-sbrkr.o): In function `_sbrk_r':&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;sbrkr.c:(.text._sbrk_r+0xc): undefined reference to `_sbrk'&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;collect2.exe: error: ld returned 1 exit status&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;makefile:60: recipe for target '20160810_KE06Z.elf' failed&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;make: *** [20160810_KE06Z.elf] Error 1&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The most strange thing to me is that if I don't format the content of sprintf, it links correctly and works! This means that testing the following code has no linker errors:&lt;/P&gt;&lt;P&gt;#include &amp;lt;stdio.h&amp;gt;&lt;/P&gt;&lt;P&gt;char test[100];&lt;/P&gt;&lt;P&gt;sprintf(test,"number=5");&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any idea? I am absolutely lost and don't know how to go on.&lt;/P&gt;&lt;P&gt;Thank you very much for your collaboration.&lt;/P&gt;&lt;P&gt;BR!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 19 Sep 2016 15:52:21 GMT</pubDate>
    <dc:creator>almarto</dc:creator>
    <dc:date>2016-09-19T15:52:21Z</dc:date>
    <item>
      <title>sprintf with KDS 3.2.0</title>
      <link>https://community.nxp.com/t5/Kinetis-Design-Studio/sprintf-with-KDS-3-2-0/m-p/629851#M8106</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dear all,&lt;/P&gt;&lt;P&gt;I get the following linker error (Cross ARM C++ Linker)&amp;nbsp; : undefined reference to `_sbrk'&lt;/P&gt;&lt;P&gt;when I try to compile some code like this:&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;char mystring[10];&lt;/P&gt;&lt;P&gt;int mynumber=5;&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;sprintf(mystring,"%d",mynumber);&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;however, if I just format the sprintf without addional parameters, like this:&lt;/P&gt;&lt;P&gt;sprintf(mystring,"This is mystring");&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;it works! Could you please give me any hint?&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you very much in advance.&lt;/P&gt;&lt;P&gt;BR!&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;P.D. I use KE06Z microcontroller.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 19 Sep 2016 13:00:39 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Design-Studio/sprintf-with-KDS-3-2-0/m-p/629851#M8106</guid>
      <dc:creator>almarto</dc:creator>
      <dc:date>2016-09-19T13:00:39Z</dc:date>
    </item>
    <item>
      <title>Re: sprintf with KDS 3.2.0</title>
      <link>https://community.nxp.com/t5/Kinetis-Design-Studio/sprintf-with-KDS-3-2-0/m-p/629852#M8107</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Alvaro,&lt;/P&gt;&lt;P&gt;that depends on&lt;/P&gt;&lt;P&gt;a) Kinetis SDK used or not&lt;/P&gt;&lt;P&gt;b) which library you are using&lt;/P&gt;&lt;P&gt;c) if you are using semihosting or not&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sbrk() is a library routine used for dynamic memory allocation.&lt;/P&gt;&lt;P&gt;&lt;A class="link-titled" href="https://mcuoneclipse.com/2016/08/06/semihosting-again-with-nxp-kinetis-sdk-v2-0/" title="https://mcuoneclipse.com/2016/08/06/semihosting-again-with-nxp-kinetis-sdk-v2-0/"&gt;https://mcuoneclipse.com/2016/08/06/semihosting-again-with-nxp-kinetis-sdk-v2-0/&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I hope this helps,&lt;/P&gt;&lt;P&gt;Erich&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 19 Sep 2016 14:44:42 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Design-Studio/sprintf-with-KDS-3-2-0/m-p/629852#M8107</guid>
      <dc:creator>BlackNight</dc:creator>
      <dc:date>2016-09-19T14:44:42Z</dc:date>
    </item>
    <item>
      <title>Re: sprintf with KDS 3.2.0</title>
      <link>https://community.nxp.com/t5/Kinetis-Design-Studio/sprintf-with-KDS-3-2-0/m-p/629853#M8108</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Erich,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you very much for your fast answer!&lt;/P&gt;&lt;P&gt;I started my project with one of your templates for my microcontroller, the one in this link:&lt;/P&gt;&lt;P&gt;&lt;A class="link-titled" href="https://github.com/ErichStyger/mcuoneclipse/tree/master/Examples/KDS/FRDM-KE06Z/FRDM-KE06Z" title="https://github.com/ErichStyger/mcuoneclipse/tree/master/Examples/KDS/FRDM-KE06Z/FRDM-KE06Z"&gt;mcuoneclipse/Examples/KDS/FRDM-KE06Z/FRDM-KE06Z at master · ErichStyger/mcuoneclipse · GitHub&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So that I have tried to recompile the original projects (directly yours) by adding only the following:&lt;/P&gt;&lt;P&gt;#include &amp;lt;stdio.h&amp;gt;&lt;/P&gt;&lt;P&gt;char test[100];&lt;/P&gt;&lt;P&gt;sprintf(test,"number=%d",5);&lt;/P&gt;&lt;P&gt;to the main function and it crashes with the same error:&lt;/P&gt;&lt;P&gt;"&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Invoking: Cross ARM C++ Linker&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;arm-none-eabi-g++ -mcpu=cortex-m0plus -mthumb -O0 -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections&amp;nbsp; -g3 -T "C:/IoT/KDS/WS_KE06Z/20160810_KE06Z/Project_Settings/Linker_Files/ProcessorExpert.ld" -Xlinker --gc-sections -L"C:/IoT/KDS/WS_KE06Z/20160810_KE06Z/Project_Settings/Linker_Files" -Wl,-Map,"20160810_KE06Z.map" --specs=nano.specs -o "20160810_KE06Z.elf"&amp;nbsp; ./Static_Code/System/CPU_Init.o ./Static_Code/System/Peripherals_Init.o ./Static_Code/System/Vectors.o&amp;nbsp; ./Sources/Events.o ./Sources/main.o&amp;nbsp; ./Project_Settings/Startup_Code/startup.o&amp;nbsp; ./Generated_Code/BitIoLdd1.o ./Generated_Code/BitIoLdd2.o ./Generated_Code/BitIoLdd3.o ./Generated_Code/BitIoLdd4.o ./Generated_Code/BitIoLdd5.o ./Generated_Code/Cpu.o ./Generated_Code/FRTOS1.o ./Generated_Code/KIN1.o ./Generated_Code/KSDK1.o ./Generated_Code/LEDB.o ./Generated_Code/LEDG.o ./Generated_Code/LEDR.o ./Generated_Code/LEDpin1.o ./Generated_Code/LEDpin2.o ./Generated_Code/LEDpin3.o ./Generated_Code/PE_LDD.o ./Generated_Code/PTD2.o ./Generated_Code/PTF1.o ./Generated_Code/Pins1.o ./Generated_Code/TU1.o ./Generated_Code/UTIL1.o ./Generated_Code/WAIT1.o ./Generated_Code/croutine.o ./Generated_Code/event_groups.o ./Generated_Code/heap_1.o ./Generated_Code/heap_2.o ./Generated_Code/heap_3.o ./Generated_Code/heap_4.o ./Generated_Code/heap_5.o ./Generated_Code/list.o ./Generated_Code/port.o ./Generated_Code/queue.o ./Generated_Code/tasks.o ./Generated_Code/timers.o&amp;nbsp; &amp;nbsp;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;c:/freescale/kds_v3/toolchain/bin/../lib/gcc/arm-none-eabi/4.8.4/../../../../arm-none-eabi/lib/armv6-m\libg_s.a(lib_a-sbrkr.o): In function `_sbrk_r':&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;sbrkr.c:(.text._sbrk_r+0xc): undefined reference to `_sbrk'&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;collect2.exe: error: ld returned 1 exit status&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;makefile:60: recipe for target '20160810_KE06Z.elf' failed&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;make: *** [20160810_KE06Z.elf] Error 1&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The most strange thing to me is that if I don't format the content of sprintf, it links correctly and works! This means that testing the following code has no linker errors:&lt;/P&gt;&lt;P&gt;#include &amp;lt;stdio.h&amp;gt;&lt;/P&gt;&lt;P&gt;char test[100];&lt;/P&gt;&lt;P&gt;sprintf(test,"number=5");&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any idea? I am absolutely lost and don't know how to go on.&lt;/P&gt;&lt;P&gt;Thank you very much for your collaboration.&lt;/P&gt;&lt;P&gt;BR!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 19 Sep 2016 15:52:21 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Design-Studio/sprintf-with-KDS-3-2-0/m-p/629853#M8108</guid>
      <dc:creator>almarto</dc:creator>
      <dc:date>2016-09-19T15:52:21Z</dc:date>
    </item>
    <item>
      <title>Re: sprintf with KDS 3.2.0</title>
      <link>https://community.nxp.com/t5/Kinetis-Design-Studio/sprintf-with-KDS-3-2-0/m-p/629854#M8109</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Alvaro,&lt;/P&gt;&lt;P&gt;I tried both your code pieces in that project, and they work without any issues on my side.&lt;/P&gt;&lt;P&gt;So I don't know what is the problem on your end.&lt;/P&gt;&lt;P&gt;Maybe add the missing function as&lt;/P&gt;&lt;P&gt;void _sbrk(void){}&lt;/P&gt;&lt;P&gt;to your application to see what comes next.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Erich&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 20 Sep 2016 18:06:02 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Design-Studio/sprintf-with-KDS-3-2-0/m-p/629854#M8109</guid>
      <dc:creator>BlackNight</dc:creator>
      <dc:date>2016-09-20T18:06:02Z</dc:date>
    </item>
    <item>
      <title>Re: sprintf with KDS 3.2.0</title>
      <link>https://community.nxp.com/t5/Kinetis-Design-Studio/sprintf-with-KDS-3-2-0/m-p/629855#M8110</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Erich,,&lt;/P&gt;&lt;P&gt;Your solution works! I just added void _sbrk(void){}.&lt;/P&gt;&lt;P&gt;Thank you very much for your collaboration!&lt;/P&gt;&lt;P&gt;BR!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 21 Sep 2016 04:48:43 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Design-Studio/sprintf-with-KDS-3-2-0/m-p/629855#M8110</guid>
      <dc:creator>almarto</dc:creator>
      <dc:date>2016-09-21T04:48:43Z</dc:date>
    </item>
  </channel>
</rss>

