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.

Set up a periodic task in SYS/BIOS

Other Parts Discussed in Thread: SYSBIOS

I am using CCS v4.2 and trying to build SYS/BIOS project. I know about XGCONF editor and how you can edit CFG files with it. I am trying to set up a "periodic task" to run, like you could with the "PRD" option in TCF files used in DSP/BIOS version 5. Version 6 seems to be very different. There is a tab for "task" (under ti.sysbios.knl.Task), where I am assuming you specify the function to run "fxn" under "Create Args". Then there are options like arguments to the function and task priority, but I don't see anywhere where you can specify that the function should run "continuously" or give the interval at which it should execute. Is there a different way of doing it in SYS/BIOS? Maybe some combination of settings for clock, SWI, and task?

  • Audrey,

    In SYS/BIOS 6 You can set up a single periodic or one-shot function using the Timer module, or you can set up multiple functions using the Clock module.  The Clock module basically configures the Timer module to post a Swi that will execute the clock functions.  Let me know if that's enough detail to get you started.

  • David, thanks for your reply. I tried adding a new "clock", then changed the value of "clockFxn" (it's under "Create Args" tab) to the name of the function I wanted to run. When I try to run the program, I can see that it executes "main", but then an error saying "unhandled event loop exception" appears. As a side note, I have tried putting this function under "Swi" and "Task" before, with the same result.

    Also, do you know if the function name has to be underlined? It used to be, in TCF files, when you specified the function name under "PRD".

     

  • Andrey,

    The error "unhandled event loop exception" is generated by the Eclipse framework (which is what Code Composer Studio is) when one of its plug-ins generates an exception that is not handled.  I would consider this a bug, as the exception should at least be handled by the plug-in rather than having it propagate all the up to the highest level.  Anything you can do to help us reproduce the problem would be welcome.

    It's not clear to me whether this is your main problem.  It sounds like the BIOS scheduler is not starting properly?  The way that you created the Clock instance seems right, but one thing I should warn you about is that you should probably set startFlag=TRUE so that the clock will immediately start running when the BIOS scheduler starts up.  If you leave this to FALSE, your app  will need to explicitly start it by calling Clock_start().

    I don't see enough information in your description to provide further help, so any additional details at this point would be welcome.

  • Andrey,

    The "unhandled event loop exception" message comes from Eclipse, but it doesn't tell much about the root cause. Can you please send the Java stack backtrace from the error?

    To do this, in the CCS "Error Log" view, double-click on the error to bring up the "Event Details" dialog, shown below. Click the "Copy Event Details to Clipboard" button, save the clipboard to a text file, and attach to your reply post. You can add the file as an attachment using the "Options" link of the reply post editor.

    thanks a lot,
    Jon

  • The 'clock' example, provided with the product and available via the File->new project wizard might be a good reference for you.

  • Thanks for your replies.

    OK, I set the "startFlag" to "true" for the new Clock instance... the error appeared again. There is no stack trace from that error, the precise message in "event details" is 

    An exception stack trace is not available.

    However, I noteced there is another error, immediately before that one. It said "Failed to execute runnable (java.lang.NullPointerException)". This one has a stack trace, which I am reproducing here.

     

    org.eclipse.swt.SWTException: Failed to execute runnable (java.lang.NullPointerException)

    at org.eclipse.swt.SWT.error(SWT.java:3374)

    at org.eclipse.swt.SWT.error(SWT.java:3297)

    at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:126)

    at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:3325)

    at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2971)

    at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1914)

    at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1878)

    at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:419)

    at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)

    at org.eclipse.ui.internal.ide.IDEApplication.run(IDEApplication.java:97)

    at org.eclipse.core.internal.runtime.PlatformActivator$1.run(PlatformActivator.java:78)

    at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:92)

    at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:68)

    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:400)

    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:177)

    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

    at java.lang.reflect.Method.invoke(Unknown Source)

    at org.eclipse.core.launcher.Main.invokeFramework(Main.java:336)

    at org.eclipse.core.launcher.Main.basicRun(Main.java:280)

    at org.eclipse.core.launcher.Main.run(Main.java:996)

    at org.eclipse.core.launcher.Main.main(Main.java:971)

    Caused by: java.lang.NullPointerException

    at com.ti.dvt.rta.DataViewSessionHandler$LoggerBuffContribution.rebuildCombo(DataViewSessionHandler.java:205)

    at com.ti.dvt.rta.DataViewSessionHandler$LoggerBuffContribution.createControl(DataViewSessionHandler.java:185)

    at org.eclipse.jface.action.ControlContribution.fill(ControlContribution.java:97)

    at org.eclipse.jface.action.SubContributionItem.fill(SubContributionItem.java:75)

    at org.eclipse.jface.action.ToolBarManager.update(ToolBarManager.java:317)

    at org.eclipse.ui.internal.ViewPane.updateActionBars(ViewPane.java:443)

    at org.eclipse.ui.internal.ViewActionBars.updateActionBars(ViewActionBars.java:59)

    at com.ti.dvt.ui.multipageview.MultiPageView.showPageInfo(MultiPageView.java:809)

    at com.ti.dvt.ui.multipageview.MultiPageView.activatePageContext(MultiPageView.java:459)

    at com.ti.dvt.rta.DataViewSessionHandler.activateReferenceView(DataViewSessionHandler.java:84)

    at com.ti.dvt.rta.DataViewSessionHandler.updateView(DataViewSessionHandler.java:132)

    at com.ti.dvt.rta.DataViewSessionHandler$2.run(DataViewSessionHandler.java:110)

    at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35)

    at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:123)

    ... 20 more

     

    (I don' t know how to get those "20 more" to display.)

    One other thing I should mention, I saw that one of the sample projects provided for SYS/BIOS uses a BIOS_start() function at the end of main. I tried adding it to my project, too, it compiles, but fails at linking stage with "undefined symbol". 

  • There seems to be a couple issues here.   Can we try to separate them?

    (1)  Please close all "RTA" and "ROV" tools.  The above errors look related to the RTA tools.  What version of CCSv4.2 are you using?  Are you using a pre-release?  Or did you recently download the release candidate?

    (2)  To fix the "undefined symbol" you probably need to add "xdc.useModule('ti.sysbios.BIOS');" to your .cfg file (or compile the project for debug instead of whole_program).

    (3)  Build and run your app and see if you are getting your periodic interrupt.

    After that, we can debug the RTA/ROV tool problem.

    I would suggest starting with one of the provided examples.  What board are you using?  What processor?  Is it a standard EVM?  If so, you can attach you .c and .cfg files to this post and we can review and comment.

    Regards,
    -Karl-

  • Jon, Karl-

    I'm helping Andrey.  Some answers:

    1) Yes we downloaded the release candidate (v4.2.0.10007).

    2) We're using C6472 EVM.

    Also some additional notes / questions:

    1) We made some progress.  Andrey is able to build a SYS/BIOS project now using shared mem.  Our next step is to run code on different cores and verify they can cooperate via use of shared mem.

    2) When we use a data section pragma to locate a variable into shared memory, as follows:

    #pragma DATA_SECTION(var, "SL2RAM")
    int var[1024];

    then we get a warning message "Creating Output Section SL2RAM without a SECTIONS specification".  We can see SL2RAM defined in the RTSC Platform Edit/View Device Memory Map, and we can see "var" correctly located in the output .map file.  How do we remove this warning?

    3) Is there away to get the RTSC Platform Edit/View dialog to 'remember' the package path? Every time we go in there, we have to manually browse/enter the path.  The default path (value shown upon entry) has nothing to do with platform packages.

    4) Andrey will continue to work on the periodic function issue, by editing the .cfg file.  I think I know the answer, but just to double-check, there is no way to add a periodic functions using the RTSC Platform Edit/View?  We can see how to add mem segments in that way... I'm an old TI developer so I'm a bit nostalgic for the GUI method of defining tasks, memory, interrupts, etc.   Hopefully it returns to CCS at some point.

    -Jeff

     

  • Jeff Brower said:

    2) When we use a data section pragma to locate a variable into shared memory, as follows:

    #pragma DATA_SECTION(var, "SL2RAM")
    int var[1024];

    then we get a warning message "Creating Output Section SL2RAM without a SECTIONS specification".  We can see SL2RAM defined in the RTSC Platform Edit/View Device Memory Map, and we can see "var" correctly located in the output .map file.  How do we remove this warning?

    I think you are confusing data section and memory segments.   The linker memory table has a "segment" named SL2RAM.  Typically you place "sections" (like .text, .far, etc.) into these segments.

    Can you try something like this in your .c file:

    #pragma DATA_SECTION(var, "myvars")
    int var[1024];

    And then add this to your .cfg file

    Program.sectMap["myvars"] = "SL2RAM"

    Check the updated Chapter 5 of the latest SYS/BIOS User's Guide for more info on this.   (I see a typo in section 5.3.1 that I'll file a bug and get fixed).  The IRAM should be in quotes:

    Program.sectMap[".foo"] = "IRAM";

     

    Jeff Brower said:

    3) Is there away to get the RTSC Platform Edit/View dialog to 'remember' the package path? Every time we go in there, we have to manually browse/enter the path.  The default path (value shown upon entry) has nothing to do with platform packages.

    4) Andrey will continue to work on the periodic function issue, by editing the .cfg file.  I think I know the answer, but just to double-check, there is no way to add a periodic functions using the RTSC Platform Edit/View?  We can see how to add mem segments in that way... I'm an old TI developer so I'm a bit nostalgic for the GUI method of defining tasks, memory, interrupts, etc.   Hopefully it returns to CCS at some point.

    Amit will have to comment on #3.

    On #4, have you tried the configuration tool?   The memory map is specified via platform wizard (edit/view), but you can open the .cfg file with graphical tool and update module state and such.  They are now 2 steps and activities.  Idea is that multiple apps can share common memory map and that you'd do this "once" for a new board.  And then multiple apps would use this common memory configuration.

     

  • one more thing ...

    If you are doing multi-core, I think you should review the IPC product and docs and examples.  We provide source for both BIOS and IPC in the latest releases.  And we include multicore example for evm6472.

  • If SL2RAM is a memory segment, i.e., defined under the MEMORY portion of a memory map, then your DATA_SECTION macro won't work.  You'll need a sections specification in your .cfg file such as:

    var dataSection = new Program.SectionSpec;

    dataSection.loadSegment = "SL2RAM";

    Program.sectMap[".my_data"] = dataSection;

    and, I've found I still need to assign this in the .cmd file as:

    SECTIONS

    {

      .my_data : > SL2RAM, PAGE = 1

    }

    and in your code:

    #pragma DATA_SECTION(var, ".my_data");

     

    Mark

  • Jeff Brower said:

    3) Is there away to get the RTSC Platform Edit/View dialog to 'remember' the package path? Every time we go in there, we have to manually browse/enter the path.  The default path (value shown upon entry) has nothing to do with platform packages.

    Jeff,

    If you are trying to create new platforms we recommend using the default area. A typical workflow will be to create a platform using Tools -> RTSC Tools -> Platform -> New in the default area - <USERDIR>\myRepository\packages. Then when you want to modify/view your platform you use Tools -> RTSC Tools -> Platform -> Edit/View 

    Modifying the platforms delivered with XDCtools in place is not recommended.

    Note that the tool does not have 'memory' - it does not remember the repository selected in a previous invocation. I  think this will be a useful feature to add to the tool. 

     

    Thanks

    Amit

     

  • Karl-

    > And then add this to your .cfg file

    > Program.sectMap["myvars"] = "SL2RAM"

    For now, I created a .cmd file for the project and added a SECTIONS directive.  This killed the warning.  Sorry if I used the old-fashioned way :-)

    -Jeff

  • Mark-

     

    Thanks.  Just the .cmd file directive and DATA_SECTION pragma change seemed to be enough.  The warning disappeared and the var is located correctly in SL2RAM.

     

    -Jeff

     

  • Hello,

    I followed a suggestion in this thread and created a project from the "Clock" template that appears when you create a new SYS/BIOS project.

    The first thing i noticed is that it does not configure a running task GRAPHICALLY. All the setup is done in the code, in the clock.c file. So, I added a new kernel "Clock" instance from clock.cfg, using the graphical editor. Pointed it to a new function that I added, that would print a message to the console periodically. Now the project built and ran as expected. I was able to see both tasks running, the one created in the code, and the one I added graphically.

    I still don't know why I am getting strange errors when creating tasks from an "empty" SYS/BIOS template. I thought I should be able to do it easily, since it should be possible to do everything from scratch. But at least I got to an example to work for my purposes.

  • Amit-

    I think you put too much stock in Wizards and creating new projects / platforms.  In my 25+ year experience, the first thing we want to look at are *existing* projects, and see how TI guys did it.  In that light, we load one of your existing projects (see previous posts on this thread recommending various ones for us to try), go to Tools -> RTSC -> Platform -> Edit/View... and try to select a Platform Package... and find?  Nothing.

    Yes we can figure it out, but it's another 20 min headache.  And then after figuring it out, the next time we're back there, that dialog box has lost what we told it -- unexpected for a WinXP dialog box.  And that's not insignificant info either, that's the entire memory map for the project, one of the first things of concern.

    CCS v4.2, while powerful with impressive new features, has yet to convince me it's easy to use.

    -Jeff

  • Hi Jeff,

    Your point is well taken. I have filed ECL325514 to track this enhancement request. We will address this in the next major release - XDCtools 3.21 - scheduled in mid-November.

     

    Jeff Brower said:

    CCS v4.2, while powerful with impressive new features, has yet to convince me it's easy to use.

    -Jeff

     

    Are there any other specific  enhancements that you can suggest that will  help improve the user experience?

  • It gets even more fun when you need to copy sections from FLASH to RAM.  There are relevant threads and few solutions to the problem in and around these fora.

    Mark

  • All:

    Can someone post to the DSP-BIOS wiki or SYS-BIOS wiki the method for setting up a single-shot task?

    I have a situation where I need to wait until after the launch of DSP-BIOS to start operation on a device. I want to do this one time and be done.

    Regards,

    Todd Anderson

  • Hi Todd,

    Are you looking for instructions on just how to create a Task, or specifically how to create a Task that is "single-shot?"

    A "single shot" task could just be a standard task whose corresponding function does not have a loop.  It would run some code and when the task function exits, the task would terminate.

    For example:

    Void mySingleShotTask()

    {

        /* do some stuff */

        return;  /* ensure that above code allows this to be reached (e.g. no forever loop) */

    }

    Steve

  • Thanks, Steve.

    It was not apparent from the DSP-BIOS documentation that this is how it could be done.

    Regards,

    Todd Anderson