I want to create an application using the TI-RTOS kernel (SYS/BIOS). What options do I have to create kernel objects?
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.
I want to create an application using the TI-RTOS kernel (SYS/BIOS). What options do I have to create kernel objects?
There are three methods to creating TI-RTOS kernel objects:
Below are examples of each method:
Dynamically Create
#include <ti/sysbios/knl/Semaphore.h> ... Semaphore_Handle semaphore0; Semaphore_Params semaphoreParams; Error_Block eb;
Error_init(&eb); Semaphore_Params_init(&semaphoreParams); semaphore0 = Semaphore_create(0, &semaphoreParams, &eb); if (semaphore0 == NULL) { … Semaphore_post(semaphore0);
Dynamically Construct
#include <ti/sysbios/knl/Semaphore.h> ... Semaphore_Struct semaphore0Struct; Semaphore_Params semaphoreParams;
Semaphore_Params_init(&semaphoreParams); Semaphore_construct(&semaphore0Struct, 0, &semaphoreParams); … Semaphore_post(Semaphore_handle(&semaphore0Struct));
Note: the constructed object must be converted to a handle to use.
Statically Create
The following shows a semaphore being created in the .cfg file.
var semaphore0Params = new Semaphore.Params(); Program.global.semaphore0 = Semaphore.create(0, semaphore0Params);
Here is code that uses this semaphore in the application
#include <xdc/cfg/global.h> // needed to get the global from the .cfg file #include <ti/sysbios/knl/Semaphore.h> … Semaphore_post(semaphore0);
Which method should be used to create kernel objects?
TI-RTOS examples use the construct mechanism as it seems to be a nice compromise between static and dynamic creates.
Nicely done - yet might the 'Subject/Headline' benefit from a slight tweak?
From: "TI-RTOS-MCU: How should an application create kernel objects?"
To: "Application Aid - Choices Available when creating kernel objects!"
Even though - especially though - your 'audience here' IS captive ... it remains best to 'SELL your post' - as it must compete for 'eyes/views.' (And your quality writing deserves high visits!)
You may note a thread I authored (3rd from top) started in such 'passive voice' (& was barely noted!) After a day or two - Subject's shift to 'active' - released an 'eye/view deluge' (128.7K & counting!)
[edit] Within a 10 day period this 'Frequently Asked' question appeared to be 'Infrequently viewed.' (i.e. Gained only 100 views) In contrast - the post w/more 'active' Subject (headline) drew over 1K Visits!