[WORK IN PROGRESS!]
This example walks you through making use of the Nios II's MPU in a HAL-based (no OS) environment. The MPU is used to detect 3 commonly seen issues when debugging embedded software and systems. These are:
Stack overflow detection is achieved by creating a small high priority exclusion data region in the middle of a larger data region where both the stack and the heap reside. Whenever the stack grows downwards or the heap grows upwards into this exclusion region, an exception is triggered and the software detects it.
NULL pointer detection is achieved by making sure that no regions include offset 0x0. The example system is purposely designed such that no components (memory or otherwise) are located at this offset. Whenever uninitialized data is accessed, this NULL pointer detection scheme triggers an exception and software is able to detect it.
"Wild" pointer detection is achieved by creating very large low priority exclusion regions covering the majority of the memory map. In this way, if an instruction execution or data access outside of valid memory or peripheral I/O happens, the MPU triggers an exception and software can detect it.
| File | Size | Date | Attached by | |||
|---|---|---|---|---|---|---|
| MPU_Designs.zip Design examples for both "limit" and "mask" mode for region size determination. | 218.66 kB | 20:01, 18 Aug 2009 | brankin | Actions | ||
| MPU_Usage.pdf Updated to include instructions on how to properly disable MPU regions. | 242.01 kB | 20:31, 18 Aug 2009 | brankin | Actions | ||