<?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: access to static variable in RAM by flash peripheral results in IBUSERR</title>
    <link>https://community.nxp.com/t5/S32K/access-to-static-variable-in-RAM-by-flash-peripheral-results-in/m-p/1461896#M15581</link>
    <description>&lt;P&gt;Thanks Lukas.&lt;/P&gt;&lt;P&gt;This troubleshooting is made difficult by the intermittent nature of the failure as well as the handful of possible mistakes I've made. This statement by you is very helpful:&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;P&gt;&lt;FONT face="andale mono,times"&gt;Either the callback address is not valid or the callback function is placed to program flash memory. &lt;/FONT&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;FONT face="andale mono,times"&gt;1. Either the callback address is not valid&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="andale mono,times"&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;&lt;STRONG&gt;Perhaps guilty&lt;/STRONG&gt;. Yesterday I found a function with a 1kB buffer as a stack variable. The stack itself is only 1kB. It was a leaf function so it didn't result in stack corruption. The buffer overflowed into the heap (also 1kB). However, this application doesn't use heap memory. This is a real bug but it doesn't seem to be directly related to the failure.&lt;/FONT&gt;&lt;BR /&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="andale mono,times"&gt;2. or the callback program is placed to [in?] program flash memory&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="andale mono,times"&gt;&lt;STRONG&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;Definitely guilty&lt;/FONT&gt;&lt;/STRONG&gt;. pSSDConfig-&amp;gt;Callback&lt;/FONT&gt; was initially placed in program flash. I misunderstood the documentation as simply a warning that it not be placed in a program flash sector subject to read/write. I now understand the meaning of the documentation to be that this callback (in my case a watchdog trigger) must not be placed in program flash at all.&lt;/P&gt;&lt;P&gt;When troubleshooting &lt;STRONG&gt;Problem 1&lt;/STRONG&gt; I recall applying&amp;nbsp;&lt;FONT face="andale mono,times"&gt;__attribute((section(".ram")))&lt;/FONT&gt; to&amp;nbsp; &lt;FONT face="andale mono,times"&gt;pSSDConfig-&amp;gt;Callback&lt;FONT face="arial,helvetica,sans-serif"&gt; in RAM and finding it to have no effect.&amp;nbsp;Because the &lt;FONT face="andale mono,times"&gt;IBUSERR&lt;/FONT&gt; still occurred I removed the &lt;/FONT&gt;__attribute&lt;FONT face="arial,helvetica,sans-serif"&gt;.&lt;BR /&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="andale mono,times"&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;Yesterday I again placed &lt;FONT face="andale mono,times"&gt;pSSDConfig-&amp;gt;Callback&lt;/FONT&gt; in RAM. This time I used &lt;FONT face="andale mono,times"&gt;readelf &lt;FONT face="arial,helvetica,sans-serif"&gt;to check that the function was in fact placed in RAM. I found that it was not, and&lt;/FONT&gt;&lt;/FONT&gt; that my linker script had no &lt;FONT face="andale mono,times"&gt;.ram&lt;/FONT&gt; section. In that particular linker script it was called &lt;FONT face="andale mono,times"&gt;.code_ram&lt;/FONT&gt;. &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="andale mono,times"&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;I applied &lt;FONT face="andale mono,times"&gt;__attribute((section(".code_ram")))&lt;/FONT&gt; and confirmed that the function was relocated. It is likely that I never actually relocated the function during the troubleshooting of &lt;STRONG&gt;Problem 1.&lt;/STRONG&gt;&lt;BR /&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="andale mono,times"&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;I'm now able to do an A-B test by removing &lt;FONT face="andale mono,times"&gt;__attribute((section(".code_ram")))&lt;/FONT&gt; from &lt;FONT face="andale mono,times"&gt;pSSDConfig-&amp;gt;Callback&lt;/FONT&gt; and observing an intermittent &lt;FONT face="andale mono,times"&gt;IBUSERR&lt;/FONT&gt;. It doesn't occur on every flash operation.&lt;BR /&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;There still remains an issue where &lt;FONT face="andale mono,times"&gt;FLASH_DRV_VerifySection(...)&lt;/FONT&gt; occasionally returns &lt;FONT face="andale mono,times"&gt;STATUS_ERROR&lt;/FONT&gt;. I will proceed under the assumption that this is not related to the issue described in this thread.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Summary&lt;/STRONG&gt;:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;the GCC ld flag &lt;FONT face="andale mono,times"&gt;-orphan-handling=error&lt;/FONT&gt; may be able to warn about nonexistent linker file sections, although it may not yet be supported in &lt;FONT face="andale mono,times"&gt;arm-none-eabi-gcc&lt;/FONT&gt;&lt;/LI&gt;&lt;LI&gt;the GCC flag &lt;FONT face="andale mono,times"&gt;-Wframe-larger-than=1024&lt;/FONT&gt; may be used to warn about large variables on the stack&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;Thanks also Lukas for your note on how to find the root cause of an &lt;FONT face="andale mono,times"&gt;IBUSERR.&lt;FONT face="arial,helvetica,sans-serif"&gt; I will return to it in future.&lt;/FONT&gt;&lt;BR /&gt;&lt;/FONT&gt;&lt;/P&gt;</description>
    <pubDate>Sat, 21 May 2022 04:31:31 GMT</pubDate>
    <dc:creator>driftregion</dc:creator>
    <dc:date>2022-05-21T04:31:31Z</dc:date>
    <item>
      <title>access to static variable in RAM by flash peripheral results in IBUSERR</title>
      <link>https://community.nxp.com/t5/S32K/access-to-static-variable-in-RAM-by-flash-peripheral-results-in/m-p/1460808#M15549</link>
      <description>&lt;P&gt;&lt;STRONG&gt;Problem Statement:&lt;/STRONG&gt; access to RAM by the flash peripheral during&amp;nbsp;&lt;FONT face="andale mono,times"&gt;FLASH_DRV_Program()&lt;/FONT&gt; results in an &lt;FONT face="andale mono,times"&gt;IBUSERR&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;&lt;STRONG&gt;Background&lt;/STRONG&gt;:&lt;/FONT&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;processor: S32K142&lt;/LI&gt;&lt;LI&gt;toolchain: arm-none-eabi-&amp;nbsp; version 10&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;STRONG&gt;Observable behavior:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Processor hard faults during flash write procedure.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Problem 1. Initial investigation and fix:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="andale mono,times"&gt;IBUSERR&lt;/FONT&gt; results from access of a &lt;FONT face="andale mono,times"&gt;const flash_ssd_config_t *&lt;/FONT&gt; configuration structure instance which was declared as &lt;FONT face="andale mono,times"&gt;static&lt;/FONT&gt;.&amp;nbsp; The bus error was precise and load instruction was explicit, occurring in &lt;FONT face="andale mono,times"&gt;flash_driver.c:95 &lt;/FONT&gt;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;FONT face="andale mono,times"&gt;&lt;SPAN&gt;DISABLE_CHECK_RAMSECTION_FUNCTION_CALL\&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="andale mono,times"&gt;&lt;SPAN&gt;(pSSDConfig-&amp;gt;CallBack)();\&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="andale mono,times"&gt;&lt;SPAN&gt;ENABLE_CHECK_RAMSECTION_FUNCTION_CALL\&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;The &lt;FONT face="andale mono,times"&gt;static&lt;/FONT&gt; type-qualifier on pSSDConfig was removed and the Hard Fault ceased to occur.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Problem 2. Subsequent investigation and fix:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;A month later a similar problem occurred. This time, the bus error was inexact. A stack dump and some guessing implicated the memory pointed to by &lt;FONT face="andale mono,times"&gt;pData &lt;FONT face="arial,helvetica,sans-serif"&gt;in the function below:&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="andale mono,times"&gt;status_t FLASH_DRV_Program(const flash_ssd_config_t * pSSDConfig, &lt;/FONT&gt;&lt;FONT face="andale mono,times"&gt;uint32_t dest, &lt;/FONT&gt;&lt;FONT face="andale mono,times"&gt;uint32_t size, &lt;/FONT&gt;&lt;FONT face="andale mono,times"&gt;const uint8_t * pData);&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;It too was declared &lt;FONT face="andale mono,times"&gt;static&lt;/FONT&gt;. Removing the &lt;FONT face="andale mono,times"&gt;static&lt;/FONT&gt; type-qualifier again caused the problem to disappear.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Observations and Reproducibility:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Everything I found about &lt;FONT face="andale mono,times"&gt;IBUSERR&lt;FONT face="arial,helvetica,sans-serif"&gt; online was the result of an illegal load, for example: &lt;A href="https://wiki.segger.com/Cortex-M_Fault#Illegal_Function_Execution" target="_blank" rel="noopener"&gt;https://wiki.segger.com/Cortex-M_Fault#Illegal_Function_Execution&lt;/A&gt; where &lt;/FONT&gt;&lt;/FONT&gt;illegal means a reserved address.&lt;/P&gt;&lt;P&gt;However, using &lt;FONT face="andale mono,times"&gt;readelf&lt;/FONT&gt; I found that the absence of the &lt;FONT face="andale mono,times"&gt;static&lt;/FONT&gt; type-qualifier doesn't change the address of the given symbol in RAM. The only change in the output of &lt;FONT face="andale mono,times"&gt;readelf&lt;/FONT&gt; is that the &lt;FONT face="andale mono,times"&gt;Bind&lt;/FONT&gt; column of the given symbol changes from &lt;FONT face="andale mono,times"&gt;LOCAL&lt;/FONT&gt; to &lt;FONT face="andale mono,times"&gt;GLOBAL&lt;/FONT&gt;. Therefore, whether or not an access is illegal depends on more than just the address.&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;there seems to be a strong relationship between the binding (&lt;FONT face="andale mono,times"&gt;LOCAL/GLOBAL&lt;/FONT&gt;) of the memory passed to&amp;nbsp;&lt;FONT face="andale mono,times"&gt;FLASH_DRV_Program()&lt;/FONT&gt; and the occurrence of an &lt;FONT face="andale mono,times"&gt;IBUSERR&lt;/FONT&gt;.&lt;/LI&gt;&lt;LI&gt;There is some additional input that results in &lt;FONT face="andale mono,times"&gt;IBUSERR&lt;/FONT&gt; beyond just the binding of the memory passed to&amp;nbsp;&lt;FONT face="andale mono,times"&gt;FLASH_DRV_Program()&lt;FONT face="arial,helvetica,sans-serif"&gt;.&amp;nbsp; For example, when the codebase is reverted to immediately after the fix of &lt;STRONG&gt;Problem 1&lt;/STRONG&gt;, IBUSERR has not been observed to occur. When the codebase is at the state at which &lt;STRONG&gt;Problem 2 &lt;/STRONG&gt;was observed, the IBUSERR does not occur on every write. The frequency of occurrence is sometimes high and sometimes low.&lt;BR /&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;STRONG&gt;Reading:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;I'm reading the ARMv7-M Architecture Reference Manual:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;A3.5 Memory types&lt;/LI&gt;&lt;LI&gt;A3.6 Access rights&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;which mentions that a MemManage exception might be triggered on illegal accesses.&amp;nbsp; I've reverted the codebase to the state at which &lt;STRONG&gt;Problem 2&lt;/STRONG&gt; was observed and added a &lt;FONT face="andale mono,times"&gt;MemManage_Handler&lt;/FONT&gt; but have not yet been able to successfully reproduce the &lt;FONT face="andale mono,times"&gt;IBUSERR&lt;/FONT&gt;.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Question:&lt;/STRONG&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;What attribute other than its value makes an address illegal such that loading it results in an &lt;FONT face="andale mono,times"&gt;IBUSERR&lt;FONT face="arial,helvetica,sans-serif"&gt;?&lt;/FONT&gt;&lt;/FONT&gt;&lt;/LI&gt;&lt;/UL&gt;</description>
      <pubDate>Thu, 19 May 2022 10:34:13 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S32K/access-to-static-variable-in-RAM-by-flash-peripheral-results-in/m-p/1460808#M15549</guid>
      <dc:creator>driftregion</dc:creator>
      <dc:date>2022-05-19T10:34:13Z</dc:date>
    </item>
    <item>
      <title>Re: access to static variable in RAM by flash peripheral results in IBUSERR</title>
      <link>https://community.nxp.com/t5/S32K/access-to-static-variable-in-RAM-by-flash-peripheral-results-in/m-p/1461541#M15566</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;this is not a problem of attributes, this is related to callback function and Read-While-Write error.&lt;/P&gt;
