스택 오버플로

기술노트 57348

아키텍처:

All

컴포넌트:

debugger

업데이트:

2018-02-28 오전 1:57

Introduction

It some cases, C-SPY issues warnings such as ...

The stack 'CSTACK' is filled to 100% (4096 bytes used out of 4096). The warning threshold is set to 90%

... and there is no reason for the warning, as there should be plenty of free space in the stack.

Background

When a project is created then the options are set to default values. One such default value is to enable the C stack(s) checking.

The possibility to check the ordinary C stack(s) is a good feature when writing and debugging an ordinary embedded application.

On the other hand, in an application with an RTOS, the C stack(s) checking will not work as intended. The C stack(s) checking is not able to 'understand' why the stack pointers are outside the 'known' stack areas. The reason for this situation is that the RTOS maintains and switches between the different stacks of the different tasks in the RTOS application.

The C stack(s) checking in C-SPY is integrated into IAR Embedded Workbench. (Earlier, the stack checking was handled by a C-SPY plugin.)

Solution

Disable the warning message by removing the checkmark for Tools > Options... > Debugger > 'Warn when stack pointer is out of bounds'

For an old version of IAR Embedded Workbench which uses the C-SPY stack plugin, disable the plugin by removing the checkmark for Project > Options > Debugger > Plugins > Stack

When using an RTOS, do not enable the C-SPY C stack(s) checking. Note that it might be possible to enable task stack checking in the plugin for the RTOS.

Other problem situations

If the application do not use an RTOS, the reason for the warning can be either ...

  • a correct warning, implying that changes are needed in the embedded application, or ...
  • the application is (at least partially) built without debug information. Note that the C stack(s) checking can not work as intended without debug information. In this situation disable the C stack(s) checking.

 All product names are trademarks or registered trademarks of their respective owners.

죄송하지만, 당사 사이트에서는 Internet Explorer를 지원하지 않습니다.보다 편안한 사이트를 위해 Chrome, Edge, Firefox 등과 같은 최신 브라우저를 사용해 주시길 부탁드립니다.