Part Number: TMS320C6678
Other Parts Discussed in Thread: SYSBIOS
Tool/software: TI-RTOS
Hi,
I am currently trying to implement Memory Protection for MSMC SRAM memory region to avoid any memory corruption that could be caused by one core writing into some other cores memory area. I am new to the area of Memory Protection so will be needing some guidance for the same. To understand the concept, I had gone through some documents like sprugw0c (CorePac) and sprugw7a (MSMC). After reading I have added some initial code to do address translation and giving initial permissions for the memory range as follows
mpaxh.bAddr = (0xc0000000 >> 12);
mpaxh.segSize = (MPAX_SEGSIZE_4MB & 0x0000001F);
mpaxl.rAddr = 0x00c00000 >> 8;
mpaxl.sr = 1;
mpaxl.sw = 1;
mpaxl.sx = 1;
mpaxl.ur = 1;
mpaxl.uw = 1;
mpaxl.ux = 1;
CSL_XMC_setXMPAXH(3, &mpaxh);
CSL_XMC_setXMPAXL(3, &mpaxl);
Now I want to assign a part of above mentioned MSMC SRAM area of size180 KB with some different permission like to disable the User Write and Supervisor Write. For that I am using MemoryProtect_setPA function to set the memory permission attributes for 0x0C000000 address location of size 180KB. I am doing it as follows
Mask = MemoryProtect_MPPA_LOCAL | MemoryProtect_MPPA_SR | MemoryProtect_MPPA_SX | MemoryProtect_MPPA_UR | MemoryProtect_MPPA_UX;
ret = MemoryProtect_setPA((Ptr)0x0C000000, 0x2CFFF, Mask);
But when I check the value for 'ret' from MemoryProtect_setPA, it always return false. After going through the document for MemoryProtect_setPA function, it says that "if address doesn't belong to any configured MPC then FALSE, otherwise TRUE and PA was written to addr's MPPA register". I am unable to get if I am making any mistakes to set the memory permission attributes.
Can someone please help me to debug the issue or provide some suggestions to solve the issue ?
Thanks and Regards,
Rahul