<?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: i.MX93 M33 Can't Use System TCM RAM for Allocation in i.MX Processors</title>
    <link>https://community.nxp.com/t5/i-MX-Processors/i-MX93-M33-Can-t-Use-System-TCM-RAM-for-Allocation/m-p/2414472#M246765</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/264983"&gt;@jcolebaker&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can choose to change the LMA for data/bss/heap/stack to System TCM. In the MCUX linker script, change the load address (AT) for the data segment from code TCM to System TCM, so that PhysAddr also falls at 0x2000_0000:&lt;/P&gt;
&lt;LI-CODE lang="c"&gt;.data : { ... } &amp;gt; m_data AT&amp;gt; m_data /* Do not use AT&amp;gt; m_text */
.bss : { ... } &amp;gt; m_data&lt;/LI-CODE&gt;
&lt;P&gt;&lt;BR /&gt;When LMA == VMA and both are in System TCM, PhysAddr becomes 0x2000_xxxx, which matches an entry in the {0x20000000, …, 0x00040000} (256 KB) range in remoteproc driver, allowing remoteproc to translate correctly.&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;Best Regards,&lt;BR /&gt;Zhiming&lt;/P&gt;</description>
    <pubDate>Fri, 18 Sep 2026 05:43:30 GMT</pubDate>
    <dc:creator>Zhiming_Liu</dc:creator>
    <dc:date>2026-09-18T05:43:30Z</dc:date>
    <item>
      <title>i.MX93 M33 Can't Use System TCM RAM for Allocation</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/i-MX93-M33-Can-t-Use-System-TCM-RAM-for-Allocation/m-p/2414422#M246762</link>
      <description>&lt;P&gt;We're evaluating the i.MX9352 for an IoT device. I've created an application for the M33 core for time-critical IO operations which include collecting a large number of samples from peripherals. For development purposes, I am loading and starting the M33 code from Linux with remoteproc. Code is written in C and using MPUXpresso 26.06.00 SDK.&lt;/P&gt;&lt;P&gt;I got the code working well, but now I need a large buffer for samples (~24 kB). I have tried adding this as either a static array or heap allocated with `malloc`. In either case, I seem to tun out of RAM even though the compile output indicates there is plenty.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Working Version:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Here's the memory information for a build with a small buffer, which **works OK** (but the buffer is too small for our requirements).&lt;/P&gt;&lt;LI-CODE lang="c"&gt;Memory region         Used Size  Region Size  %age Used
    m_interrupts:        1140 B       1144 B     99.65%
          m_text:       78300 B     129928 B     60.26%
m_m33_suspend_ram:           0 B         8 KB      0.00%
m_a55_suspend_ram:           0 B         4 KB      0.00%
          m_data:       48016 B       108 KB     43.42%
       m_rsc_tbl:           0 B         4 KB      0.00%
build finished successfully.&lt;/LI-CODE&gt;&lt;P&gt;&lt;BR /&gt;Here is some info from the ELF file:&lt;/P&gt;&lt;LI-CODE lang="c"&gt;readelf -l imx_m33.elf

Elf file type is EXEC (Executable file)
Entry point 0xffe0595
There are 4 program headers, starting at offset 52

Program Headers:
  Type           Offset   VirtAddr   PhysAddr   FileSiz MemSiz  Flg Align
  LOAD           0x001000 0x0ffe0000 0x0ffe0000 0x00474 0x00474 R   0x1000
  LOAD           0x001478 0x0ffe0478 0x0ffe0478 0x131dc 0x131dc RWE 0x1000
  LOAD           0x015000 0x20003000 0x0fff3654 0x00170 0x00170 RW  0x1000
  LOAD           0x000180 0x20003180 0x0fff37e0 0x00000 0x0ba10 RW  0x1000

 Section to Segment mapping:
  Segment Sections...
   00     .interrupts
   01     .resource_table .text .ARM .init_array .fini_array
   02     .data
   03     .bss .heap .stack&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Large Static Allocation:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Here's the memory and ELF file info for a build with a **24 kB static allocated buffer**.&lt;/P&gt;&lt;P&gt;I.e.:&lt;/P&gt;&lt;LI-CODE lang="c"&gt;static uint32_t m_sample_queue[SAMPLE_QUEUE_LENGTH]; // SAMPLE_QUEUE_LENGTH = 6000&lt;/LI-CODE&gt;&lt;LI-CODE lang="markup"&gt;Memory region         Used Size  Region Size  %age Used
    m_interrupts:        1140 B       1144 B     99.65%
          m_text:       78240 B     129928 B     60.22%
