/
Proper Use of p2_init()
Proper Use of p2_init()
Each sample application contains a p2_init()
function that gets called before uC/OS-II starts. Since not all OS services are available, only the following operations are permitted in p2_init()
:
- Initialize global variables - e.g. by direct assignment or by using C functions such as
memcpy
, ormemset
. - Create semaphores - e.g. calling
OSSemCreate()
orOSMutexCreate()
. - Initialize tasks - e.g. calling
OSTaskCreateExt()
,OSTaskNameSet()
. - Install callbacks.
Some things you should not do:
- Call other OS functions
- Print to the CLI
- Interact with peripherals or the filesystem
- Make other API calls
Operations not permitted in p2_init()
need to be done in your tasks before the while(1)
loop. If Task A requires Task B to do something, then a semaphore should be used to provide synchronization.
, multiple selections available,
Related content
What can µCOS-II do for you?
What can µCOS-II do for you?
More like this
A First Application
A First Application
More like this
Asserts and Faults
Asserts and Faults
More like this
Callback Functions
Callback Functions
More like this
Memory
Memory
More like this
Stress Testing your OCSDK Application
Stress Testing your OCSDK Application
More like this