![]() |
![]() |
![]() |
![]() |
![]() |
Technical Details for Memory Estimations
Allocating Dynamic Memory
Introduction
This section shows when and how dynamic memory allocation is used in the Cmicro Package. It shows,
The Cmicro Package uses a form of dynamic memory management for the following objects:
However, real dynamic memory management is used only in one case, namely for SDL signals, if a signal carries parameters with more than a few bytes.
This means that the Cmicro Kernel has its own memory management to handle processes, signals, and timers. This is done in such a way that each of these 3 objects are managed separately. For each of these 3 objects, a separate fixed memory area is reserved during compilation time, i.e. the area that handles processes cannot be reused to handle timers. This seems to be a restriction but in many micro controller applications users have to fix an upper limit of processes, signals and timers which can be handled in parallel during run time.
Processes
Processes are handled without dynamic memory allocation functions. The user has to specify an upper limit of process instances in the SDL diagram separately for each SDL process. For each process instance, there is a variable which is statically allocated.
Signals with and without Parameters
Cmicro signals are both ordinary SDL signals as well as timer signals. Where timers are implemented without parameters and can therefore be regarded as signals without parameters.
- No malloc/free for timers
- No malloc/free for signals without parameters
- No malloc/free for signals with parameters if less than or equal to XMK_MSG_BORDER_LEN bytes parameters are to be transferred.
- malloc and free are used for signals with parameters if more than XMK_MSG_BORDER_LEN bytes parameters are to be transferred.
- XMK_MSG_BORDER_LEN bytes is a macro defined in the manual configuration file ml_mcf.h. It can be set to any value, i.e. zero or the maximum number of signal parameters to be handled in the system.
Timers
For timers, no malloc and free functions are used. The Cmicro SDL to C Compiler evaluates the amount of timers in the system and generates a C constant, which is then used in the Cmicro Kernel to define an array for timers.
http://www.ibm.com/rational |
![]() |
![]() |
![]() |
![]() |