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.

Static Mailbox Initialization Problem

Other Parts Discussed in Thread: SYSBIOS

I am developing on the 28069 Experimenters kit using Sys/Bios 6.34.4.22, and am running into some errors trying to create some mailboxes and events in the app.cfg file. I am statically creating pairs of events and mailboxes in the app.cfg file. But when I try to enter in the event handle in the Reader Event field of the mailbox configuration, I get this error:

XDC runtime error: ti.sysbios.knl.Mailbox: no element named ‘readerEvent’

The other problem I am having is if I leave the readerEvent field blank, the event and mailbox handles are not linking properly. I have a declaration for the events and mailboxes in a common header file like so:

#ifdef DEFINE_VARIABLES
#define EXTERN /* nothing */
#else
#define EXTERN extern
#endif /* DEFINE_VARIABLES */

EXTERN Event_Handle evtBC;

EXTERN Mailbox_Handle mbxBC;

Then I include that header file with the source code I try to use, like so:

posted = Event_pend(evtBC, Event_Id_NONE, Event_Id_00 + Event_Id_01, EVENT_TIMEOUT);

if (posted & Event_Id_00) {
  Mailbox_pend(mbxBC, msg, BIOS_NO_WAIT);

}

But I get a linking error:

#10056 symbol "_evtBC" redefined: first redefined in

  • The second half of the problem isn't an issue any longer, just the first part. Still getting the XDC runtime error. Is this a known bug with static definition of mailboxes?

  • Hi Darrell --

    It looks like there's a bug in the configuration tool.  I filed a bug for this -- SDOCM00100665.

    You should be able to set these parameters by editing the .cfg file using the text editor.

    var event0Params = new Event.Params();
    event0Params.instance.name = "event0";
    Program.global.event0 = Event.create(event0Params);

    var mailbox0Params = new Mailbox.Params();
    mailbox0Params.instance.name = "mailbox0";
    mailbox0Params.readerEvent = Program.global.event0;
    mailbox0Params.readerEventId = 0x1;
    mailbox0Params.writerEvent = Program.global.event0;
    mailbox0Params.readerEventId = 0x2;
    Program.global.mailbox0 = Mailbox.create(16, 8, mailbox0Params);

    Regards,
    -Karl-

  • I thought this fixed the problem, and it does compile without errors with this solution, however, there still appears to be bug. When a message is sent to a mailbox, the reader event is never triggered and the task hangs on the Event_pend. When dynamic mailbox is implemented in replace of the static mailbox, the reader event is triggered and the message is read from the mailbox. At this point I think I will go with dynamic mailbox initialization, but thought this should be added to the SDOCM00100665 bug report.

  • Darrell,

    Thanks for following up with your results. I'll take a closer look at this and report back within a day or so.

    Alan

  • Darrell,

    I'm sorry it took so long to respond. Are you still struggling with this issue?

    In order for Mailbox (and Semaphore) objects to support internal Event objects, this feature must be enabled by setting the Semaphore.supportsEvents config parameter to 'true'. This can be done in the GUI tool or by manually adding the following line to the configuration script:

     var Semaphore = xdc.useModule('ti.sysbios.knl.Semaphore');
     Semaphore.supportsEvents = true;

    Also, the naming of the event objects can be a little confusing.

    The readerEvent is posted by Mailbox_post(), indicating that the Mailbox is NOT EMPTY and that a call to Mailbox_pend() will not block.

    The writerEvent is posted by Mailbox_pend(), indicating that the Mailbox is NOT FULL and that a call to Mailbox_post() will not block.

    Alan

  • When I did have my mailboxes/events configured via the config script, I thought i had everything set correctly, including the semaphore support events true, and it still didn't work. However this may be because of an error on my part, and rather than debug further, I just switched to dynamic initialization, and now my mailboxes and events are working properly. The dynamic initialization makes more sense for my project now anyway, but thank you for your help, and sorry I don't have a real confirmation that the static initialization either works or doesn't work for me.