<?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 S32G274A-M7 DTCM and Cache interaction in S32G</title>
    <link>https://community.nxp.com/t5/S32G/S32G274A-M7-DTCM-and-Cache-interaction/m-p/2136090#M14165</link>
    <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I'm investigating a strange bug that makes some function calls on the M7 core to spike from ~3us to up to 2ms (according to the measurements using the tracing module)&lt;/P&gt;&lt;P&gt;I disabled Data Cache (for testing) and it seems to make the issue go away, which got me thinking this might be a cache coherency issue ?&lt;/P&gt;&lt;P&gt;After digging a little bit more I noticed that the DTCM is used as a stack for each of the M7 cores, and the MPU region for it was set as cacheable - bufferable , which I think should not be the case ? I disabled the cache in the MPU entry, when I did that I started getting alignment exceptions (all from DTCM).&lt;/P&gt;&lt;P&gt;My question is, why cache as an effect on DTCM even if they are not sharing the same bus ?&lt;/P&gt;&lt;P&gt;Why having the DTCM MPU region set as cache-on masks the unaligned access errors ?&lt;/P&gt;&lt;P&gt;Also is it okay to use the DTCM for the stack? as GCC generates unaligned access instructions to the TCM memory.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you&lt;/P&gt;</description>
    <pubDate>Thu, 17 Jul 2025 23:30:26 GMT</pubDate>
    <dc:creator>nakrachi</dc:creator>
    <dc:date>2025-07-17T23:30:26Z</dc:date>
    <item>
      <title>S32G274A-M7 DTCM and Cache interaction</title>
      <link>https://community.nxp.com/t5/S32G/S32G274A-M7-DTCM-and-Cache-interaction/m-p/2136090#M14165</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I'm investigating a strange bug that makes some function calls on the M7 core to spike from ~3us to up to 2ms (according to the measurements using the tracing module)&lt;/P&gt;&lt;P&gt;I disabled Data Cache (for testing) and it seems to make the issue go away, which got me thinking this might be a cache coherency issue ?&lt;/P&gt;&lt;P&gt;After digging a little bit more I noticed that the DTCM is used as a stack for each of the M7 cores, and the MPU region for it was set as cacheable - bufferable , which I think should not be the case ? I disabled the cache in the MPU entry, when I did that I started getting alignment exceptions (all from DTCM).&lt;/P&gt;&lt;P&gt;My question is, why cache as an effect on DTCM even if they are not sharing the same bus ?&lt;/P&gt;&lt;P&gt;Why having the DTCM MPU region set as cache-on masks the unaligned access errors ?&lt;/P&gt;&lt;P&gt;Also is it okay to use the DTCM for the stack? as GCC generates unaligned access instructions to the TCM memory.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you&lt;/P&gt;</description>
      <pubDate>Thu, 17 Jul 2025 23:30:26 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S32G/S32G274A-M7-DTCM-and-Cache-interaction/m-p/2136090#M14165</guid>
      <dc:creator>nakrachi</dc:creator>
      <dc:date>2025-07-17T23:30:26Z</dc:date>
    </item>
    <item>
      <title>Re: S32G274A-M7 DTCM and Cache interaction</title>
      <link>https://community.nxp.com/t5/S32G/S32G274A-M7-DTCM-and-Cache-interaction/m-p/2136512#M14172</link>
      <description>&lt;P&gt;hi,&lt;SPAN&gt;nakrachi&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;Thank you for your question.&lt;/P&gt;
&lt;P&gt;are you using the S32G2 on the multi-core? Do you use any demo and code for testing?&lt;/P&gt;
&lt;P&gt;Could you share more information for us?&lt;/P&gt;
&lt;P&gt;BR&lt;/P&gt;
&lt;P&gt;Joey&lt;/P&gt;</description>
      <pubDate>Fri, 18 Jul 2025 10:37:41 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S32G/S32G274A-M7-DTCM-and-Cache-interaction/m-p/2136512#M14172</guid>
      <dc:creator>Joey_z</dc:creator>
      <dc:date>2025-07-18T10:37:41Z</dc:date>
    </item>
    <item>
      <title>Re: S32G274A-M7 DTCM and Cache interaction</title>
      <link>https://community.nxp.com/t5/S32G/S32G274A-M7-DTCM-and-Cache-interaction/m-p/2136537#M14175</link>
      <description>&lt;P&gt;Hi Joey!&lt;/P&gt;&lt;P&gt;I am using the S32G2 in multi-core, the A53 are running Linux, and the M7 have a custom baremetal running on them.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Unfortunately I cannot share the code, but I can try to explain in detail what I am noticing.&amp;nbsp;&lt;/P&gt;&lt;P&gt;The MPU entry for the DTCM was "mistakenly" set to cacheable, when I did set it to cacheable I started seeing unaligned access exceptions, after looking into the assembly, GCC was indeed generating unaligned word access on the DTCM (used as stack).&amp;nbsp;&lt;/P&gt;&lt;P&gt;I then added&amp;nbsp;&lt;EM&gt;-mno-unaligned-access&amp;nbsp;&lt;/EM&gt;to my gcc options and now I can set the DTCM MPU region to uncacheable without generating any exceptions.&amp;nbsp;&lt;/P&gt;&lt;P&gt;It also seems to solve the bug I was after, trace data showed no spikes in function execution time.&amp;nbsp;&lt;/P&gt;&lt;P&gt;But I am still puzzled by the effect of cache on the DTCM,&amp;nbsp;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Why having the MPU region set to cacheable "masks" the unaligned access exceptions ?&lt;/LI&gt;&lt;LI&gt;Why disabling the cache, while keeping the MPU region as cacheable does not generate unaligned exceptions? and also as side effect, solve the execution time spikes?&amp;nbsp;&lt;/LI&gt;&lt;/UL&gt;</description>
      <pubDate>Fri, 18 Jul 2025 11:27:48 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S32G/S32G274A-M7-DTCM-and-Cache-interaction/m-p/2136537#M14175</guid>
      <dc:creator>nakrachi</dc:creator>
      <dc:date>2025-07-18T11:27:48Z</dc:date>
    </item>
    <item>
      <title>Re: S32G274A-M7 DTCM and Cache interaction</title>
      <link>https://community.nxp.com/t5/S32G/S32G274A-M7-DTCM-and-Cache-interaction/m-p/2137862#M14197</link>
      <description>&lt;P&gt;hi,&amp;nbsp;&lt;SPAN&gt;nakrachi&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;Thank you for your reply.&lt;/P&gt;
&lt;P&gt;I'm glad to hear that your problem has been solved. This issue should be caused by incompatibility between the MCU and MPU in setting the DTCM area.&lt;/P&gt;
&lt;P&gt;BR&lt;/P&gt;
&lt;P&gt;Joey&lt;/P&gt;</description>
      <pubDate>Tue, 22 Jul 2025 02:39:54 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S32G/S32G274A-M7-DTCM-and-Cache-interaction/m-p/2137862#M14197</guid>
      <dc:creator>Joey_z</dc:creator>
      <dc:date>2025-07-22T02:39:54Z</dc:date>
    </item>
  </channel>
</rss>

