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.
Hello,
Maybe I am going about this the wrong way, but I'm wondering if there is a way to access some of the values that get set up in the release.cfg configuration file for TI-RTOS from within C code, when setting up statically-allocated objects.
Specifically, if I set up a Mailbox object, whose size is N messages of M bytes each, is there a way from within my C code to refer to "M", so that I can do things like set up a buffer that is "M" bytes long as a working buffer, or check that I haven't written more than "M" bytes to that buffer, etc.
That way, if I later decide to change "M", I just have to do it once in the XGCONF tool, and not multiple places thruout the code.
Thanks,
Russ
From a quick look I can't see that a mailbox created statically in the .cfg creates such definitions which are available to the C code.Russell Hoffman said:Specifically, if I set up a Mailbox object, whose size is N messages of M bytes each, is there a way from within my C code to refer to "M"
However, found that it is possible to create Program.global variables in the .cfg file which are used to create the mailbox. E.g.:
var Mailbox = xdc.useModule('ti.sysbios.knl.Mailbox'); var mailbox0Params = new Mailbox.Params(); mailbox0Params.instance.name = "mailbox0"; Program.global.mailbox0_msg_size = 20; Program.global.mailbox0_num_msgs = 64; Program.global.mailbox0 = Mailbox.create(Program.global.mailbox0_msg_size, Program.global.mailbox0_num_msgs, mailbox0Params);
The <xdc/cfg/global.h> include file which can included by the C code then contains #defines based upon the Program.global variables set in the .cfg file. E.g. for the above got:
#define mailbox0_msg_size 0x14 #define mailbox0_num_msgs 0x40 #include <ti/sysbios/knl/Mailbox.h> extern const ti_sysbios_knl_Mailbox_Handle mailbox0;
**Attention** This is a public forum