&lt;P&gt;Mentioned line of code:&lt;/P&gt;
&lt;P&gt;&lt;FONT face="andale mono,times"&gt;&lt;SPAN&gt;(pSSDConfig-&amp;gt;CallBack)();\&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="andale mono,times"&gt;... is a call of callback function. Because you got IBUSERR, it's not a problem of RAM or problem of this pSSDConfig structure. It's a problem of instruction fetch, not data access. Either the callback address is not valid or the callback function is placed to program flash memory. &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="andale mono,times"&gt;Program flash of S32K142 consists of one read partition only. That means when you program or erase program flash, the code can run only from RAM or from data flash. If you access (either by instruction fetch or by data access) program flash during program or erase operation, it will lead to bus error. So, make sure that callback function is placed to RAM and that this callback function does not access program flash. &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="andale mono,times"&gt;Let me also explain how to find the root cause when IBUSERR occurs:&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="andale mono,times"&gt;For test purposes, I can try to jump to invalid address (somewhere behind the flash, for example):&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;typedef void (*func_ptr)(); // pointer to function type&lt;/P&gt;
&lt;P&gt;(*(func_ptr)0x00080000)();&lt;/P&gt;
&lt;P&gt;When running this code, fault handler is triggered and I can see that IBUSERR is set:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="lukaszadrapa_0-1653039828412.png" style="width: 400px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/180415i9CD40F604C2EB7EA/image-size/medium?v=v2&amp;amp;px=400" role="button" title="lukaszadrapa_0-1653039828412.png" alt="lukaszadrapa_0-1653039828412.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Now it's time to check the stack content. You can take a look at Figure 2 in:&lt;/P&gt;
&lt;P&gt;&lt;A href="https://www.nxp.com/docs/en/application-note/AN12201.pdf" target="_blank"&gt;https://www.nxp.com/docs/en/application-note/AN12201.pdf&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;... which shows the stack frame. What I can see in my debugger:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="lukaszadrapa_1-1653040159908.png" style="width: 400px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/180416iB081AF61558C1ACA/image-size/medium?v=v2&amp;amp;px=400" role="button" title="lukaszadrapa_1-1653040159908.png" alt="lukaszadrapa_1-1653040159908.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;This stack frame is created when the exception is triggered. The most interesting is program counter PC (this is captured at the moment when exception is triggered) and link register LR - in this case, it's address of instruction right behind the instruction which caused the error (i.e. return address).&lt;/P&gt;
&lt;P&gt;What I can see at this address 0x6FC (the last bit is set due to thumb instruction set, so the value is 0x6FD):&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="lukaszadrapa_2-1653040495642.png" style="width: 400px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/180418i28BDA417746B0811/image-size/medium?v=v2&amp;amp;px=400" role="button" title="lukaszadrapa_2-1653040495642.png" alt="lukaszadrapa_2-1653040495642.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Now I can see that it was jump to address stored in r3. This can be seen also in stack frame - r3 still contains this address and PC also shows that this was the problem.&lt;/P&gt;
&lt;P&gt;And now I can check also this address:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="lukaszadrapa_3-1653040615910.png" style="width: 400px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/180419iCEA0D5920B0B2B8E/image-size/medium?v=v2&amp;amp;px=400" role="button" title="lukaszadrapa_3-1653040615910.png" alt="lukaszadrapa_3-1653040615910.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Here I can see that the bus error was triggered because I jumped to unimplemented address space.&lt;/P&gt;
&lt;P&gt;Regards,&lt;/P&gt;
&lt;P&gt;Lukas&lt;/P&gt;</description>
      <pubDate>Fri, 20 May 2022 10:00:25 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S32K/access-to-static-variable-in-RAM-by-flash-peripheral-results-in/m-p/1461541#M15566</guid>
      <dc:creator>lukaszadrapa</dc:creator>
      <dc:date>2022-05-20T10:00:25Z</dc:date>
    </item>
    <item>
      <title>Re: access to static variable in RAM by flash peripheral results in IBUSERR</title>
      <link>https://community.nxp.com/t5/S32K/access-to-static-variable-in-RAM-by-flash-peripheral-results-in/m-p/1461896#M15581</link>
      <description>&lt;P&gt;Thanks Lukas.&lt;/P&gt;&lt;P&gt;This troubleshooting is made difficult by the intermittent nature of the failure as well as the handful of possible mistakes I've made. This statement by you is very helpful:&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;P&gt;&lt;FONT face="andale mono,times"&gt;Either the callback address is not valid or the callback function is placed to program flash memory. &lt;/FONT&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;FONT face="andale mono,times"&gt;1. Either the callback address is not valid&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="andale mono,times"&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;&lt;STRONG&gt;Perhaps guilty&lt;/STRONG&gt;. Yesterday I found a function with a 1kB buffer as a stack variable. The stack itself is only 1kB. It was a leaf function so it didn't result in stack corruption. The buffer overflowed into the heap (also 1kB). However, this application doesn't use heap memory. This is a real bug but it doesn't seem to be directly related to the failure.&lt;/FONT&gt;&lt;BR /&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="andale mono,times"&gt;2. or the callback program is placed to [in?] program flash memory&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="andale mono,times"&gt;&lt;STRONG&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;Definitely guilty&lt;/FONT&gt;&lt;/STRONG&gt;. pSSDConfig-&amp;gt;Callback&lt;/FONT&gt; was initially placed in program flash. I misunderstood the documentation as simply a warning that it not be placed in a program flash sector subject to read/write. I now understand the meaning of the documentation to be that this callback (in my case a watchdog trigger) must not be placed in program flash at all.&lt;/P&gt;&lt;P&gt;When troubleshooting &lt;STRONG&gt;Problem 1&lt;/STRONG&gt; I recall applying&amp;nbsp;&lt;FONT face="andale mono,times"&gt;__attribute((section(".ram")))&lt;/FONT&gt; to&amp;nbsp; &lt;FONT face="andale mono,times"&gt;pSSDConfig-&amp;gt;Callback&lt;FONT face="arial,helvetica,sans-serif"&gt; in RAM and finding it to have no effect.&amp;nbsp;Because the &lt;FONT face="andale mono,times"&gt;IBUSERR&lt;/FONT&gt; still occurred I removed the &lt;/FONT&gt;__attribute&lt;FONT face="arial,helvetica,sans-serif"&gt;.&lt;BR /&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="andale mono,times"&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;Yesterday I again placed &lt;FONT face="andale mono,times"&gt;pSSDConfig-&amp;gt;Callback&lt;/FONT&gt; in RAM. This time I used &lt;FONT face="andale mono,times"&gt;readelf &lt;FONT face="arial,helvetica,sans-serif"&gt;to check that the function was in fact placed in RAM. I found that it was not, and&lt;/FONT&gt;&lt;/FONT&gt; that my linker script had no &lt;FONT face="andale mono,times"&gt;.ram&lt;/FONT&gt; section. In that particular linker script it was called &lt;FONT face="andale mono,times"&gt;.code_ram&lt;/FONT&gt;. &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="andale mono,times"&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;I applied &lt;FONT face="andale mono,times"&gt;__attribute((section(".code_ram")))&lt;/FONT&gt; and confirmed that the function was relocated. It is likely that I never actually relocated the function during the troubleshooting of &lt;STRONG&gt;Problem 1.&lt;/STRONG&gt;&lt;BR /&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="andale mono,times"&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;I'm now able to do an A-B test by removing &lt;FONT face="andale mono,times"&gt;__attribute((section(".code_ram")))&lt;/FONT&gt; from &lt;FONT face="andale mono,times"&gt;pSSDConfig-&amp;gt;Callback&lt;/FONT&gt; and observing an intermittent &lt;FONT face="andale mono,times"&gt;IBUSERR&lt;/FONT&gt;. It doesn't occur on every flash operation.&lt;BR /&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;There still remains an issue where &lt;FONT face="andale mono,times"&gt;FLASH_DRV_VerifySection(...)&lt;/FONT&gt; occasionally returns &lt;FONT face="andale mono,times"&gt;STATUS_ERROR&lt;/FONT&gt;. I will proceed under the assumption that this is not related to the issue described in this thread.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Summary&lt;/STRONG&gt;:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;the GCC ld flag &lt;FONT face="andale mono,times"&gt;-orphan-handling=error&lt;/FONT&gt; may be able to warn about nonexistent linker file sections, although it may not yet be supported in &lt;FONT face="andale mono,times"&gt;arm-none-eabi-gcc&lt;/FONT&gt;&lt;/LI&gt;&lt;LI&gt;the GCC flag &lt;FONT face="andale mono,times"&gt;-Wframe-larger-than=1024&lt;/FONT&gt; may be used to warn about large variables on the stack&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;Thanks also Lukas for your note on how to find the root cause of an &lt;FONT face="andale mono,times"&gt;IBUSERR.&lt;FONT face="arial,helvetica,sans-serif"&gt; I will return to it in future.&lt;/FONT&gt;&lt;BR /&gt;&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 21 May 2022 04:31:31 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S32K/access-to-static-variable-in-RAM-by-flash-peripheral-results-in/m-p/1461896#M15581</guid>
      <dc:creator>driftregion</dc:creator>
      <dc:date>2022-05-21T04:31:31Z</dc:date>
    </item>
  </channel>
</rss>

