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.

RTOS/OMAP-L138: Cache memory - OMAPL138

Part Number: OMAP-L138
Other Parts Discussed in Thread: OMAPL138, SYSBIOS

Tool/software: TI-RTOS

Hello, I'm a beginner and I'm using ftp in my platform and this work slow (slow transfer file). I have a problem with running the cache in OMAPL138. When I use a cache without mmu my program dies after a few seconds.

I'm using ti-processor-sdk-rtos-omapl138-lcdk-05.01.00.11 with:

-> bios_6_73_00_12

-> pdk_omapl138_1_0_6

My *.cfg file:

var Defaults = xdc.useModule('xdc.runtime.Defaults');
var Diags = xdc.useModule('xdc.runtime.Diags');
var Error = xdc.useModule('xdc.runtime.Error');
var Log = xdc.useModule('xdc.runtime.Log');
var LoggerBuf = xdc.useModule('xdc.runtime.LoggerBuf');
var Main = xdc.useModule('xdc.runtime.Main');
var Memory = xdc.useModule('xdc.runtime.Memory')
var HeapMem                     =   xdc.useModule('ti.sysbios.heaps.HeapMem');
var HeapBuf                     =   xdc.useModule('ti.sysbios.heaps.HeapBuf');
var SysMin = xdc.useModule('xdc.runtime.SysMin');
var System = xdc.useModule('xdc.runtime.System');
var Text = xdc.useModule('xdc.runtime.Text');

var BIOS = xdc.useModule('ti.sysbios.BIOS');
var Clock = xdc.useModule('ti.sysbios.knl.Clock');
var Swi = xdc.useModule('ti.sysbios.knl.Swi');
var Task = xdc.useModule('ti.sysbios.knl.Task');
var Semaphore = xdc.useModule('ti.sysbios.knl.Semaphore');
var Hwi 		= xdc.useModule('ti.sysbios.hal.Hwi');
var Cache = xdc.useModule('ti.sysbios.hal.Cache');


var Ip = xdc.useModule('ti.ndk.config.Ip');
var Icmp = xdc.useModule('ti.ndk.config.Icmp');
var Tcp = xdc.useModule('ti.ndk.config.Tcp');

var Edma        		= xdc.loadPackage ("ti.sdo.edma3.drv.sample");
var drv        		= xdc.loadPackage ("ti.sdo.edma3.drv");
var rm        		= xdc.loadPackage ("ti.sdo.edma3.rm");


var devType = "omapl138"

var socType = "omapl138";

/*use CSL package*/
//var Csl = xdc.loadPackage('ti.csl');
//Csl.Settings.deviceType = socType;

/* Load the OSAL package */
var osType = "tirtos"
var Osal = xdc.useModule('ti.osal.Settings');
Osal.osType = osType;
Osal.socType = devType;

/* Load Profiling package */
//var Utils = xdc.loadPackage('ti.utils.profiling');

/* Load the MMCSD package */
var Mmcsd = xdc.loadPackage('ti.drv.mmcsd');
Mmcsd.Settings.useDma = "true";
Mmcsd.Settings.enableProfiling = false;
Mmcsd.Settings.socType = socType;

var Fatfs = xdc.loadPackage('ti.fs.fatfs');

/* Load the GPIO package */
var GPIO = xdc.loadPackage('ti.drv.gpio');

/* Load the Board package and set the board name */
var Board = xdc.loadPackage('ti.board');
Board.Settings.boardName = "lcdkOMAPL138";

/*var Clock.TimerProxy = xdc.useModule('ti.sysbios.timers.dmtimer.Timer');*/
/*
 * Program.argSize sets the size of the .args section.
 * The examples don't use command line args so argSize is set to 0.
 */
Program.argSize = 0x0;

/*
 * Uncomment this line to globally disable Asserts.
 * All modules inherit the default from the 'Defaults' module.  You
 * can override these defaults on a per-module basis using Module.common$.
 * Disabling Asserts will save code space and improve runtime performance.
Defaults.common$.diags_ASSERT = Diags.ALWAYS_OFF;
 */

/*
 * Uncomment this line to keep module names from being loaded on the target.
 * The module name strings are placed in the .const section. Setting this
 * parameter to false will save space in the .const section.  Error and
 * Assert messages will contain an "unknown module" prefix instead
 * of the actual module name.
Defaults.common$.namedModule = false;
 */

