Check Illegal Memory Access
Check illegal memory access with access breakpoints using the system variable _break_.
The example stops program execution when the array save_record is accessed outside of the function clear_records. This example is written for the Measure project located in the folder \toolchain\Examples\Measure.
Expression:
// expression to check
\measure\save_record
Command:
// stop execution when save_record has been accessed outside of clear_records()
// 0x24 - size of clear_records (the size depends on the toolchain selected and needs adaptation)
// $ - PC
_break_ = ($ < \\measure\\clear_records || $ >= \\measure\\clear_records + 0x24)

Add the following test instruction to main().
save_record[1].time.hour = 0xff;
The program stops:
- While initializing the array save_record.
- Right after the test instruction has been executed.
- Whenever the array is accessed outside of clear_records.