<?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 hardfault while using format specifier. in LPC Microcontrollers</title>
    <link>https://community.nxp.com/t5/LPC-Microcontrollers/sprintf-hardfault-while-using-format-specifier/m-p/1198322#M43238</link>
    <description>&lt;P&gt;Hi,&lt;BR /&gt;&lt;BR /&gt;I solved the issue, as I was using FOTA and I accidently replaced the current program sector with the latest one. This caused hardfault.&lt;/P&gt;</description>
    <pubDate>Sat, 12 Dec 2020 07:22:03 GMT</pubDate>
    <dc:creator>athmesh_n</dc:creator>
    <dc:date>2020-12-12T07:22:03Z</dc:date>
    <item>
      <title>sprintf hardfault while using format specifier.</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/sprintf-hardfault-while-using-format-specifier/m-p/1196134#M43193</link>
      <description>&lt;P&gt;Hi,&lt;BR /&gt;&lt;BR /&gt;Am using LPC1756 for my project. I have been working on the code for sometime, but recently when I added a new code for sprintf the firmware version of the project, i am getting &lt;STRONG&gt;HARDFAULT-FORCED(30),&lt;/STRONG&gt;&lt;/P&gt;&lt;LI-CODE lang="c"&gt;void func(void){
char Dummy[50];
uint8_t new_rev_vers;
sprintf(Dummy,"DOWNLOADING..%hu",new_rev_vers);
}&lt;/LI-CODE&gt;&lt;P&gt;&lt;STRONG&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/STRONG&gt;I tried understanding the disassembly and also tried adjusting heap and stack in mcuxpresso style, which did not even start the code.&lt;BR /&gt;&lt;BR /&gt;I'll share the memory consumed by the code. and the fault details.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="athmesh_n_0-1607500694928.png" style="width: 400px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/132209i0154F1594E48A9BB/image-size/medium?v=v2&amp;amp;px=400" role="button" title="athmesh_n_0-1607500694928.png" alt="athmesh_n_0-1607500694928.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;memory consumption:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="athmesh_n_1-1607500793438.png" style="width: 400px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/132210iDEBA69C3754CA4CC/image-size/medium?v=v2&amp;amp;px=400" role="button" title="athmesh_n_1-1607500793438.png" alt="athmesh_n_1-1607500793438.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;MCU details&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="athmesh_n_2-1607500857389.png" style="width: 400px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/132211iD0D1DAA6B1448BAE/image-size/medium?v=v2&amp;amp;px=400" role="button" title="athmesh_n_2-1607500857389.png" alt="athmesh_n_2-1607500857389.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 09 Dec 2020 08:01:15 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/sprintf-hardfault-while-using-format-specifier/m-p/1196134#M43193</guid>
      <dc:creator>athmesh_n</dc:creator>
      <dc:date>2020-12-09T08:01:15Z</dc:date>
    </item>
    <item>
      <title>Re: sprintf hardfault while using format specifier.</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/sprintf-hardfault-while-using-format-specifier/m-p/1196253#M43194</link>
      <description>&lt;P&gt;One obvious thing (but I doubt it is causing the problem) is that %hu expects a short (16 bit) but you have defined new_rev_vers at uint8_t which is a byte (8 bits).&lt;/P&gt;&lt;P&gt;But, more information required:&lt;/P&gt;&lt;P&gt;where is the PC - which module is it in?&lt;/P&gt;&lt;P&gt;which library are you using - newlib, newlib-nano, or redline?&lt;/P&gt;</description>
      <pubDate>Wed, 09 Dec 2020 09:48:25 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/sprintf-hardfault-while-using-format-specifier/m-p/1196253#M43194</guid>
      <dc:creator>converse</dc:creator>
      <dc:date>2020-12-09T09:48:25Z</dc:date>
    </item>
    <item>
      <title>Re: sprintf hardfault while using format specifier.</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/sprintf-hardfault-while-using-format-specifier/m-p/1196999#M43209</link>
      <description>&lt;P&gt;Hello &lt;SPAN style="color: #333f48; font-family: Arial, sans-serif; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-indent: 0px; text-transform: none; white-space: nowrap; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: #ffffff; text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial; display: inline !important; float: none;"&gt;athmesh_n&lt;/SPAN&gt;,&lt;/P&gt;
&lt;P&gt;Which version of MCUXpresso IDE you used? You can share a simple project that can reproduce your issue, we can help to check.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regards,&lt;/P&gt;
&lt;P&gt;Alice&lt;/P&gt;</description>
      <pubDate>Thu, 10 Dec 2020 01:14:09 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/sprintf-hardfault-while-using-format-specifier/m-p/1196999#M43209</guid>
      <dc:creator>Alice_Yang</dc:creator>
      <dc:date>2020-12-10T01:14:09Z</dc:date>
    </item>
    <item>
      <title>Re: sprintf hardfault while using format specifier.</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/sprintf-hardfault-while-using-format-specifier/m-p/1197990#M43231</link>
      <description>&lt;P&gt;Hi &lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/27788"&gt;@Alice_Yang&lt;/a&gt;&amp;nbsp;,&lt;BR /&gt;Thanks for the reply, my IDE is&amp;nbsp;&lt;STRONG&gt;MCUXpresso IDE v11.1.0 [Build 3209] [2019-12-12].&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/STRONG&gt;Hi&amp;nbsp;&lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/144226"&gt;@converse&lt;/a&gt;&amp;nbsp;,&lt;BR /&gt;Thanks for the reply, and yes I tried with %u for uint32_t for new_rev_vers, and am using redlib -semihost.&lt;/P&gt;</description>
      <pubDate>Fri, 11 Dec 2020 09:01:22 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/sprintf-hardfault-while-using-format-specifier/m-p/1197990#M43231</guid>
      <dc:creator>athmesh_n</dc:creator>
      <dc:date>2020-12-11T09:01:22Z</dc:date>
    </item>
    <item>
      <title>Re: sprintf hardfault while using format specifier.</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/sprintf-hardfault-while-using-format-specifier/m-p/1198322#M43238</link>
      <description>&lt;P&gt;Hi,&lt;BR /&gt;&lt;BR /&gt;I solved the issue, as I was using FOTA and I accidently replaced the current program sector with the latest one. This caused hardfault.&lt;/P&gt;</description>
      <pubDate>Sat, 12 Dec 2020 07:22:03 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/sprintf-hardfault-while-using-format-specifier/m-p/1198322#M43238</guid>
      <dc:creator>athmesh_n</dc:creator>
      <dc:date>2020-12-12T07:22:03Z</dc:date>
    </item>
  </channel>
</rss>

