MDK-Middleware  Version 7.17.0
Software Components for MDK-Professional and MDK-Plus
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_Config.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-RTOS2 using RTX_Config.h

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-RTOS2, additional requirements for the RTOS are configured in the file. In general middleware components use statically allocated resources when RTX v5 is used and in that case no change to RTX configuration file is necessary, for details consult Resource Requirements section of related component.

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