.elf loader for M4 core. How to load an ".elf file"?

I found a loader for “.bin” files in oreder to load a bin file in to M4 TCM memory /OCRAM.

But how to load a .elf in to it?
How to load an “.elf” file instead?

Hi

m4fwloader is for binary file. Provided your elf is “single sectioner” (contiguous memory area for text and variable initializers sections), you may convert it from elf to bin with objdump.

1 Like

Thanks edward for your kind reply.
The issue is that indeed, it is not a single section. THe code is larger than 32KB (TCMem) and I must used OCRAM thanks to the code parameter

 __attribute__ ((section (".ocram_text")));

This is why I need to load an .elf file. But I didn’t find yet a proper loader.

Hi @Edge,

Moving all the code to OCRAM could again make your binary m4fwloader friendly.

You should make sure that GCC optimizes away unused code functions. It is not done by default. -ffunction-sections compiler switch makes function placed each to new section, then --gc-sections linker switch allows removing unused sections.

For ELF you should either stick to U-Boot’s bootaux command (the way suggested in Toradex Knowledge Base here) or try Linux remoteproc driver.
Remoteproc seems being not listed in KB. Perhaps this thread may help you. Seach on NXP iMX forums may help as well.