<?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>S32KのトピックRe: [S32K344] Hard Fault while Flash Erase Operation</title>
    <link>https://community.nxp.com/t5/S32K/S32K344-Hard-Fault-while-Flash-Erase-Operation/m-p/1894447#M36939</link>
    <description>&lt;P&gt;Hi &lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/225878"&gt;@enthuCutlet&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;It was discussed here:&lt;/P&gt;
&lt;P&gt;&lt;A href="https://community.nxp.com/t5/S32K/S32K344-C40-IP-Hardware-Fault-Problem/m-p/1697432" target="_blank"&gt;https://community.nxp.com/t5/S32K/S32K344-C40-IP-Hardware-Fault-Problem/m-p/1697432&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;As you mentioned, by default, the code is placed to .ramcode but it can be modified.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can check the location of the functions in the .map file.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;BR, Daniel&lt;/P&gt;</description>
    <pubDate>Wed, 26 Jun 2024 13:19:11 GMT</pubDate>
    <dc:creator>danielmartynek</dc:creator>
    <dc:date>2024-06-26T13:19:11Z</dc:date>
    <item>
      <title>[S32K344] Hard Fault while Flash Erase Operation</title>
      <link>https://community.nxp.com/t5/S32K/S32K344-Hard-Fault-while-Flash-Erase-Operation/m-p/1893687#M36900</link>
      <description>&lt;P&gt;As discussed in this post&amp;nbsp;&lt;A href="https://community.nxp.com/t5/S32K/S32K312-HardFault-issue-while-quot-sector-erase-quot/m-p/1465331#M15680" target="_blank"&gt;https://community.nxp.com/t5/S32K/S32K312-HardFault-issue-while-quot-sector-erase-quot/m-p/1465331#M15680&lt;/A&gt;&amp;nbsp;I have copied the functions in ITCM this way&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="enthuCutlet_0-1719321577992.png" style="width: 400px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/285669i2868A16664C23499/image-size/medium?v=v2&amp;amp;px=400" role="button" title="enthuCutlet_0-1719321577992.png" alt="enthuCutlet_0-1719321577992.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;But after this I was still getting hard-faults on flash erase operation sometimes. What makes it hard to debug is that sometimes it erases successfully but sometimes it ends up in hardfault, specifically in the&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;C40_Ip_MainInterfaceSectorEraseStatus() function.&amp;nbsp;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="enthuCutlet_1-1719321839906.png" style="width: 400px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/285670iBC4E15D7FBED167C/image-size/medium?v=v2&amp;amp;px=400" role="button" title="enthuCutlet_1-1719321839906.png" alt="enthuCutlet_1-1719321839906.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Another point to consider is that in my&amp;nbsp;&lt;SPAN&gt;Mem_43_InFls_MemMap.h file&amp;nbsp;MEM_43_INFLS_START_SEC_CODE macro was defined. in the header file we see that there is a compiler directive #pragma arm section code=".mcal_text". I'm copying the c40 drivers in ITCM but since I havent changed this macro could this be causing a problem? If yes then why does this not lead to hard fault every time and only happens intermittently on some erase operations.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="enthuCutlet_3-1719322553015.png" style="width: 400px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/285672i0E08A9FE5F2A6AFA/image-size/medium?v=v2&amp;amp;px=400" role="button" title="enthuCutlet_3-1719322553015.png" alt="enthuCutlet_3-1719322553015.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Once in the hardfault handler, the LR has an address of 0xffffffe9 which is some invalid address.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Later, I came across this post&amp;nbsp;&lt;A href="https://community.nxp.com/t5/S32K/ramcode-section-not-used-when-optimization-level-lt-O2/m-p/1834242" target="_blank"&gt;https://community.nxp.com/t5/S32K/ramcode-section-not-used-when-optimization-level-lt-O2/m-p/1834242&lt;/A&gt;&amp;nbsp;where the contributor has mentioned that&amp;nbsp;&lt;SPAN&gt;#define MEM_43_INFLS_START_SEC_CODE needs to be replaced with&amp;nbsp;#define MEM_43_INFLS_START_SEC_RAMCODE and similarly for STOP. And inside the&amp;nbsp;Mem_43_InFls_MemMap.h file I have replaced the #pragma directive from ".ramcode" to ".itcm_text" since I am copying the C40 functions into the ITCM.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="enthuCutlet_2-1719322227719.png" style="width: 400px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/285671iC99991E49501028B/image-size/medium?v=v2&amp;amp;px=400" role="button" title="enthuCutlet_2-1719322227719.png" alt="enthuCutlet_2-1719322227719.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;When I do this I no longer get hardfaults and the flash erase operation works fine.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 25 Jun 2024 13:39:25 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S32K/S32K344-Hard-Fault-while-Flash-Erase-Operation/m-p/1893687#M36900</guid>
      <dc:creator>enthuCutlet</dc:creator>
      <dc:date>2024-06-25T13:39:25Z</dc:date>
    </item>
    <item>
      <title>Re: [S32K344] Hard Fault while Flash Erase Operation</title>
      <link>https://community.nxp.com/t5/S32K/S32K344-Hard-Fault-while-Flash-Erase-Operation/m-p/1894447#M36939</link>
      <description>&lt;P&gt;Hi &lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/225878"&gt;@enthuCutlet&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;It was discussed here:&lt;/P&gt;
&lt;P&gt;&lt;A href="https://community.nxp.com/t5/S32K/S32K344-C40-IP-Hardware-Fault-Problem/m-p/1697432" target="_blank"&gt;https://community.nxp.com/t5/S32K/S32K344-C40-IP-Hardware-Fault-Problem/m-p/1697432&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;As you mentioned, by default, the code is placed to .ramcode but it can be modified.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can check the location of the functions in the .map file.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;BR, Daniel&lt;/P&gt;</description>
      <pubDate>Wed, 26 Jun 2024 13:19:11 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S32K/S32K344-Hard-Fault-while-Flash-Erase-Operation/m-p/1894447#M36939</guid>
      <dc:creator>danielmartynek</dc:creator>
      <dc:date>2024-06-26T13:19:11Z</dc:date>
    </item>
  </channel>
</rss>

