Modbus doesn't work when LINK_FILE was changed to MCIMX7D_M4_ddr.ld

I had compiled a Modbus project,using UART B and load the bin file to ocram(0x910000), run

Colibri iMX7 #   ubi  part ubi 
Colibri iMX7 #   ubi write 0x910000 m4firmware  
Colibri iMX7 #   setenv m4boot 'ubi read 0x910000 m4firmware && dcache flush && bootaux 0x910000'
Colibri iMX7 #   setenv fdt_fixup 'fdt addr ${fdt_addr_r} && fdt rm /soc/aips-bus@30800000/spba-bus@30800000/serial@30890000 && fdt rm /soc/aips-bus@30800000/spba-bus@30800000/serial@30880000 && fdt rm /soc/aips-bus@30400000/adc@30610000'
Colibri iMX7 #  saveenv 

and then boot linux, It can communication with master station.

However, when LINK_FILE was changed to MCIMX7D_M4_ddr.ld in CMakeFileList.txt, I had compiled the Modbus project and load the bin file to ddr(0x9ff00000), run

Colibri iMX7 #   ubi  part ubi 
Colibri iMX7 #   ubi write 0x9ff00000 m4firmware  
Colibri iMX7 #   setenv m4boot 'ubi read 0x9ff00000 m4firmware && dcache flush && bootaux 0x9ff00000'
Colibri iMX7 #   setenv fdt_fixup 'fdt addr ${fdt_addr_r} && fdt rm /soc/aips-bus@30800000/spba-bus@30800000/serial@30890000 && fdt rm /soc/aips-bus@30800000/spba-bus@30800000/serial@30880000 && fdt rm /soc/aips-bus@30400000/adc@30610000'
Colibri iMX7 #  saveenv 

and then boot linux, It can not communication with master station, and the master station prompts “port 7 not available”. So what can I do for this problem ?

Make sure that Linux is aware that the firmware is located at the end of the DDR memory. The easiest way is to alter the device tree and add a property like this:

/ {
    memory {
        linux,usable-memory = <0x80000000 0xff00000>;
    };
};

Alternatively you can use the mem kernel parameter to specify a smaller amount of memory ( mem=255M).

I have alter the device tree and added a property in
/ {
memory {
linux,usable-memory = <0x80000000 0xff00000>;
};
};

but it still doesn’t work.

Hm, do you know what exactly happens with the M4 firmware? Is it crashing or just not working correctly? I would recommend to add a canary task which prints something on the debug UART every second or so. Then start Linux and see if that stops…

The address in the DDR linker file is actually outside of the valid memory range. Typically this should not be an issue, but maybe it is for some reason in your case. I just pushed a patch yesterday which fixes that issue. Can you try with the lastest FreeRTOS BSP version?

http://git.toradex.com/cgit/freertos-toradex.git/log/?h=colibri-imx7-m4-freertos-v8