The Advanced Event Triggering (AET) Hardware is setup to watch writes to a particular memory range. For every write to the memory range, the AET performs a store Program Address and captures the exact location in code, where the write happenned or the AET can be configured to generate an interrupt to the Core Interrupt Controller(Core INTC), which if required can be routed as an exception to the CPU. This is very useful to debug any memory corruption issues from unintended accesses. The idea here is to setup the memory watch job during the system startup and instrument the application to disable the memory watch during intended accesses and re-enable it after it is done with the intended accesses.
The sequence for configuring memory watch point is given below:
- ctools_memwatch_aetint_setup () or ctools_memwatch_store_pc_setup () - Setup and start the memory watchpoint job for either storing PC or generating AET interrupt on an unintended access.
- Application code were unintended accesses to the required memory range might occur.
- ctools_memwatch_disable () - Should be called before any valid or intended accesses to the memory range being watched.
- Application code were intended accesses to the required memory range happen.
- ctools_memwatch_enable() - Should be called after any valid or intended accesses to the memory range being watched.
- Application code were unintended accesses to the required memory range might occur.
- ctools_memwatch_close() - Close and free up all resources allocated for the memory watch job
If ctools_memwatch_store_pc_setup () is used, the captured PC trace samples can be exported for analysis in 2 ways.
- DSP ETB drain using CPU (capture only 4KB of PC trace data)
-
- External Emulator like XDS560 PRO or XDS560T
-
Please Note: If required, using EDMA the DSP ETB can be extended to more than 4 KB for storing PC trace samples. However, generally the number of unintended accesses should be small and hence, the in built 4 KB ETB should suffice. The Sequence for EDMA based ETB extension can be found in PC Trace use cases section.