i.MX93 M33 Can't Use System TCM RAM for Allocation

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

i.MX93 M33 Can't Use System TCM RAM for Allocation

Jump to solution
138 Views
jcolebaker
Contributor II

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.

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.

Working Version:

Here's the memory information for a build with a small buffer, which **works OK** (but the buffer is too small for our requirements).

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.


Here is some info from the ELF file:

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

 

Large Static Allocation:

Here's the memory and ELF file info for a build with a **24 kB static allocated buffer**.

I.e.:

static uint32_t m_sample_queue[SAMPLE_QUEUE_LENGTH]; // SAMPLE_QUEUE_LENGTH = 6000
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

When I try to start this version in Linux with remoteproc, it fails to start and dmesg shows the following errors:

[ +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

 

Claude tells me this is a problem with the .bss .heap .stack section, because the PhysAddr is `0x0fff37a0` and the size is now `0x117d0`. `0x0fff37a0 + 0x117d0 = 0x10004f70` which exceeds the M33 Code TCM address range 0x0ffe0000 .. 0x10000000. 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.

Dynamic (Heap) Allocation:

E.g.:

uint32_t *p_sample_queue = malloc(SAMPLE_QUEUE_LENGTH, sizeof(uint32_t));

 

The default heap size available to C is only 1 kB, so malloc fails with our large buffer.

I modified the CMake for the project to allocate a larger heap (32 kB) via __heap_size__ which feeds into the linker script:

mcux_add_linker_symbol(
    SYMBOLS "__stack_size__=0x400 \
             __heap_size__=0x8000 \   <---- Added
             __use_shmem__=1 \
             __multicore__=1 \
            "
)

 

Build output and ELF file info:

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

 

This seems to make the problem WORSE, not better (.bss/.heap/.stack at PhysAddr 0x0fff37a0, size 0x193d0).

[ +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

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.

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.

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?

 

0 Kudos
Reply
1 Solution
101 Views
Zhiming_Liu
NXP TechSupport
NXP TechSupport

Hi @jcolebaker 

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:

.data : { ... } > m_data AT> m_data /* Do not use AT> m_text */
.bss : { ... } > m_data


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.



Best Regards,
Zhiming

View solution in original post

2 Replies
102 Views
Zhiming_Liu
NXP TechSupport
NXP TechSupport

Hi @jcolebaker 

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:

.data : { ... } > m_data AT> m_data /* Do not use AT> m_text */
.bss : { ... } > m_data


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.



Best Regards,
Zhiming

70 Views
jcolebaker
Contributor II

Thanks, that did it!

Note, the main segment I needed to move in order to use a much larger heap was the "heap" segment: 

.heap : { ... } > m_data AT> m_data
Tags (2)
0 Kudos
Reply
%3CLINGO-SUB%20id%3D%22lingo-sub-2414422%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3Ei.MX93%20M33%20Can't%20Use%20System%20TCM%20RAM%20for%20Allocation%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2414422%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EWe're%20evaluating%20the%20i.MX9352%20for%20an%20IoT%20device.%20I've%20created%20an%20application%20for%20the%20M33%20core%20for%20time-critical%20IO%20operations%20which%20include%20collecting%20a%20large%20number%20of%20samples%20from%20peripherals.%20For%20development%20purposes%2C%20I%20am%20loading%20and%20starting%20the%20M33%20code%20from%20Linux%20with%20remoteproc.%20Code%20is%20written%20in%20C%20and%20using%20MPUXpresso%2026.06.00%20SDK.%3C%2FP%3E%3CP%3EI%20got%20the%20code%20working%20well%2C%20but%20now%20I%20need%20a%20large%20buffer%20for%20samples%20(~24%20kB).%20I%20have%20tried%20adding%20this%20as%20either%20a%20static%20array%20or%20heap%20allocated%20with%20%60malloc%60.%20In%20either%20case%2C%20I%20seem%20to%20tun%20out%20of%20RAM%20even%20though%20the%20compile%20output%20indicates%20there%20is%20plenty.%3C%2FP%3E%3CP%3E%3CSTRONG%3EWorking%20Version%3A%3C%2FSTRONG%3E%3C%2FP%3E%3CP%3EHere's%20the%20memory%20information%20for%20a%20build%20with%20a%20small%20buffer%2C%20which%20**works%20OK**%20(but%20the%20buffer%20is%20too%20small%20for%20our%20requirements).%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-c%22%3E%3CCODE%3EMemory%20region%20%20%20%20%20%20%20%20%20Used%20Size%20%20Region%20Size%20%20%25age%20Used%0A%20%20%20%20m_interrupts%3A%20%20%20%20%20%20%20%201140%20B%20%20%20%20%20%20%201144%20B%20%20%20%20%2099.65%25%0A%20%20%20%20%20%20%20%20%20%20m_text%3A%20%20%20%20%20%20%2078300%20B%20%20%20%20%20129928%20B%20%20%20%20%2060.26%25%0Am_m33_suspend_ram%3A%20%20%20%20%20%20%20%20%20%20%200%20B%20%20%20%20%20%20%20%20%208%20KB%20%20%20%20%20%200.00%25%0Am_a55_suspend_ram%3A%20%20%20%20%20%20%20%20%20%20%200%20B%20%20%20%20%20%20%20%20%204%20KB%20%20%20%20%20%200.00%25%0A%20%20%20%20%20%20%20%20%20%20m_data%3A%20%20%20%20%20%20%2048016%20B%20%20%20%20%20%20%20108%20KB%20%20%20%20%2043.42%25%0A%20%20%20%20%20%20%20m_rsc_tbl%3A%20%20%20%20%20%20%20%20%20%20%200%20B%20%20%20%20%20%20%20%20%204%20KB%20%20%20%20%20%200.00%25%0Abuild%20finished%20successfully.%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3E%3CBR%20%2F%3EHere%20is%20some%20info%20from%20the%20ELF%20file%3A%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-c%22%3E%3CCODE%3Ereadelf%20-l%20imx_m33.elf%0A%0AElf%20file%20type%20is%20EXEC%20(Executable%20file)%0AEntry%20point%200xffe0595%0AThere%20are%204%20program%20headers%2C%20starting%20at%20offset%2052%0A%0AProgram%20Headers%3A%0A%20%20Type%20%20%20%20%20%20%20%20%20%20%20Offset%20%20%20VirtAddr%20%20%20PhysAddr%20%20%20FileSiz%20MemSiz%20%20Flg%20Align%0A%20%20LOAD%20%20%20%20%20%20%20%20%20%20%200x001000%200x0ffe0000%200x0ffe0000%200x00474%200x00474%20R%20%20%200x1000%0A%20%20LOAD%20%20%20%20%20%20%20%20%20%20%200x001478%200x0ffe0478%200x0ffe0478%200x131dc%200x131dc%20RWE%200x1000%0A%20%20LOAD%20%20%20%20%20%20%20%20%20%20%200x015000%200x20003000%200x0fff3654%200x00170%200x00170%20RW%20%200x1000%0A%20%20LOAD%20%20%20%20%20%20%20%20%20%20%200x000180%200x20003180%200x0fff37e0%200x00000%200x0ba10%20RW%20%200x1000%0A%0A%20Section%20to%20Segment%20mapping%3A%0A%20%20Segment%20Sections...%0A%20%20%2000%20%20%20%20%20.interrupts%0A%20%20%2001%20%20%20%20%20.resource_table%20.text%20.ARM%20.init_array%20.fini_array%0A%20%20%2002%20%20%20%20%20.data%0A%20%20%2003%20%20%20%20%20.bss%20.heap%20.stack%3C%2FCODE%3E%3C%2FPRE%3E%3CBR%20%2F%3E%3CP%3E%3CSTRONG%3ELarge%20Static%20Allocation%3A%3C%2FSTRONG%3E%3C%2FP%3E%3CP%3EHere's%20the%20memory%20and%20ELF%20file%20info%20for%20a%20build%20with%20a%20**24%20kB%20static%20allocated%20buffer**.%3C%2FP%3E%3CP%3EI.e.%3A%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-c%22%3E%3CCODE%3Estatic%20uint32_t%20m_sample_queue%5BSAMPLE_QUEUE_LENGTH%5D%3B%20%2F%2F%20SAMPLE_QUEUE_LENGTH%20%3D%206000%3C%2FCODE%3E%3C%2FPRE%3E%3CPRE%20class%3D%22lia-code-sample%20language-markup%22%3E%3CCODE%3EMemory%20region%20%20%20%20%20%20%20%20%20Used%20Size%20%20Region%20Size%20%20%25age%20Used%0A%20%20%20%20m_interrupts%3A%20%20%20%20%20%20%20%201140%20B%20%20%20%20%20%20%201144%20B%20%20%20%20%2099.65%25%0A%20%20%20%20%20%20%20%20%20%20m_text%3A%20%20%20%20%20%20%2078240%20B%20%20%20%20%20129928%20B%20%20%20%20%2060.22%25%0Am_m33_suspend_ram%3A%20%20%20%20%20%20%20%20%20%20%200%20B%20%20%20%20%20%20%20%20%208%20KB%20%20%20%20%20%200.00%25%0Am_a55_suspend_ram%3A%20%20%20%20%20%20%20%20%20%20%200%20B%20%20%20%20%20%20%20%20%204%20KB%20%20%20%20%20%200.00%25%0A%20%20%20%20%20%20%20%20%20%20m_data%3A%20%20%20%20%20%20%2072016%20B%20%20%20%20%20%20%20108%20KB%20%20%20%20%2065.12%25%0A%20%20%20%20%20%20%20m_rsc_tbl%3A%20%20%20%20%20%20%20%20%20%20%200%20B%20%20%20%20%20%20%20%20%204%20KB%20%20%20%20%20%200.00%25%0Abuild%20finished%20successfully.%0A%0A%23%23%23%20(As%20expected%2C%20the%20%60m_data%60%20section%20has%20increased%20in%20size.)%20%23%23%23%0A%0Areadelf%20-l%20imx_m33.elf%0A%0AElf%20file%20type%20is%20EXEC%20(Executable%20file)%0AEntry%20point%200xffe0595%0AThere%20are%204%20program%20headers%2C%20starting%20at%20offset%2052%0A%0AProgram%20Headers%3A%0A%20%20Type%20%20%20%20%20%20%20%20%20%20%20Offset%20%20%20VirtAddr%20%20%20PhysAddr%20%20%20FileSiz%20MemSiz%20%20Flg%20Align%0A%20%20LOAD%20%20%20%20%20%20%20%20%20%20%200x001000%200x0ffe0000%200x0ffe0000%200x00474%200x00474%20R%20%20%200x1000%0A%20%20LOAD%20%20%20%20%20%20%20%20%20%20%200x001478%200x0ffe0478%200x0ffe0478%200x131a0%200x131a0%20RWE%200x1000%0A%20%20LOAD%20%20%20%20%20%20%20%20%20%20%200x015000%200x20003000%200x0fff3618%200x00170%200x00170%20RW%20%200x1000%0A%20%20LOAD%20%20%20%20%20%20%20%20%20%20%200x000180%200x20003180%200x0fff37a0%200x00000%200x117d0%20RW%20%200x1000%0A%0A%20Section%20to%20Segment%20mapping%3A%0A%20%20Segment%20Sections...%0A%20%20%2000%20%20%20%20%20.interrupts%0A%20%20%2001%20%20%20%20%20.resource_table%20.text%20.ARM%20.init_array%20.fini_array%0A%20%20%2002%20%20%20%20%20.data%0A%20%20%2003%20%20%20%20%20.bss%20.heap%20.stack%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3EWhen%20I%20try%20to%20start%20this%20version%20in%20Linux%20with%20remoteproc%2C%20it%20fails%20to%20start%20and%20dmesg%20shows%20the%20following%20errors%3A%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-markup%22%3E%3CCODE%3E%5B%20%2B0.001258%5D%20imx-rproc%20remoteproc-cm33%3A%20Translation%20failed%3A%20da%20%3D%200xfff37a0%20len%20%3D%200x117d0%0A%5B%20%2B0.000021%5D%20remoteproc%20remoteproc0%3A%20bad%20phdr%20da%200xfff37a0%20mem%200x117d0%0A%5B%20%2B0.000006%5D%20remoteproc%20remoteproc0%3A%20Failed%20to%20load%20program%20segments%3A%20-22%0A%5B%20%2B0.008868%5D%20remoteproc%20remoteproc0%3A%20Boot%20failed%3A%20-22%3C%2FCODE%3E%3C%2FPRE%3E%3CBR%20%2F%3E%3CP%3EClaude%20tells%20me%20this%20is%20a%20problem%20with%20the%20%3CSTRONG%3E.bss%20.heap%20.stack%3C%2FSTRONG%3E%20section%2C%20because%20the%20PhysAddr%20is%20%600x0fff37a0%60%20and%20the%20size%20is%20now%20%600x117d0%60.%20%600x0fff37a0%20%2B%200x117d0%20%3D%200x10004f70%60%20which%20exceeds%20the%20M33%20Code%20TCM%20address%20range%20%3CSTRONG%3E0x0ffe0000%20..%200x10000000%3C%2FSTRONG%3E.%20The%20explaination%20was%20confusing%20but%20my%20interpretation%20is%20that%20the%20static%20initialisation%20has%20to%20go%20into%20the%20%22code%22%20section%2C%20causing%20it%20to%20overflow%20even%20though%20there%20is%20plenty%20of%20space%20in%20the%20%22system%22%20TCM%20range%20(the%20other%20128%20kB).%20So%20maybe%20this%20makes%20sense.%3C%2FP%3E%3CP%3E%3CSTRONG%3EDynamic%20(Heap)%20Allocation%3A%3C%2FSTRONG%3E%3C%2FP%3E%3CP%3EE.g.%3A%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-c%22%3E%3CCODE%3Euint32_t%20*p_sample_queue%20%3D%20malloc(SAMPLE_QUEUE_LENGTH%2C%20sizeof(uint32_t))%3B%3C%2FCODE%3E%3C%2FPRE%3E%3CBR%20%2F%3E%3CP%3EThe%20default%20heap%20size%20available%20to%20C%20is%20only%201%20kB%2C%20so%20%3CSTRONG%3Emalloc%3C%2FSTRONG%3E%20fails%20with%20our%20large%20buffer.%3C%2FP%3E%3CP%3EI%20modified%20the%20CMake%20for%20the%20project%20to%20allocate%20a%20larger%20heap%20(32%20kB)%20via%20%3CSTRONG%3E__heap_size__%26nbsp%3B%3C%2FSTRONG%3Ewhich%20feeds%20into%20the%20linker%20script%3A%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-markup%22%3E%3CCODE%3Emcux_add_linker_symbol(%0A%20%20%20%20SYMBOLS%20%22__stack_size__%3D0x400%20%5C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20__heap_size__%3D0x8000%20%5C%20%20%20%26lt%3B----%20Added%0A%20%20%20%20%20%20%20%20%20%20%20%20%20__use_shmem__%3D1%20%5C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20__multicore__%3D1%20%5C%0A%20%20%20%20%20%20%20%20%20%20%20%20%22%0A)%3C%2FCODE%3E%3C%2FPRE%3E%3CBR%20%2F%3E%3CP%3EBuild%20output%20and%20ELF%20file%20info%3A%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-markup%22%3E%3CCODE%3EMemory%20region%20%20%20%20%20%20%20%20%20Used%20Size%20%20Region%20Size%20%20%25age%20Used%0A%20%20%20%20m_interrupts%3A%20%20%20%20%20%20%20%201140%20B%20%20%20%20%20%20%201144%20B%20%20%20%20%2099.65%25%0A%20%20%20%20%20%20%20%20%20%20m_text%3A%20%20%20%20%20%20%2078240%20B%20%20%20%20%20129928%20B%20%20%20%20%2060.22%25%0Am_m33_suspend_ram%3A%20%20%20%20%20%20%20%20%20%20%200%20B%20%20%20%20%20%20%20%20%208%20KB%20%20%20%20%20%200.00%25%0Am_a55_suspend_ram%3A%20%20%20%20%20%20%20%20%20%20%200%20B%20%20%20%20%20%20%20%20%204%20KB%20%20%20%20%20%200.00%25%0A%20%20%20%20%20%20%20%20%20%20m_data%3A%20%20%20%20%20%20103760%20B%20%20%20%20%20%20%20108%20KB%20%20%20%20%2093.82%25%0A%20%20%20%20%20%20%20m_rsc_tbl%3A%20%20%20%20%20%20%20%20%20%20%200%20B%20%20%20%20%20%20%20%20%204%20KB%20%20%20%20%20%200.00%25%0Abuild%20finished%20successfully.%0A%0A%23%23%23%23%20ELF%20file%20info%3A%20%23%23%23%23%0Areadelf%20-l%20imx_m33.elf%0A%0AElf%20file%20type%20is%20EXEC%20(Executable%20file)%0AEntry%20point%200xffe0595%0AThere%20are%204%20program%20headers%2C%20starting%20at%20offset%2052%0A%0AProgram%20Headers%3A%0A%20%20Type%20%20%20%20%20%20%20%20%20%20%20Offset%20%20%20VirtAddr%20%20%20PhysAddr%20%20%20FileSiz%20MemSiz%20%20Flg%20Align%0A%20%20LOAD%20%20%20%20%20%20%20%20%20%20%200x001000%200x0ffe0000%200x0ffe0000%200x00474%200x00474%20R%20%20%200x1000%0A%20%20LOAD%20%20%20%20%20%20%20%20%20%20%200x001478%200x0ffe0478%200x0ffe0478%200x131a0%200x131a0%20RWE%200x1000%0A%20%20LOAD%20%20%20%20%20%20%20%20%20%20%200x015000%200x20003000%200x0fff3618%200x00170%200x00170%20RW%20%200x1000%0A%20%20LOAD%20%20%20%20%20%20%20%20%20%20%200x000180%200x20003180%200x0fff37a0%200x00000%200x193d0%20RW%20%200x1000%0A%0A%20Section%20to%20Segment%20mapping%3A%0A%20%20Segment%20Sections...%0A%20%20%2000%20%20%20%20%20.interrupts%0A%20%20%2001%20%20%20%20%20.resource_table%20.text%20.ARM%20.init_array%20.fini_array%0A%20%20%2002%20%20%20%20%20.data%0A%20%20%2003%20%20%20%20%20.bss%20.heap%20.stack%3C%2FCODE%3E%3C%2FPRE%3E%3CBR%20%2F%3E%3CP%3EThis%20seems%20to%20make%20the%20problem%20WORSE%2C%20not%20better%20(.bss%2F.heap%2F.stack%20at%20PhysAddr%200x0fff37a0%2C%20size%200x193d0).%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-markup%22%3E%3CCODE%3E%5B%20%2B0.001320%5D%20imx-rproc%20remoteproc-cm33%3A%20Translation%20failed%3A%20da%20%3D%200xfff37a0%20len%20%3D%200x193d0%0A%5B%20%2B0.000019%5D%20remoteproc%20remoteproc0%3A%20bad%20phdr%20da%200xfff37a0%20mem%200x193d0%0A%5B%20%2B0.000006%5D%20remoteproc%20remoteproc0%3A%20Failed%20to%20load%20program%20segments%3A%20-22%0A%5B%20%2B0.002908%5D%20remoteproc%20remoteproc0%3A%20Boot%20failed%3A%20-22%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3EI%20thought%20using%20heap%20allocation%20should%20allow%20the%20code%20section%20to%20be%20smaller%20and%20allocate%20the%20memory%20from%20the%20data%20section.%20The%20%22m_data%22%20section%20shown%20in%20the%20build%20output%20above%20is%20indeed%20bigger.%3C%2FP%3E%3CP%3EI%20don't%20really%20understand%20the%20%22PhysAddr%22%2C%20which%20matches%20the%20%22Code%20TCM%22%20range%20from%20the%20ref%20manual%2C%20even%20for%20things%20which%20should%20be%20in%20the%20%22System%20TCM%22%20region%20(I%20think%3F).%20The%20addresses%20under%20%22VirtAddr%22%20seem%20correct.%3C%2FP%3E%3CP%3E%3CSTRONG%3EWhy%20does%20the%20ELF%20file%20still%20try%20to%20place%20this%20.bss%2F.heap%2F.stack%20data%20at%20PhysAddr%200x0fff37a0%2C%20why%20is%20it%20so%20big%20when%20using%20runtime%20heap%20allocation%2C%20and%20is%20there%20a%20way%20to%20allocate%20my%20large%20buffer%20in%20the%20%22System%20TCM%22%20region%3F%3C%2FSTRONG%3E%3C%2FP%3E%3CBR%20%2F%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2414472%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20i.MX93%20M33%20Can't%20Use%20System%20TCM%20RAM%20for%20Allocation%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2414472%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHi%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F264983%22%20target%3D%22_blank%22%3E%40jcolebaker%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EYou%20can%20choose%20to%20change%20the%20LMA%20for%20data%2Fbss%2Fheap%2Fstack%20to%20System%20TCM.%20In%20the%20MCUX%20linker%20script%2C%20change%20the%20load%20address%20(AT)%20for%20the%20data%20segment%20from%20code%20TCM%20to%20System%20TCM%2C%20so%20that%20PhysAddr%20also%20falls%20at%200x2000_0000%3A%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-c%22%3E%3CCODE%3E.data%20%3A%20%7B%20...%20%7D%20%26gt%3B%20m_data%20AT%26gt%3B%20m_data%20%2F*%20Do%20not%20use%20AT%26gt%3B%20m_text%20*%2F%0A.bss%20%3A%20%7B%20...%20%7D%20%26gt%3B%20m_data%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3E%3CBR%20%2F%3EWhen%20LMA%20%3D%3D%20VMA%20and%20both%20are%20in%20System%20TCM%2C%20PhysAddr%20becomes%200x2000_xxxx%2C%20which%20matches%20an%20entry%20in%20the%20%7B0x20000000%2C%20%E2%80%A6%2C%200x00040000%7D%20(256%20KB)%20range%20in%20remoteproc%20driver%2C%20allowing%20remoteproc%20to%20translate%20correctly.%3C%2FP%3E%0A%3CP%3E%3CBR%20%2F%3E%3CBR%20%2F%3EBest%20Regards%2C%3CBR%20%2F%3EZhiming%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2414812%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20i.MX93%20M33%20Can't%20Use%20System%20TCM%20RAM%20for%20Allocation%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2414812%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EThanks%2C%20that%20did%20it!%3CBR%20%2F%3E%3CBR%20%2F%3ENote%2C%20the%20main%20segment%20I%20needed%20to%20move%20in%20order%20to%20use%20a%20much%20larger%20heap%20was%20the%20%22heap%22%20segment%3A%26nbsp%3B%3CBR%20%2F%3E%3CBR%20%2F%3E%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-markup%22%3E%3CCODE%3E.heap%20%3A%20%7B%20...%20%7D%20%26gt%3B%20m_data%20AT%26gt%3B%20m_data%3C%2FCODE%3E%3C%2FPRE%3E%3C%2FLINGO-BODY%3E