MDK Components  Version 6.6
MDK-Professional Middleware
 All Pages
Stack, Heap and RTOS Configuration

Every software component has resource requirements for stack, heap, and memory. Configuration files such as startup_device.s and RTX_Conf_CM.h need to be adapted to these requirements. Every middleware component has a section that explains the resource requirements and gives examples on how to calculate the resulting values for adaption of the configuration files.

Configuring Stack using startup_device.s

The startup_device.s file is provided by the device vendor in a Device Family Pack. The file will be copied into a µVision project automatically after selecting Device:Startup in the Manage Run-Time Environment window. It is used to configure the size of the stack that is used by exceptions and interrupt service routines (ISR) for the current project. The stack size requirements depend on the maximum nesting of exception and ISR execution and therefore on the priority settings of the various interrupt and exception sources. Also, the heap which is used by memory allocation functions is configured in this file.

Most of the middleware components only require additional stack size, whereas the File System component also requires additional heap size. The memory requirements are stated in the Resource Requirements section of each Middleware component.

Configuring CMSIS-RTOS using RTX_Conf_CM.c

The stack size in the startup_device.s file configures only the stack space that is used by exceptions and interrupt service routines (ISR). When using a CMSIS-RTOS, additional requirements for the RTOS are configured in the RTX_Conf_CM.c file. Depending on the Middleware component, for example the number of user threads, thread stack sizes or even user timers need to be configured.

The additional CMSIS-RTOS related requirements are also stated in the Resource Requirements section of each Middleware component.