/*
 * Minimize exit handler array in System.  The System module includes
 * an array of functions that are registered with System_atexit() to be
 * called by System_exit().
 */
System.maxAtexitHandlers = 4;

/*
 * Uncomment this line to disable the Error print function.
 * We lose error information when this is disabled since the errors are
 * not printed.  Disabling the raiseHook will save some code space if
 * your app is not using System_printf() since the Error_print() function
 * calls System_printf().
Error.raiseHook = null;
 */

/*
 * Uncomment this line to keep Error, Assert, and Log strings from being
 * loaded on the target.  These strings are placed in the .const section.
 * Setting this parameter to false will save space in the .const section.
 * Error, Assert and Log message will print raw ids and args instead of
 * a formatted message.
Text.isLoaded = false;
 */

/*
 * Uncomment this line to disable the output of characters by SysMin
 * when the program exits.  SysMin writes characters to a circular buffer.
 * This buffer can be viewed using the SysMin Output view in ROV.
SysMin.flushAtExit = false;
 */

/* No runtime stack checking is performed */
Task.checkStackFlag = true;


/* Reduce the number of task priorities */
Task.numPriorities = 16;

/*
 * The BIOS module will create the default heap for the system.
 * Specify the size of this default heap.
 */
BIOS.heapSize = 0x30000;

/*
 * Build a custom SYS/BIOS library from sources.
 */
BIOS.libType = BIOS.LibType_Custom;

/* System stack size (used by ISRs and Swis) */
Program.stack = 0x20000;

/* Circular buffer size for System_printf() */
SysMin.bufSize = 0x200;

/*
 * Create and install logger for the whole system
 */
var loggerBufParams = new LoggerBuf.Params();
loggerBufParams.numEntries = 16;
var logger0 = LoggerBuf.create(loggerBufParams);
Defaults.common$.logger = logger0;
Main.common$.diags_INFO = Diags.ALWAYS_ON;

System.SupportProxy = SysMin;

var Global = xdc.useModule('ti.ndk.config.Global');

Global.enableCodeGeneration = false;

Global.IPv6 = false;
Global.lowTaskStackSize = 3072;
Global.normTaskStackSize = 4096;
Global.highTaskStackSize = 5120;
Global.pktNumFrameBufs = 192;
Global.pktSizeFrameBuf = 1536;
Global.memRawPageSize = 3072;
Global.ndkThreadStackSize = 8192;

/* Load the NIMU package */
var Nimu 		= xdc.loadPackage('ti.transport.ndk.nimu');
Nimu.Settings.socType  = socType;

/* Load the emac package */
var Emac = xdc.loadPackage('ti.drv.emac');
Emac.Settings.socType = socType;
Emac.Settings.enableProfiling = false;


Ip.autoIp = false;
Ip.address = "192.168.1.11";
Ip.domainName = "omena.net";
Ip.maxReassemblySize = 8192;

Tcp.transmitBufSize = 16384;
Tcp.receiveBufSize = 16384;
Tcp.receiveBufLimit = 16384
Tcp.maxNumReasmPkts = 8;
/*
 * Create a task.  The 'taskFxn' function can be found in main.c.
 */
var task0Params = new Task.Params();
task0Params.stackSize = 4096;
task0Params.priority = 8;
task0Params.instance.name = "taskMain_8";
Program.global.taskMain_8 = Task.create("&taskMain", task0Params);

var hwi0Params = new Hwi.Params();
hwi0Params.instance.name = "SPI_11";
hwi0Params.enableInt = false;
hwi0Params.priority = 11;
Program.global.SPI_11 = Hwi.create(56, "&SPIIsr", hwi0Params);

var hwi4Params = new Hwi.Params();
hwi4Params.instance.name = "UART1_receive_7";
hwi4Params.priority = 7;
hwi4Params.enableInt = false;
Program.global.UART1_receive_7 = Hwi.create(53, "&UART1Isr", hwi4Params);

var hwi5Params = new Hwi.Params();
hwi5Params.instance.name = "UART0_receive_7";
hwi5Params.enableInt = false;
hwi5Params.priority = 7;
Program.global.UART0_receive_7 = Hwi.create(25, "&UART0Isr", hwi5Params);

