This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Linux/AM5728: GateMP example problem

Part Number: AM5728

Tool/software: Linux

Dear Sitara support Team,

I am using processor_sdk_rtos_am57xx_4_01_00_06 and ti-processor-sdk-linux-am57xx-evm-04.01.00.

I got DSP firmware from ipc_3_46_02_04/packages/ti/ipc/tests/bin/ti_platforms_evmDRA7XX_dsp1/gatempapp.xe66.

A15 linux source code as bellow:

ipc_3_46_02_04/linux/src/tests/GateMPApp.c

ipc_3_46_02_04/linux/src/tests/main_host.c

Also I killed the ti-mctd process.When I run the linux application,I got the error bellow:

root@am57xx-evm:~# ./GateMPApp.host
--> main:
CMEM_init success
--> Main_main:
--> GateMPApp_create:
[10619.875233] CMEMK Error: ioctl: failed to allocate heap buffer of size 0x1000
CMEM Error: allocHeap: ioctl CMEM_IOCALLOCHEAP failed: -1
[10619.887423] CMEMK Error: get_phys: Unable to find phys addr for 0x0
[10619.898947] CMEMK Error: get_phys: get_user_pages() failed: -14
[10619.904892] CMEMK Error: GETPHYS: Failed to convert virtual 0x0 to physical.
CMEM Error: getPhys: Failed to get physical address of 0
GateMPApp_create: Failed to get physical buffer address
<-- GateMPApp_create:
<-- Main_main:
<-- main:

I found the function ti_sdo_ipc_SharedRegion_clearReservedMemory run on DSP will clear the heap memory.

But cmemk.c the driver of cmem save next block address and size of this block in the front of heap memory.

So when DSP firmware loaded, the space of heap_head->next  in the cmemk.c will be clear,

and

        curHeaderPhys = heap_head[bi].next;

        /* Loop over the free list. */
        while (curHeaderPhys != 0) {
                map_header((void **)&curHeader, curHeaderPhys, &curHeader_vm_area);
                curSize = curHeader->size;

the curSize will be 0.this  lead to alloc failure.

If I run the application following the method bellow , it works.

reload DSP firmware

rmmod cmemk.ko

insmod cmemk.ko

 ./GateMPApp.host
--> main:
CMEM_init success
--> Main_main:
--> GateMPApp_create:
GateMPApp_create: Host is ready
<-- GateMPApp_create:
--> GateMPApp_exec:
GateMPApp_exec: Using host-created gate
GateMPApp_exec: Using slave-created gate
<-- GateMPApp_exec: 0
--> GateMPApp_delete:
<-- GateMPApp_delete:
<-- Main_main:
<-- main:

Is there are something wrong with my code?