m_m33_suspend_ram:           0 B         8 KB      0.00%
m_a55_suspend_ram:           0 B         4 KB      0.00%
          m_data:       72016 B       108 KB     65.12%
       m_rsc_tbl:           0 B         4 KB      0.00%
build finished successfully.

### (As expected, the `m_data` section has increased in size.) ###

readelf -l imx_m33.elf

Elf file type is EXEC (Executable file)
Entry point 0xffe0595
There are 4 program headers, starting at offset 52

Program Headers:
  Type           Offset   VirtAddr   PhysAddr   FileSiz MemSiz  Flg Align
  LOAD           0x001000 0x0ffe0000 0x0ffe0000 0x00474 0x00474 R   0x1000
  LOAD           0x001478 0x0ffe0478 0x0ffe0478 0x131a0 0x131a0 RWE 0x1000
  LOAD           0x015000 0x20003000 0x0fff3618 0x00170 0x00170 RW  0x1000
  LOAD           0x000180 0x20003180 0x0fff37a0 0x00000 0x117d0 RW  0x1000

 Section to Segment mapping:
  Segment Sections...
   00     .interrupts
   01     .resource_table .text .ARM .init_array .fini_array
   02     .data
   03     .bss .heap .stack&lt;/LI-CODE&gt;&lt;P&gt;When I try to start this version in Linux with remoteproc, it fails to start and dmesg shows the following errors:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;[ +0.001258] imx-rproc remoteproc-cm33: Translation failed: da = 0xfff37a0 len = 0x117d0
[ +0.000021] remoteproc remoteproc0: bad phdr da 0xfff37a0 mem 0x117d0
[ +0.000006] remoteproc remoteproc0: Failed to load program segments: -22
[ +0.008868] remoteproc remoteproc0: Boot failed: -22&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Claude tells me this is a problem with the &lt;STRONG&gt;.bss .heap .stack&lt;/STRONG&gt; section, because the PhysAddr is `0x0fff37a0` and the size is now `0x117d0`. `0x0fff37a0 + 0x117d0 = 0x10004f70` which exceeds the M33 Code TCM address range &lt;STRONG&gt;0x0ffe0000 .. 0x10000000&lt;/STRONG&gt;. The explaination was confusing but my interpretation is that the static initialisation has to go into the "code" section, causing it to overflow even though there is plenty of space in the "system" TCM range (the other 128 kB). So maybe this makes sense.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Dynamic (Heap) Allocation:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;E.g.:&lt;/P&gt;&lt;LI-CODE lang="c"&gt;uint32_t *p_sample_queue = malloc(SAMPLE_QUEUE_LENGTH, sizeof(uint32_t));&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The default heap size available to C is only 1 kB, so &lt;STRONG&gt;malloc&lt;/STRONG&gt; fails with our large buffer.&lt;/P&gt;&lt;P&gt;I modified the CMake for the project to allocate a larger heap (32 kB) via &lt;STRONG&gt;__heap_size__&amp;nbsp;&lt;/STRONG&gt;which feeds into the linker script:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;mcux_add_linker_symbol(
    SYMBOLS "__stack_size__=0x400 \
             __heap_size__=0x8000 \   &amp;lt;---- Added
             __use_shmem__=1 \
             __multicore__=1 \
            "
)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Build output and ELF file info:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Memory region         Used Size  Region Size  %age Used
    m_interrupts:        1140 B       1144 B     99.65%
          m_text:       78240 B     129928 B     60.22%
m_m33_suspend_ram:           0 B         8 KB      0.00%
m_a55_suspend_ram:           0 B         4 KB      0.00%
          m_data:      103760 B       108 KB     93.82%
       m_rsc_tbl:           0 B         4 KB      0.00%
build finished successfully.

#### ELF file info: ####
readelf -l imx_m33.elf

Elf file type is EXEC (Executable file)
Entry point 0xffe0595
There are 4 program headers, starting at offset 52

