Linux TCM memory


I’m developing a Fw for the CM4 core in the iMX7 and for that I’m using the tool imx-m4fwloader (version 1.05).

It works very well and make the development a lot faster since I don’t need to do the upload via u-boot or reset the board.
When loading int OCRAM I have no problems, but when loading into TCM I’m restricted to the lower 32KB.

Analysing the source code I saw that this limit is hard coded in the program and I tried to change it from 32Kb to 64Kb, but then, the program crashes.
It does a mmap into the start of TCML but it raises the core dump after trying to memcpy more than 32Kb of data.

So, I decided to take a look at the dts for the board and I noticed that it defines only the lower memory

m4_tcm: tcml@007f8000 {
	compatible = "fsl, m4_tcml";
	reg = <0x007f8000 0x8000>;

I’m no expert in linux or Device tree,

So, my question is: Is it a bug? Is the definition of TCMU missing? If so, how can I add it?
If it’s not a bug, why is it missing? and how can I access that memory via Linux?
Loading the code via U-boot works.

Is there any other tools to accomplish the same result?

Thanks, Mauricio Scaff

hi @mscaff and Welcome to the Toradex Community!

So, my question is: Is it a bug? Is the definition of TCMU missing? If so, how can I add it?

Actually usually TCML holds the application code and TCMU the data. TCMU and TCML are also two different memory locations accessed by different buses from A7-core.

Being that said, you could try to add the missing TCMU seperately in the devicetree as this:

 m4_tcm2: tcmu@00800000 {
     compatible = "fsl, m4_tcml";
     reg = <0x00800000 0x8000>;

Concerning the imx-m4fwloader, you should try to memcopy to two blocks of 32 KB instead of one block of 64KB, since the hardware will have to access the different memory ranges using different buses. So either you can change the code of the imx4-downloader or split your firmware in two different blocks.

Best regards,

I’ll try to use that area as 2 different regions and see what happens.

Thanks, Mauricio

Ok, Let us know your results.