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.
Hi all,
I changed the DSPLink memory map configuration to leverage all 512 MB on the Beagleboard-xM. Thanks to TI's guides I didn't have problem to do this. My application is split in two parts: ARM side and DSP side.
After an init phase, ARM loads an image (using opencv function) from the filesystem, then it sends a message (using MSGQ component), containing the Mat structure and loaded into CMEM region, to the DSP. Latter receives this message and process the image. Finally ARM saves the processed image.
To do this I used DSPLink (PROC, MSGQ and NOTIFY component), OpenCV (with a patch for alloc image into CMEM region) and CMEM module.
First time I executed the application I got an MMU Fault:
[ 919.511230] DSP MMU Error Fault! MMU_IRQSTATUS = [0x1]. Virtual DSP addr reference that generated the interrupt = [0x40829288].
The error takes place when DSP try to access to the CMEM shared region. To "solve" the problem I tried to disable the MMU and translate the virtual addresses in physical addresses before to send the message. If I disable the MMU all works fine and the image stored is perfectly and quickly processed.
Well, now I would correct this MMU error. I think the error is due to my lack during configuration of memory map. I read that using Codec Engine, it configures automatically the DSP Link tables, but I'm not using CE so I tried to modify again the CFG_OMAP3530_SHMEM.c adding an entry into LINKCFG_memTable_00.
{
CMEMID, /* ENTRY : Entry number */
"CMEM", /* NAME : Name of the memory region */
CMEMADDR, /* ADDRPHYS : Physical address */
CMEMADDR, /* ADDRDSPVIRT : DSP virtual address */
(Uint32) -1u, /* ADDRGPPVIRT : GPP virtual address (if known) */
CMEMSIZE, /* SIZE : Size of the memory region */
TRUE, /* SHARED : Shared access memory? */
FALSE, /* SYNCD : Synchornized? */
},
The corresponding addition into dsplink-omap3530-base.tci.
/* ============================================================================
* MEM : CMEM region
* ============================================================================
*/
var CMEM = prog.module("MEM").instance("CMEM");
CMEM.base = 0x90000000 ;
CMEM.len = 0x04000000;
CMEM.space = "cmem";
CMEM.createHeap = false;
CMEM.comment = "CMEM";
Now the problem is that during the DSP-side compilation I get an error form tconf (CCSv5 console):
**** Build of configuration Debug for project messagedsp ****
/home/giacomo/ccsv5/ccsv5/utils/bin/gmake -k all
Building file: ../DspBios/5.XX/OMAP3530/message.tcf
Invoking: TConf
"/home/giacomo/ccsv5/xdctools_3_23_03_53/tconf" -b -Dconfig.importPath="/home/giacomo/workspace_ccsv5/messagedsp/DspBios/5.XX/OMAP3530;/home/giacomo/workspace_ccsv5/messagedsp;/home/giacomo/ccsv5/bios_5_41_13_42/packages;/home/giacomo/ccsv5/bios_5_41_13_42/packages/ti/bios;/home/giacomo/TI/dsplink_linux_1_65_00_03/dsplink/dsp/inc/DspBios;/home/giacomo/TI/dsplink_linux_1_65_00_03/dsplink/dsp/inc/DspBios/5.XX/OMAP3530;/home/giacomo/TI/dsplink_linux_1_65_00_03/dsplink/dsp/inc/DspBios/5.XX;" "../DspBios/5.XX/OMAP3530/message.tcf"
js: TypeError: Cannot set property "base" of undefined to "2415919104"
gmake: *** [messagecfg.cmd] Error 1
gmake: Target `all' not remade because of errors.
**** Build Finished ****
(P.S. I started all my work from DSPLink Message example.)
I hope someone can help me. Thanks
Giacomo,
The basic problem is that you need to translate the ARM side virtual address (returned from CMEM) into a physical address and pass that to the DSP instead of the virtual address. The CMEM module has an API for doing this: CMEM_getPhys(). Go to your linux utils installation folder and open the release notes. Follow the following links:
Documentation > Linux Utils API Reference Guide (html) > Contiguous Memory Manager
You mentioned above that you changed the DSPLink memory map to use 512 MB of memory. I'm wondering how you did this and if it's valid. Are you running Linux on the ARM? If so, then the memory used by Linux must not be given to the DSP. Make sure you don't overlap the DSPLink memory map with memory used by Linux.
You also mentioned that you disabled the MMU. I'm assuming this is the ARM's MMU? How did you disable this, with a kernel config parameter?
The error you are getting from tconf is raised by the code you added to the dsplink-omap3530-base.tci file. It looks like you are trying to configure a memory object called "CMEM" on the DSP side. You do not need to do this. The statement you added is using the 'instance()' function. This will look for an existing object by the name "CMEM", but there is no such object. This returns a NULL pointer which leads to the error you are seeing. You could use the create() method to create a new memory object called "CMEM" but this is not needed.
~Ramsey
Hi Ramsey, thank you for reply
Ramsey said:The basic problem is that you need to translate the ARM side virtual address (returned from CMEM) into a physical address and pass that to the DSP instead of the virtual address. The CMEM module has an API for doing this: CMEM_getPhys().
Exactly! In fact when MMU is disabled, before to send message to DSP the addresses into the Mat structure are translated in physical space through CMEM_getPhys(). If MMU is enabled, I'll send to DSP the virtual addresses. Is correct?
Ramsey said:You mentioned above that you changed the DSPLink memory map to use 512 MB of memory. I'm wondering how you did this and if it's valid. Are you running Linux on the ARM? If so, then the memory used by Linux must not be given to the DSP. Make sure you don't overlap the DSPLink memory map with memory used by Linux.
I'm running Angstrom base-image on the ARM and the memory used by Linux is not given to the DSP.
The memory map is:
Name | Start Address | Size (MB) | Size (Hex) |
Linux | 0x80000000 | 256 MB | 0x10000000 |
CMEM | 0x90000000 | 64 MB | 0x04000000 |
DDRALGHEAP | 0x94000000 | 160MB | 0x0A000000 |
DDR2 | 0x9E000000 | 4 MB | 0x00400000 |
SHMEM0 | 0x9E400000 | 20 KB | 0x00005000 |
SHMEM1 | 0x9E405000 | 1004 KB | 0x000FB000 |
RESET VECTOR | 0x9E500000 | 4 KB | 0x00001000 |
SMAPOOL | 0x9E501000 | ~ 27 MB | 0x01AFF000 |
While CMEM configuration is:
CMEM_MODPARAMS="phys_start=0x90000000 phys_end=0x94000000 pools=20x4096,10x155648, 5x1048576"
I think it's valid because all the examples into DSPLink folder works. Note that this configuration is not optimized and it's the first version that will be optimize with app requirements.
Ramsey said:You also mentioned that you disabled the MMU. I'm assuming this is the ARM's MMU? How did you disable this, with a kernel config parameter?
I read about this possibility here.
OMAP35x TRM says that there are three MMUs: Microprocessor unit (MPU) MMU, Camera MMU and Image Video and Audio accelerator (IVA2.2) MMU. Latter is disabled. Sorry but I'm not much competent about MMU. I'm asking help for this reason.
Ramsey said:The error you are getting from tconf is raised by the code you added to the dsplink-omap3530-base.tci file. It looks like you are trying to configure a memory object called "CMEM" on the DSP side. You do not need to do this. The statement you added is using the 'instance()' function. This will look for an existing object by the name "CMEM", but there is no such object. This returns a NULL pointer which leads to the error you are seeing. You could use the create() method to create a new memory object called "CMEM" but this is not needed.
I'm sorry but I don't understand what I have to do. I notice the error of 'instance()' in the dsplink-omap3530-base.tci file but, how can I map this region into MMU's TLB?
Giacomo,
I see now that you are using Coded Engine 2.x, I missed that the first time. The memory map configuration is done in the tci files used when building the Codec Engine server. These files are in the Codec Engine examples, not in DSPLink. Look for the following file.
codec_engine_install_dir/examples/ti/sdo/ce/examples/servers/all_codecs/all_evm3530.tci
In this file, you will find memory map entries for DDRALGHEAP, DDR2, RESET_VECTOR. Do *not* add a CMEM entry, this is done automatically for you by Codec Engine. I'm not sure about SHMEM0, SHMEM1, and SMAPOOL. What are these used for?
You must rebuild your server first. This generates an internal file used by Codec Engine when you build the application side. Run your application with CE_DEBUG=2 and look for the memory map entries. You can verify that the configuration was updated correctly.
Leave the IVA MMU enabled. Codec Engine will program the IVA MMU to match the memory map configuration we just discussed above. However, the IVA MMU will be programmed with physical addresses (the same addresses you entered above in the tci file and with the CMEM physical blocks).
When you allocate memory from CMEM on the ARM side, you must use CMEM_getPhys() to get the physical address of the memory block and then pass that to the DSP. Do this with the IVA MMU enabled. You cannot use the ARM virtual addresses.
Your memory map looks good and your CMEM insmod parameters also look good.
None of the memory map configuration is used by the DSPLink driver (dsplinkk.ko). Be sure to restore the files from DSPLink and rebuild the driver as you had it originally.
Let us know how it goes.
~Ramsey
Ramsey I'm so sorry there is a misunderstanding.
I'm not using Codec Engine. Have you understand this from the memory map? I followed the CE memory config to make this memory map. The only difference is DDR2 and DDRALGHEAP regions that are configured in a unique entry (I used two separate rows in above table):
CFG_OMAP3530_SHMEM.c
{
CODEENTRYID, /* ENTRY : Entry number */
"DDR2", /* NAME : Name of the memory region */
CODEMEMORYADDR, /* ADDRPHYS : Physical address */
CODEMEMORYADDR, /* ADDRDSPVIRT : DSP virtual address */
(Uint32) -1u, /* ADDRGPPVIRT : GPP virtual address (if known) */
CODEMEMORYSIZE, /* SIZE : Size of the memory region */
TRUE, /* SHARED : Shared access memory? */
FALSE, /* SYNCD : Synchornized? */
}
where:
CODEMEMORYADDR=0x94000000
CODEMEMORYSIZE=0x0A400000
dsplink-omap3530-base.tci
var DDR2 = prog.module("MEM").instance("DDR2");
DDR2.base = 0x94000000 ;
DDR2.len = 0x0A400000;
DDR2.space = "code/data";
DDR2.createHeap = true;
DDR2.heapSize = 0x0A000000;
DDR2.comment = "DDR2";
(I hope I have been clear)
So the problem is the same explained in my previous post.
Thanks for reply and sorry for the misunderstanding.
Giacomo,
Actually, it way my mistake. I was confusing this thread with another similar thread which is using Codec Engine. It was nothing that you had written.
So, I think your are very close to success. To fix the original build error, you just need to change "instance" to "create" in your dsplink-omap3530-base.tci file as follows.
/* ====================================================================
* MEM : CMEM region
* ====================================================================
*/
var CMEM = prog.module("MEM").create("CMEM");
CMEM.base = 0x90000000;
CMEM.len = 0x04000000;
CMEM.space = "cmem";
CMEM.createHeap = false;
CMEM.comment = "CMEM";
This will create a new memory section in the DSP executable which maps to the CMEM memory. This memory section will not actually be used by the linker, it just makes a place holder for the CMEM memory. Make sure the base and size match the insmod parameters you use with CMEM.
On the ARM side, you need to add a CMEM entry to the LINKCFG_memTable_00 in DSPLink. Edit the following file.
dsplink/config/all/CFG_OMAP3530_SHMEM.c
STATIC LINKCFG_MemEntry LINKCFG_memTable_00 [] =
{
10, /* ENTRY : Entry number */
"CMEM", /* NAME : Name of the memory region */
0x90000000, /* ADDRPHYS : Physical address */
0x90000000, /* ADDRDSPVIRT : DSP virtual address */
(Uint32) -1, /* ADDRGPPVIRT : GPP virtual address (if known) */
0x04000000, /* SIZE : Size of the memory region */
FALSE, /* SHARED : Shared access memory? */
FALSE /* SYNCD : Synchornized? */
}
Make sure the entry number is sequential. Note that ADDRDSPVIRT (the DSP virtual address) is the same as ADDRPHYS (physical address). Remember that the IVA MMU will be programmed by DSPLink with virtual address = physical address.
I believe that SHARED is FALSE because DSPLink will not actually write into this memory. CMEM will take care of mapping it on the ARM side. But if it does not work, you can try TRUE. It will only waste some kernel virtual address space.
Depending on how you will use SHMEM0, SHMEM1, SMAPOOL, you will need to add these as well.
~Ramsey
Ok Ramsey, no problem for the mistake!
I modified two files like you said but now CCS gives this error:
**** Build of configuration Debug for project messagedsp ****
/home/giacomo/ccsv5/ccsv5/utils/bin/gmake -k all
Building file: ../DspBios/5.XX/OMAP3530/message.tcf
Invoking: TConf
"/home/giacomo/ccsv5/xdctools_3_23_03_53/tconf" -b -Dconfig.importPath="/home/giacomo/workspace_ccsv5/messagedsp/DspBios/5.XX/OMAP3530;/home/giacomo/workspace_ccsv5/messagedsp;/home/giacomo/ccsv5/bios_5_41_13_42/packages;/home/giacomo/ccsv5/bios_5_41_13_42/packages/ti/bios;/home/giacomo/TI/dsplink_linux_1_65_00_03/dsplink/dsp/inc/DspBios;/home/giacomo/TI/dsplink_linux_1_65_00_03/dsplink/dsp/inc/DspBios/5.XX/OMAP3530;/home/giacomo/TI/dsplink_linux_1_65_00_03/dsplink/dsp/inc/DspBios/5.XX;" "../DspBios/5.XX/OMAP3530/message.tcf"
("Error: ", self.name, $1)
==> "Cannot select this space if a heap will be created"
js: Cannot select this space if a heap will be created
gmake: *** [messagecfg.cmd] Error 1
gmake: Target `all' not remade because of errors.
**** Build Finished ****
I attach the two config files.
0830.CFG_OMAP3530_SHMEM.c
7571.dsplink-omap3530-base.txt
Giacomo,
In the file dsplink-omap3530-base.tci, the CMEM.space value is invalid. This was my mystake, sorry. It should be set to data.
CMEM.space = "data";
~Ramse
Oh yes! It works. Thank you so much.
I thought that CMEM.space was something like label because I didn't understand the role of this field from documentation.
Great! The space attribute is a hint to the linker as to what type of data will be stored in the memory location. Typical values would be code (program instructions), data, or both. It helps the linker validate memory placement.
~Ramsey