Lesson 02: Set Stack and Heap Size for PSoC 6
There are two methods to change the STACK and HEAP size for PSoC 6 MCU device in PSoC Creator and ModusToolbox
1: Use the Preprocessor Settings open=
PSoC Creator 4.x
In the PSoC Creator, you can add the stack and heap size definitions to compiler settings.
- On the main menu, click Project ➤ Build Settings ➤ CM0+ or CM4 ➤ Compiler.
__STACK_SIZE=1000for defining a stack of size 1000 bytes and
__HEAP_SIZE=1000for defining a heap of size 1000 bytes in the Preprocessor Definitions under the General compiler setting as shown in the following Figure.
You need to define this setting for each core, toolchain, and both "Release/Debug" configurations.
Cypress recommends to "Use the Preprocessor Settings" (Method 1) for modification rather than editing the source files (Method 2) as the former approach is cleaner and maintainable in the long-run when the source files are updated.