- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi, I am working on trying to test traps for TC39x processor by triggering them. Could you please help me on how trigger the following traps from software?
-->Program Fetch Synchronous Error
--->Coprocessor Trap Asynchronous Error
----> Program Memory Integrity Error
----> Data Memory Integrity Error
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
You can refer to these code snippets to trigger these traps using the software:
The PSE (Program Fetch Synchronous Error )trap is raised when:
• A bus error occurred because of an instruction fetch.
• An instruction fetch targets a segment that does not have the code fetch property.
//Here memory access is outside the range of actual scratchpad RAMs. So bus fetch error will be generated.
typedef void (*func_t)(void);
((func_t) 0x70040000)();
CAE - Coprocessor Trap Asynchronous Error (TIN 4) can be triggered by unimplemented coprocessor instructions and arithmetic errors.
To trigger this trap, you can enable the FZE bit of the FPU_TRAP_CON register and then try to divide a non zero number with zero as denominator(Make sure that the code is not optimized while compiling). For further information about this, you can refer to section 9.5 of architecture manual 1.
PIE - Program Memory Integrity Error (TIN 5) is raised whenever an uncorrectable memory integrity error is detected in an instruction fetch.
For this trap, you can refer to the following thread: -
https://community.infineon.com/t5/AURIX/How-to-trigger-a-PIE-Trap-via-Application-code/m-p/397406
DIE - Data Memory Integrity Error (TIN 6) is raised whenever an uncorrectable memory integrity error is detected in a data access.
//Here test variable will be stored in CPU0 DSPR.
//Hence we are using i=0 for register MTU_MCi
volatile uint32 test;
IfxScuWdt_clearSafetyEndinit(IfxScuWdt_getSafetyWatchdogPassword());
MTU_MC0_ALMSRCS.B.DBE = 1;
IfxScuWdt_setSafetyEndinit(IfxScuWdt_getSafetyWatchdogPassword());
test = 0x00000000;
IfxScuWdt_clearSafetyEndinit(IfxScuWdt_getSafetyWatchdogPassword());
MTU_MC0_ECCS.B.ECCMAP = 1;
IfxScuWdt_setSafetyEndinit(IfxScuWdt_getSafetyWatchdogPassword());
test = 0x00000003;
IfxScuWdt_clearSafetyEndinit(IfxScuWdt_getSafetyWatchdogPassword());
MTU_MC0_ECCS.B.ECCMAP = 0;
IfxScuWdt_setSafetyEndinit(IfxScuWdt_getSafetyWatchdogPassword());
Kind regards
Anupama
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
You can refer to these code snippets to trigger these traps using the software:
The PSE (Program Fetch Synchronous Error )trap is raised when:
• A bus error occurred because of an instruction fetch.
• An instruction fetch targets a segment that does not have the code fetch property.
//Here memory access is outside the range of actual scratchpad RAMs. So bus fetch error will be generated.
typedef void (*func_t)(void);
((func_t) 0x70040000)();
CAE - Coprocessor Trap Asynchronous Error (TIN 4) can be triggered by unimplemented coprocessor instructions and arithmetic errors.
To trigger this trap, you can enable the FZE bit of the FPU_TRAP_CON register and then try to divide a non zero number with zero as denominator(Make sure that the code is not optimized while compiling). For further information about this, you can refer to section 9.5 of architecture manual 1.
PIE - Program Memory Integrity Error (TIN 5) is raised whenever an uncorrectable memory integrity error is detected in an instruction fetch.
For this trap, you can refer to the following thread: -
https://community.infineon.com/t5/AURIX/How-to-trigger-a-PIE-Trap-via-Application-code/m-p/397406
DIE - Data Memory Integrity Error (TIN 6) is raised whenever an uncorrectable memory integrity error is detected in a data access.
//Here test variable will be stored in CPU0 DSPR.
//Hence we are using i=0 for register MTU_MCi
volatile uint32 test;
IfxScuWdt_clearSafetyEndinit(IfxScuWdt_getSafetyWatchdogPassword());
MTU_MC0_ALMSRCS.B.DBE = 1;
IfxScuWdt_setSafetyEndinit(IfxScuWdt_getSafetyWatchdogPassword());
test = 0x00000000;
IfxScuWdt_clearSafetyEndinit(IfxScuWdt_getSafetyWatchdogPassword());
MTU_MC0_ECCS.B.ECCMAP = 1;
IfxScuWdt_setSafetyEndinit(IfxScuWdt_getSafetyWatchdogPassword());
test = 0x00000003;
IfxScuWdt_clearSafetyEndinit(IfxScuWdt_getSafetyWatchdogPassword());
MTU_MC0_ECCS.B.ECCMAP = 0;
IfxScuWdt_setSafetyEndinit(IfxScuWdt_getSafetyWatchdogPassword());
Kind regards
Anupama
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you for the info.