Call Stack Doesn’t Unwind in Call Stack Window when CY_ASSERT() fails with a Third-party Toolchain in PSoC Creator 4.2 in PSoC 6 MCU Devices – KBA229134
- Subscribe to RSS Feed
- Mark as New
- Mark as Read
- Bookmark
- Subscribe
- Printer Friendly Page
- Report Inappropriate Content
Author: BragadeeshV_41 Version: **
Translation - Japanese: SoC 6 MCU デバイスを PSoC Creator 4.2 でサードパーティ製ツールチェーンを使用してデバッグ時に CY_ASSERT() が失敗するとコールスタックウィンドウ内のコールスタック...
Problem: In PSoC® Creator™ 4.2, when using the MDK-ARM toolchain in debugging mode, the Call Stack window doesn’t display the entire call stack (highlighted in Red color) when the program fails in the CY_ASSERT() function as shown in Figure 1.
Figure 1. Call Stack window
Reason: This is because of the default settings of the MDK-ARM toolchain. The frame pointer register that holds the address of the current application stack is used as a general-purpose register (r11), even at the minimum optimization level. Therefore, the debugger cannot unwind the full stack.
Solution: To reserve a register to store the frame pointer, you need to use the command line option --use_frame_pointer. For newer processors that support Thumb-2 technology, (ARMv6T2 and later), the reserved register is always r11.
To set this command for the compiler, do the following as shown in Figure 2:
- Right-click on the project and select Build Settings.
- Select CM4 ARM MDK Generic > Compiler > Command Line.
- Enter --use_frame_pointer in the Custom Flags field and click OK.
Figure 2. Custom Flags in Build Settings
After adding these, you will be able to see the entire Call Stack during debugging as shown in Figure 3:
Figure 3. Unwinded Call Stack
Further reading and references:
- Refer to --use_frame_pointer, --no_use_frame_pointer in the Compiler User Guide.
- ARM registers
- Refer to Usage of Frame Pointer with Arm controller
- CY_ASSERT() in PDL
- Tags:
- arm mdk
- compiler
- compiler - keil
- compiler - mdk
- debugging
- eprom
- frame pointer
- psoc 6
- third party toolchain