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.

Stack overflow due to Maiblox use

Other Parts Discussed in Thread: SYSBIOS

Dear all,

I'm having some troubles with the mailboxes and I do know how to solve it. Console displays the following data:

enter taskFxn()
ti.sysbios.hal.Hwi: line 109: E_stackOverflow: ISR stack overflow.
xdc.runtime.Error.raise: terminating execution

Then if I comment all the Mailbox_pend and Mailbox_post the problem disapear. I create the mbox handle before starting the sysbios as following:

Mailbox_Handle spiMbox;
Mailbox_Params mboxParams;
Error_Block eb;
Error_init(&eb);
Mailbox_Params_init(&mboxParams);
mboxParams.instance->name = "mbox";
spiMbox = Mailbox_create(2,20, &mboxParams, &eb);
BIOS_start();

Then in my task I use:

unsigned char data_out[2];
Mailbox_pend(spiMbox, &data_out, BIOS_WAIT_FOREVER);

I think I'm doing it correctly. I guess it is something releated with the heapsize or some configuration of the sysbios but not sure whichone.

Does somebody has any idea of how to solve it?

Thanks in advance,

Aitor

  • Aitor,

          From the looks of it, you're running out of program stack. Can I see your .cfg file?

    Thanks,

    Moses

  • Moses,

    My configuration file is the following:

    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 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.family.c28.Hwi');
    var Mailbox = xdc.useModule('ti.sysbios.knl.Mailbox');
    var Boot = xdc.useModule('ti.catalog.c2800.init.Boot');
    var ti_sysbios_family_c28_Timer = xdc.useModule('ti.sysbios.family.c28.Timer');
    var Memory = xdc.useModule('xdc.runtime.Memory');

    /*
     * 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;
     */

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

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

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

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

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

    System.SupportProxy = SysMin;

    BIOS.heapTrackEnabled = false;
    Boot.bootFromFlash = true;
    Boot.pllOSCCLK = 30;
    BIOS.cpuFreq.lo = 150000000;
    var task0Params = new Task.Params();
    task0Params.instance.name = "null";
    task0Params.priority = 2;
    task0Params.stackSize = 256;
    var smc_spi_task = Task.create("&smc_spi_task", task0Params);
    var task1Params = new Task.Params();
    task1Params.instance.name = "null";
    task1Params.stackSize = 256;
    var main_task = Task.create("&main_task", task1Params);
    var semaphore0Params = new Semaphore.Params();
    semaphore0Params.instance.name = "spiSem";
    semaphore0Params.mode = Semaphore.Mode_BINARY;
    Program.global.spiSem = Semaphore.create(null, semaphore0Params);
    var ti_sysbios_family_c28_Timer0Params = new ti_sysbios_family_c28_Timer.Params();
    ti_sysbios_family_c28_Timer0Params.instance.name = "null";
    ti_sysbios_family_c28_Timer0Params.period = 100000;
    var spiDelay = ti_sysbios_family_c28_Timer.create(null, "&spiDelay", ti_sysbios_family_c28_Timer0Params);
    var heapstdInstance0 = xdc.lookup('xdc.runtime.HeapStd.Instance#0');
    Program.heap = 4096;
    Main.common$.diags_ENTRY = Diags.ALWAYS_OFF;
    Main.common$.diags_EXIT = Diags.ALWAYS_OFF;
    Main.common$.diags_STATUS = Diags.ALWAYS_ON;
    Main.common$.diags_ANALYSIS = Diags.ALWAYS_OFF;
    Main.common$.diags_ASSERT = Diags.ALWAYS_ON;
    Main.common$.diags_INTERNAL = Diags.ALWAYS_OFF;
    Main.common$.logger = logger0;
    Boot.limpAbortFunction = "&ti_catalog_c2800_init_Boot_defaultLimpAbortFunction";
    Defaults.common$.instanceHeap = null;

    Thank you for you colaboration,

    Aitor

  • The line of Program.stack = 256, should increase your program stack. Increase to say 512 and see if that fixes it.

    Moses