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.

Cant add semaphore in app.cfg gui

Other Parts Discussed in Thread: SYSBIOS

Using sys/bios 2.13.0.06

Using CC2650EM-4xs and smartrf06 eval board

CCS  Version: 6.1.2.00015 

My code is a modification of the SimpleBLEPeripheral example that was modified by the BDS Add-in

Trying to get  multiple tasks to stop blocking each other. 

I cannot add or remove semaphores or the semaphore module via the cfg editor.

If I manually add the Var semaphore xdc line in the cfg file I can add a semaphore. But when I go to compile code that has a "Semaphore_pend(sem, BIOS_WAIT_FOREVER);" statement I get a BIOS_WAIT_FOREVER undefined compiler error.

With the manual xdc line in the cfg file I can remove the semaphore module, but it just re-adds itself and the check-box is disabled and checked. 

I am perplexed by this behavior and I cant seem to find anything on the forums that is the same issue.

Thanks for your help.

JP

  • One thing is to make sure you have BIOS.h included in your project (if your include directories point to the SYS/BIOS packages directory then it should be in ti/sysbios/BIOS.h). Also, make sure the BIOS module is included in the cfg.

    Your issue with the Semaphore readding it self sounds odd. Would it be possible to zip up your project and post it?

    Regards,
    Gilbert
  • I cant send you the project but I tried / verified the other items.  Here is the CFG file:

    var ROM = xdc.useModule('ti.sysbios.rom.ROM');
    ROM.romName = ROM.CC2650;
    
    var Defaults = xdc.useModule('xdc.runtime.Defaults');
    var Types = xdc.useModule('xdc.runtime.Types');
    var Diags = xdc.useModule('xdc.runtime.Diags');
    var Error = xdc.useModule('xdc.runtime.Error');
    var Main = xdc.useModule('xdc.runtime.Main');
    var Memory = xdc.useModule('xdc.runtime.Memory')
    var SysCallback = xdc.useModule('xdc.runtime.SysCallback');
    var System = xdc.useModule('xdc.runtime.System');
    var Text = xdc.useModule('xdc.runtime.Text');
    var HeapMem = xdc.useModule('ti.sysbios.heaps.HeapMem');
    var Reset = xdc.useModule('xdc.runtime.Reset');
    var BIOS = xdc.useModule('ti.sysbios.BIOS');
    var Clock = xdc.useModule('ti.sysbios.knl.Clock');
    var Task = xdc.useModule('ti.sysbios.knl.Task');
    var Hwi = xdc.useModule('ti.sysbios.hal.Hwi');
    var M3Hwi = xdc.useModule('ti.sysbios.family.arm.m3.Hwi');
    var Power = xdc.useModule('ti.sysbios.family.arm.cc26xx.Power');
    
    /* Enable idle task (default). */
    Task.enableIdleTask = true;
    
    /* Idle CPU when threads blocked waiting for an interrupt */
    Power.idle = true;
    Power.policyFunc = Power.standbyPolicy;
    
    /* compile out all Assert's */
    Defaults.common$.diags_ASSERT = Diags.ALWAYS_OFF;
    
    /* Don't load string names of modules on the target */
    Defaults.common$.namedModule = false;
    
    /* Allow Mod_create() and Mod_construct() but not delete() or destruct() */
    Defaults.common$.memoryPolicy = Types.CREATE_POLICY;
    
    /* Don't load diagnostic/descriptive text strings on the target */
    Text.isLoaded = false;
    
    /* Use the minimal user-supplied callback provider */
    System.SupportProxy = SysCallback;
    /* no exit handlers needed */
    System.maxAtexitHandlers = 0;
    
    /* main() and Hwi, Swi stack size */
    Program.stack = 1024;
    /* no command-line arguments main(argc, argv) needed */
    Program.argSize = 0;
    
    /* build a custom, optimized version of SYS/BIOS */
    BIOS.libType = BIOS.LibType_Custom;
    
    /* no logging - all compiled out */
    BIOS.logsEnabled = false;
    
    /* disable Asserts in SYS/BIOS code */
    BIOS.assertsEnabled = false;
    
    /* Reduce number of Task priority levels to save RAM */
    Task.numPriorities = 6;
    
    /* Set the default Task stack size - used if one is not specified */
    Task.defaultStackSize = 512;
    
    /* Don't check stacks for overflow - saves cycles (and power) and Flash */
    Task.checkStackFlag = false;
    
    /* Disable exception handling to save Flash - undo during active development */
    M3Hwi.enableException = true;
    M3Hwi.excHandlerFunc = null; /* null = default while loop function. Use e.g. "&myFxn" to use your own function. */
    M3Hwi.nvicCCR.UNALIGN_TRP = 0;
    M3Hwi.nvicCCR.DIV_0_TRP = 0;
    
    /* Don't check for interrupt stack overflow during Idle loop */
    Hwi.checkStackFlag = false;
    
    /* Minimize Flash and RAM usage of Error module */
    Error.raiseHook = null; /* null = default while loop function. Use e.g. "&myFxn" to your own handler function. */
    Error.maxDepth = 2;
    
    /* Set the default CPU frequency */
    BIOS.cpuFreq.lo = 48000000;
    
    /* Put reset vector at start of Flash */
    M3Hwi.resetVectorAddress  = 0x0;
    
    /* Put interrupt vector at start of RAM so interrupts can be configured at runtime */
    M3Hwi.vectorTableAddress  = 0x20000000;
    
    /* CC2650 has 50 interrupts */
    M3Hwi.NUM_INTERRUPTS = 50;
    
    /* Set heap size */
    BIOS.heapSize = 1668;
    
    var Swi = xdc.useModule('ti.sysbios.knl.Swi');
    Swi.numPriorities = 6;
    BIOS.swiEnabled = true;
    
    BIOS.includeXdcRuntime = true;
    
    /* Change default error function -- just spin */
    Error.policyFxn = Error.policySpin;
    
    /* true:  Allow runtime creation of e.g. semaphores
     * false: Compile out reference to Memory in BIOS */
    BIOS.runtimeCreatesEnabled = true;
    
    /* Abort and exit functions -- just spin */
    System.abortFxn = System.abortSpin;
    System.exitFxn = System.exitSpin;
    
    /* CC26xx Boot module */
    var Boot = xdc.useModule('ti.sysbios.family.arm.cc26xx.Boot');
    Boot.driverlibVersion = 2;
    Boot.customerConfig = false;
    //Boot.checkBackdoor = false;
    
    /* Turn on RCOSC_HF calibration, thus enabling fast startup */
    Power.calibrateRCOSC = true;
    //Power.calibrateRCOSC = false;
    
    /* 10 us tick period */
    Clock.tickPeriod = 5;
    var clock0Params = new Clock.Params();
    clock0Params.instance.name = "ADC_Clock";
    clock0Params.period = 25;
    Program.global.ADC_Clock = Clock.create("&ADCClockFXN", 25, clock0Params);
    var task0Params = new Task.Params();
    task0Params.instance.name = "ADCGet";
    task0Params.priority = 2;
    Program.global.ADCGet = Task.create("&ADCTaskFxn", task0Params);
    BIOS.rtsGateType = BIOS.GateMutex;
    

  • Have you made sure to save your changes to the cfg file after editing it? I know the editor can behave a little oddly otherwise.

    Have you tried importing one of our examples that use semaphores such as the Benchmark example through Resource Explorer to see if it builds and runs fine?
  • I have not tried importing any other examples. I will on Monday.