Thanks Nick.
I also have some findings regarding the memory map issue, as well as some questions. I've been debating whether or not to post a new thread, but I guess I'll leave it here so the context is all present.
I've been looking at the documentation regarding MPM, CMA, and the RTOS resource table and feel like I'm running around in circles. I cannot find anything that is specific to the KS2 architecture, so I've been using the AM57xx information. As I understand it, there are at least five locations where the memory is influenced: Device Tree, RTOS Resource Table, MPM config file, RTSC Platform, and U-Boot Environment.
And all of these need to agree with each other...
The documentation I am referencing is located here:




In the device tree, we have reserved-memory nodes in k2g-evm-cmem.dtsi and keystone-k2g-evm.dts. The DSP device tree node references dsp_common_cma_pool as its memory region. This seems to mean that the DSP will use the dsp_common_cma_pool as its system memory. The wiki states that the DSP code/data live in the CMA carveout. I have tried to enlarge the cma pool in the device tree, but it is my understanding that I need a custom resource table for that to work. Unfortunately, there is no mention of a default resource table for this platform. Every change I have tried to make to the mpm_config.json file has resulted in being unable to control the DSP at all, which seems to mean that the file had errors.
A summary of what I am trying to accomplish:
I have a custom board with the 66AK2G12 and 1GB of external memory. I am able to boot Linux and manually (through CCS) load and DSP applications. Due to the memory usage required by the DSP in my system, I have been trying to allocate some memory to the DSP. It would be convenient if it were on the order of 256MB of DDR. It is my understanding that this would require a custom resource table, a custom MPM config file, a custom RTSC platform, device tree cmem modifications, and mem_reserve in U-boot for this to work. It has been a difficult experience for someone not fluent in memory mapping to try to extrapolate what parts of the documentation are relevant to my system.
I have tried to set up an RTSC platform such that the program gets loaded into L2SRAM and the default CMA carveout with no success.
I have tried to set up an RTSC platform such that the program gets loaded into L2SRAM and ram that has been reserved using mem_reserve in U-Boot with no success.
I have declared all sections being loaded into DDR as type = "NOLOAD" and have seen that reflected in the map file, but had no success loading the program.
I have run the IPC examples to verify that IPC works at all. That was successful.
My current setup is as follows:
All sections of the RTOS program, except the heap, are loaded into L2SRAM for the DSP.
The heap is loaded to DDR_DSP, a 512MB section starting at 0x90000000. This is set using the cfg file and the RTSC platform.
I have set mem_reserve to 512MB in the U-Boot environment. I have used cat /proc/iomem to verify that Linux is not using this memory.
The default device tree cma settings are (as best as I can tell) unchanged.
I have not set up a custom resource table.
I have not modified mpm_config.json.
When I attempt to run the DSP application using mpmcl, the load fails with error code (-104), load failed. The log shows the following:
Jun 29 01:15:27 m908-002 daemon.info mpmsrv[404]: mpmsrv.c:110:mpm_server: received message of size 74 bytes for cmd 1 Jun 29 01:15:27 m908-002 daemon.info mpmsrv[404]: mpmsrv.c:134:mpm_server: received load command for dsp0 filename /home/root/m908_K2G_audio.out Jun 29 01:15:27 m908-002 daemon.err mpmsrv[404]: mpmdlif.c:197:map_and_copy_segment: transport mmap failed for addr 0x90000000 size 800000 (err: No such file or directory) Jun 29 01:15:27 m908-002 daemon.err mpmsrv[404]: mpmdlif.c:1279:DLIF_allocate: map and copy failed for image /home/root/m908_K2G_audio.out with addr 0x90000000, size 0xc3500 Jun 29 01:15:27 m908-002 daemon.err mpmsrv[404]: mpmdlif.c:1442:DLIF_error: << D L O A D >> ERROR: Jun 29 01:15:27 m908-002 daemon.err mpmsrv[404]: mpmdlif.c:1445:DLIF_error: Failed to allocate target memory for static executable. Jun 29 01:15:27 m908-002 daemon.err mpmsrv[404]: mpmdlif.c:864:mpm_dlif_load: Image loading failed for file /home/root/m908_K2G_audio.out Jun 29 01:15:27 m908-002 daemon.err mpmsrv[404]: mpmssm.c:510:mpm_load_slave: Image loading failed for dsp0 : image Jun 29 01:15:27 m908-002 daemon.err mpmsrv[404]: mpmssm.c:419:mpm_ssm_state_error: entered error state for dsp0 Jun 29 01:15:27 m908-002 daemon.info mpmsrv[404]: mpmsrv.c:77:mpm_server: waiting for slave message
It is hard to tell what exactly is going wrong, since the mpm source isn't in the SDK (as far as I can tell), but it appears that there is a discontinuity between the Linux memory devices and where the ELF file is trying to load the program to. The address mentioned in the third line of that error report is always the base address of the DDR_DSP memory segment. Where I have it now, that segment lines up with local-ddr in the default mpm_config.json file. I am not sure this is correct since I have that address space reserved through U-Boot.
For a basic case, assuming I want to reserve the memory 0x90000000-0x9fffffff for the DSP to use, what do I need to change? Is it just the device tree? Is is just mpm_config.json? Is it the resource table? Is it all three?
I have attached my map, mpm_config.json, and device tree for reference. Thank you in advance for your help.