Program Headers:
  Type           Offset   VirtAddr   PhysAddr   FileSiz MemSiz  Flg Align
  LOAD           0x001000 0x0ffe0000 0x0ffe0000 0x00474 0x00474 R   0x1000
  LOAD           0x001478 0x0ffe0478 0x0ffe0478 0x131a0 0x131a0 RWE 0x1000
  LOAD           0x015000 0x20003000 0x0fff3618 0x00170 0x00170 RW  0x1000
  LOAD           0x000180 0x20003180 0x0fff37a0 0x00000 0x193d0 RW  0x1000

 Section to Segment mapping:
  Segment Sections...
   00     .interrupts
   01     .resource_table .text .ARM .init_array .fini_array
   02     .data
   03     .bss .heap .stack&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This seems to make the problem WORSE, not better (.bss/.heap/.stack at PhysAddr 0x0fff37a0, size 0x193d0).&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;[ +0.001320] imx-rproc remoteproc-cm33: Translation failed: da = 0xfff37a0 len = 0x193d0
[ +0.000019] remoteproc remoteproc0: bad phdr da 0xfff37a0 mem 0x193d0
[ +0.000006] remoteproc remoteproc0: Failed to load program segments: -22
[ +0.002908] remoteproc remoteproc0: Boot failed: -22&lt;/LI-CODE&gt;&lt;P&gt;I thought using heap allocation should allow the code section to be smaller and allocate the memory from the data section. The "m_data" section shown in the build output above is indeed bigger.&lt;/P&gt;&lt;P&gt;I don't really understand the "PhysAddr", which matches the "Code TCM" range from the ref manual, even for things which should be in the "System TCM" region (I think?). The addresses under "VirtAddr" seem correct.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Why does the ELF file still try to place this .bss/.heap/.stack data at PhysAddr 0x0fff37a0, why is it so big when using runtime heap allocation, and is there a way to allocate my large buffer in the "System TCM" region?&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 17 Sep 2026 22:12:25 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/i-MX93-M33-Can-t-Use-System-TCM-RAM-for-Allocation/m-p/2414422#M246762</guid>
      <dc:creator>jcolebaker</dc:creator>
      <dc:date>2026-09-17T22:12:25Z</dc:date>
    </item>
    <item>
      <title>Re: i.MX93 M33 Can't Use System TCM RAM for Allocation</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/i-MX93-M33-Can-t-Use-System-TCM-RAM-for-Allocation/m-p/2414472#M246765</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/264983"&gt;@jcolebaker&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can choose to change the LMA for data/bss/heap/stack to System TCM. In the MCUX linker script, change the load address (AT) for the data segment from code TCM to System TCM, so that PhysAddr also falls at 0x2000_0000:&lt;/P&gt;
&lt;LI-CODE lang="c"&gt;.data : { ... } &amp;gt; m_data AT&amp;gt; m_data /* Do not use AT&amp;gt; m_text */
.bss : { ... } &amp;gt; m_data&lt;/LI-CODE&gt;
&lt;P&gt;&lt;BR /&gt;When LMA == VMA and both are in System TCM, PhysAddr becomes 0x2000_xxxx, which matches an entry in the {0x20000000, …, 0x00040000} (256 KB) range in remoteproc driver, allowing remoteproc to translate correctly.&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;Best Regards,&lt;BR /&gt;Zhiming&lt;/P&gt;</description>
      <pubDate>Fri, 18 Sep 2026 05:43:30 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/i-MX93-M33-Can-t-Use-System-TCM-RAM-for-Allocation/m-p/2414472#M246765</guid>
      <dc:creator>Zhiming_Liu</dc:creator>
      <dc:date>2026-09-18T05:43:30Z</dc:date>
    </item>
    <item>
      <title>Re: i.MX93 M33 Can't Use System TCM RAM for Allocation</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/i-MX93-M33-Can-t-Use-System-TCM-RAM-for-Allocation/m-p/2414812#M246780</link>
      <description>&lt;P&gt;Thanks, that did it!&lt;BR /&gt;&lt;BR /&gt;Note, the main segment I needed to move in order to use a much larger heap was the "heap" segment:&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;.heap : { ... } &amp;gt; m_data AT&amp;gt; m_data&lt;/LI-CODE&gt;</description>
      <pubDate>Sun, 20 Sep 2026 20:25:13 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/i-MX93-M33-Can-t-Use-System-TCM-RAM-for-Allocation/m-p/2414812#M246780</guid>
      <dc:creator>jcolebaker</dc:creator>
      <dc:date>2026-09-20T20:25:13Z</dc:date>
    </item>
  </channel>
</rss>