var hwi5Params0 = new Hwi.Params();
hwi5Params0.instance.name = "UART2_receive_7";
hwi5Params0.priority = 7;
hwi5Params0.enableInt = false;
Program.global.UART2_receive_7 = Hwi.create(61, "&UART2Isr", hwi5Params0);

var task2Params = new Task.Params();
task2Params.instance.name = "taskRecords_main_4";
task2Params.priority = 4;
task2Params.stackSize = 8192;
task2Params.vitalTaskFlag = true;
Program.global.taskRecords_main_4 = Task.create("&Records_main", task2Params);

var task3Params = new Task.Params();
task3Params.instance.name = "taskTimeSynchro_6";
task3Params.priority = 6;
Program.global.taskTimeSynchro_6 = Task.create("&taksTimeSyn", task3Params);
var task3Params0 = new Task.Params();
task3Params0.instance.name = "taskLwIPmain_7";
task3Params0.priority = 7;
task3Params0.stackSize = 4096;
Program.global.taskLwIPmain_7 = Task.create("&lwIP_main", task3Params0);

Task.deleteTerminatedTasks = false;

var Cache1  = xdc.useModule('ti.sysbios.family.arm.arm9.Cache');
var Mmu = xdc.useModule('ti.sysbios.family.arm.arm9.Mmu');

/* Enable the cache                                                           */
Cache1.enableCache = false;

/* Enable the MMU (Required for L1 data caching)                              */
Mmu.enableMMU = false;
/* Enable the MMU (Required for L1/L2 caching)                              */

Platform package:

When I add to *.cfg file code with example:

/* Enable the cache                                                           */
Cache1.enableCache = true;

/* Enable the MMU (Required for L1 data caching)                              */
Mmu.enableMMU = true;
/* Enable the MMU (Required for L1/L2 caching)                              */

/***********************************************
 *              MMU Configuration              *
 ***********************************************/
var Mmu = xdc.useModule('ti.sysbios.family.arm.arm9.Mmu');
Mmu.enableMMU = true;
var attrs = {
	type: Mmu.FirstLevelDesc_SECTION,  // SECTION descriptor
        bufferable: true,                  // bufferable
        cacheable: false,                   // cacheable
	imp: 1,                            // implementation defined
        domain: 3,                         // domain between 0-15
        accPerm: 3,                        // read/write permission
    };


 for (var i=0x01C42000; i < 0x01C42FFF; i = i + 0x00000400) {
         // Each 'SECTION' descriptor entry spans a 1MB address range
         Mmu.setFirstLevelDescMeta(i, i, attrs);
     }

 for (var i=0x01D0C000; i < 0x01D0CFFF; i = i + 0x00000400) {
         // Each 'SECTION' descriptor entry spans a 1MB address range
         Mmu.setFirstLevelDescMeta(i, i, attrs);
     }

 for (var i=0x01D0D000; i < 0x01D0DFFF; i = i + 0x00000400) {
         // Each 'SECTION' descriptor entry spans a 1MB address range
         Mmu.setFirstLevelDescMeta(i, i, attrs);
     }

 for (var i=0x01E27000; i < 0x01E27FFF; i = i + 0x00000400) {
         // Each 'SECTION' descriptor entry spans a 1MB address range
         Mmu.setFirstLevelDescMeta(i, i, attrs);
     }

 for (var i=0x01D00000; i < 0x01D02FFF; i = i + 0x00000400) {
         // Each 'SECTION' descriptor entry spans a 1MB address range
         Mmu.setFirstLevelDescMeta(i, i, attrs);
     }

 for (var i=0x01D04000; i < 0x01D06FFF; i = i + 0x00000400) {
         // Each 'SECTION' descriptor entry spans a 1MB address range
         Mmu.setFirstLevelDescMeta(i, i, attrs);
     }

 for (var i=0x01D08000; i < 0x01D0AFFF; i = i + 0x00000400) {
         // Each 'SECTION' descriptor entry spans a 1MB address range
         Mmu.setFirstLevelDescMeta(i, i, attrs);
     }

 for (var i=0x01C22000; i < 0x01C22FFF; i = i + 0x00000400) {
         // Each 'SECTION' descriptor entry spans a 1MB address range
         Mmu.setFirstLevelDescMeta(i, i, attrs);
     }

 for (var i=0x01E28000; i < 0x01E28FFF; i = i + 0x00000400) {
         // Each 'SECTION' descriptor entry spans a 1MB address range
         Mmu.setFirstLevelDescMeta(i, i, attrs);
     }

 for (var i=0x01E26000; i < 0x01E26FFF; i = i + 0x00000400) {
         // Each 'SECTION' descriptor entry spans a 1MB address range
         Mmu.setFirstLevelDescMeta(i, i, attrs);
     }


