Memory allocations in uC-OS

Status
Not open for further replies.

codetrickster

Newbie level 3
Joined
Jan 8, 2014
Messages
4
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Location
Chennai, India
Activity points
41
I have a message packet as below:
dest|src|length|payload
I need to allocate memory for this message packet.
Please suggest best way to allocate memory for this packet dynamically or static using uC-OS III.
 

Pack the message into a struct. Usual rule of thumb while using any kind of RTOS is to avoid dynamic allocations as much as possible. You could create a static array of a particular size depending on your application and have a set of minimal memory management routines based off of this array - this would mean that creating a new packet would essentially be indexing into a particular location into the static 'packet' array and using this pre-allocated storage space.

Hope that helps..
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…