<?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: use sprintf on S32 Power Studio in S32 Design Studio</title>
    <link>https://community.nxp.com/t5/S32-Design-Studio/use-sprintf-on-S32-Power-Studio/m-p/722507#M2109</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Jiri,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for your fast response and the test project, it helped me to solve the problem.&lt;/P&gt;&lt;P&gt;Also at my S32 Studio your test project worked well, so I compared all settings and ended up that the projects mainly differ in the chosen library. I did not use&amp;nbsp;test the ewl_c library because i had build errors with the "abs" function. So i changed all my abs(x) calls to (int)fabs((double)x) ones, which worked, because fabs is in the math.h library.&lt;/P&gt;&lt;P&gt;Afterwards building was possible and also the sprintf command worked.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best regards,&lt;/P&gt;&lt;P&gt;Roger&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 15 Jan 2018 15:35:17 GMT</pubDate>
    <dc:creator>helferog</dc:creator>
    <dc:date>2018-01-15T15:35:17Z</dc:date>
    <item>
      <title>use sprintf on S32 Power Studio</title>
      <link>https://community.nxp.com/t5/S32-Design-Studio/use-sprintf-on-S32-Power-Studio/m-p/722505#M2107</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hay everybody,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am working with the S32 Studio on a S32R274 Processor.&lt;/P&gt;&lt;P&gt;I have the issue that sprintf is not working properly and saw that there are already many (old) threads about this.&lt;/P&gt;&lt;P&gt;In one of them a relation between the&amp;nbsp;&lt;SPAN&gt;sbrk function an the sprintf was mentioned. This seems important to me, as I was facing the following&amp;nbsp; error:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;C:/NXP/S32DS_Power_v2017.R1/Cross_Tools/powerpc-eabivle-4_9/powerpc-eabivle/newlib/lib/e200z4/fp\libnosys.a(sbrk.o): In function `sbrk':&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;sbrk.c:(.text.sbrk+0x10): undefined reference to `end'&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;sbrk.c:(.text.sbrk+0x16): undefined reference to `end'&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;collect2.exe: error: ld returned 1 exit status&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and solved it by&amp;nbsp;changing the sections.ld file to:&lt;/P&gt;&lt;P&gt;&lt;EM&gt; /* Core 0 stack */&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt; .c0_stack_and_heap (NOLOAD) : ALIGN(16) &lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt; {&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt; __HEAP = . ;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt; . += __C0_HEAP_SIZE ;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt; &lt;STRONG&gt;PROVIDE (_end = . );&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt; PROVIDE (end = . );&lt;/STRONG&gt; &lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt; __HEAP_END = . ;&lt;/EM&gt;&lt;BR /&gt; &lt;BR /&gt;&lt;EM&gt; _stack_end = . ;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt; . += __C0_STACK_SIZE ;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt; _stack_addr = . ;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt; __SP_INIT = . ;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt; } &amp;gt; c0_stack_and_heap&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Building the Project worked great, but I faced&amp;nbsp;IVOR1 errors during runtime.&lt;/P&gt;&lt;P&gt;I found, that:&lt;/P&gt;&lt;P&gt;&lt;EM&gt;char str[80];&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;char test_str_1[] = "test_1";&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;char test_str_2[] = "test_2";&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;int test1 = 1;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;int test2 = 2;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;sprintf(str, "%s", test_str_1);&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;worked for every library, but:&lt;/P&gt;&lt;P&gt;&lt;EM&gt;sprintf(str, "%02i%02i", test1, test2);&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;only worked with the "newlib_nano no I/O" library, whereas:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;sprintf(str, "%s%s", test_str_1, test_str_2);&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;Did not work for any library.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Do you have any idea, why sprintf is not working?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks and best regards,&lt;/P&gt;&lt;P&gt;Roger&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 15 Jan 2018 09:12:34 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S32-Design-Studio/use-sprintf-on-S32-Power-Studio/m-p/722505#M2107</guid>
      <dc:creator>helferog</dc:creator>
      <dc:date>2018-01-15T09:12:34Z</dc:date>
    </item>
    <item>
      <title>Re: use sprintf on S32 Power Studio</title>
      <link>https://community.nxp.com/t5/S32-Design-Studio/use-sprintf-on-S32-Power-Studio/m-p/722506#M2108</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Roger,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I created new test project for your issue - but I can't reproduce it. The test project is in attachment. In my opinion is your issue related to some dynamic memory allocation - not to sprintf itself. It is possible share your project?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Jiri&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 15 Jan 2018 12:51:47 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S32-Design-Studio/use-sprintf-on-S32-Power-Studio/m-p/722506#M2108</guid>
      <dc:creator>jiri_kral</dc:creator>
      <dc:date>2018-01-15T12:51:47Z</dc:date>
    </item>
    <item>
      <title>Re: use sprintf on S32 Power Studio</title>
      <link>https://community.nxp.com/t5/S32-Design-Studio/use-sprintf-on-S32-Power-Studio/m-p/722507#M2109</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Jiri,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for your fast response and the test project, it helped me to solve the problem.&lt;/P&gt;&lt;P&gt;Also at my S32 Studio your test project worked well, so I compared all settings and ended up that the projects mainly differ in the chosen library. I did not use&amp;nbsp;test the ewl_c library because i had build errors with the "abs" function. So i changed all my abs(x) calls to (int)fabs((double)x) ones, which worked, because fabs is in the math.h library.&lt;/P&gt;&lt;P&gt;Afterwards building was possible and also the sprintf command worked.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best regards,&lt;/P&gt;&lt;P&gt;Roger&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 15 Jan 2018 15:35:17 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S32-Design-Studio/use-sprintf-on-S32-Power-Studio/m-p/722507#M2109</guid>
      <dc:creator>helferog</dc:creator>
      <dc:date>2018-01-15T15:35:17Z</dc:date>
    </item>
  </channel>
</rss>