// Define the base address of the 2 MB page
// the peripheral resides in.
var peripheralBaseAddrs = [ 
  { base: 0x4ae00000, size: 0x00100000 },  // PRM
  { base: 0x023000000, size: 0x00000400 },  // MMCHS 0 regs
  { base: 0x023100000, size: 0x00000400 }   // MMCHS 1 regs
];

/* Set IO Delay configuration areas as non-cache */
/* Mmu.setSecondLevelDescMeta(0x4844a000, 0x4844a000, attrs);
   Mmu.setSecondLevelDescMeta(0x4ae07d00, 0x4ae07d00, attrs);
*/

if (Program.build.target.$name.match(/gnu/)) {
    if (Program.build.target.$name.match(/A8F/) ||
        Program.build.target.$name.match(/A9F/) ||
        Program.build.target.$name.match(/A15F/)) {
        var SemiHost = xdc.useModule('ti.sysbios.rts.gnu.SemiHostSupport');
    }
}

I have exception error:

[ARM9_0] size: 0x20000.
R0 = 0x80010000  R8  = 0xc26148f0
R1 = 0x00000000  R9  = 0xc26148f8
R2 = 0x00000010  R10 = 0x000000cd
R3 = 0xfffffff9  R11 = 0x02de0668
R4 = 0xfffd5160  R12 = 0x00000000
R5 = 0xc26898de  SP(R13) = 0xc266ee20
R6 = 0x00000000  LR(R14) = 0xc26148f0
R7 = 0xc259b7cc  PC(R15) = 0xc26148f8
PSR = 0x600000df
DFSR = 0x00000005  IFSR = 0x00000012
DFAR = 0x80010000
ti.sysbios.family.arm.exc.Exception: line 205: E_dataAbort: pc = 0xc26148f8, lr = 0xc26148f0.
xdc.runtime.Error.raise: terminating execution

Do you have any instructions to run the cache?

What am I doing wrong? Where is the problem?

  • Hello,

    Where is your MMU configuration for DDR? I see you have added it for IRAM but not DDR.

    To see more register context related to the exception, add the following to your configuration file:

    var Exception =xdc.useModule('ti.sysbios.family.c64p.Exception');

    Exception.enablePrint = true;

    Regards,
    Sahin
  • Thank you Sahin for the answer.
    I'm working on an old project and it seems to me that MMU for DDR is nowhere to be made.
    What should I do?
    Where can I find more information about this topic?
  • Hello,

    Please see the following:

    software-dl.ti.com/.../Mmu.html

    Regards,
    Sahin
  • Thank you Sahin for the answer. I have read the document and when I want use cache for my entire DDR memory (screenshot ROV Object View below)

    I have a same problem:

    [ARM9_0]  size: 0x1000.
    R0 = 0x68000010  R8  = 0xffffffff
    R1 = 0x01c1413c  R9  = 0xffffffff
    R2 = 0x00000000  R10 = 0xffffffff
    R3 = 0x00000003  R11 = 0xffffffff
    R4 = 0xffffffff  R12 = 0x20ff07fd
    R5 = 0xffffffff  SP(R13) = 0xc2681330
    R6 = 0xffffffff  LR(R14) = 0xc26eee28
    R7 = 0xffffffff  PC(R15) = 0xc26eefe0
    PSR = 0x600000df
    DFSR = 0x00000005  IFSR = 0x00000012
    DFAR = 0x68000010
    ti.sysbios.family.arm.exc.Exception: line 205: E_dataAbort: pc = 0xc26eefe0, lr = 0xc26eee28.
    xdc.runtime.Error.raise: terminating execution

    Where can I look for a solution? I have no idea what I'm doing wrong...