
R0E417250MCU00 User
’s Manual
R20UT3587EJ0302 Rev.3.02
Page 196 of 232
Sep.01. 21
5.14.5 Detecting Stack Access Violations
Setting the size of the stack too small in software development raises the possibility of a program going out of control or
malfunctioning. The E100 emulator actively detects abnormal access by the stack pointer.
(1) Setting stack areas
Selecting a stack section automatically assigns the addresses of the section as a stack area. Alternatively, you can enter any
desired address range. Up to 4 stack areas can be specified.
(2) Initial settings when the emulator is booted up
At the time the emulator is booted up, the default section (‘s’) is automatically selected. However, automatic selection does not
proceed until a program is downloaded, because there is no address information before this.
(3) Detection method
The emulator monitors the value of ER7 and detects if the value points to a location outside the stack areas.
Detection circuit
ER7 value
->
<Compare>
Whether the value of ER7 points
outside the stack areas
->
Error
detected
Up to 4 stack
areas
->
Figure 5.116 Outline of detection of a stack access violation
The emulator will detect the error if the value of the stack pointer is beyond the stack areas on
1. generation of an interrupt or return from an interrupt handler;
2. calling of a function or return from a function; or
3. the stack pointer pointing to a location outside reserved stack areas.
CAUTION
Detection does not cover cases of corruption of data within a stack area.
(4) Actions taken when a stack access violation is detected
The following actions are selectable.
- Display a warning.
When the Stack Access Violation checkbox has been selected on the Exception Warning page of the Configuration properties
dialog box, you will see a warning in the Status window and in a status bar balloon when errors of this type occur.
- Make the detection of a stack access violation a condition of a hardware breakpoint.
- Make the detection of a stack access violation a condition of a trace point.