CY_ISR(IntDefaultHandler) for resetting system?

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
bugkiller
Level 2
Level 2
10 replies posted 50 sign-ins First like received

What I'm using : cy8c4248LQI-583 (it's custom board)

Long story short, my firmware using multiple funcition inside while(1) loop. But sometimes it getting into CY_ISR(IntDefaultHandler) and every function is paused. 80% sure it is hardware problem(because of bad PCB design). But for the temporary measure, I want to add CySoftwareReset(); into CY_ISR(IntDefaultHandler). Like this code below 

CY_NORETURN
CY_ISR(IntDefaultHandler)
{
/***************************************************************************
* We must not get here. If we do, a serious problem occurs, so go into
* an infinite loop.
***************************************************************************/

#if defined(__GNUC__)
if (errno == ENOMEM)
{
#ifdef CY_BOOT_INT_DEFAULT_HANDLER_ENOMEM_EXCEPTION_CALLBACK
CyBoot_IntDefaultHandler_Enomem_Exception_Callback();
#endif /* CY_BOOT_INT_DEFAULT_HANDLER_ENOMEM_EXCEPTION_CALLBACK */

while(1)
{

   CySoftwareReset();
/* Out Of Heap Space
* This can be increased in the System tab of the Design Wide Resources.
*/
}

Does this can work? Or I can't add any code?

Best regards, BK. 

0 Likes
1 Solution
BiBi_1928986
Level 7
Level 7
First comment on blog 500 replies posted 250 replies posted

Hello.

You can edit the source file but, each time you Build and Clean, the edited source will be over-written with new Generated Source files.  You can just do Build and you're code will remain in place, but any significant changes to schematic or C functions, will cause the same effect as Build and Clean.  So, your mileage may vary.

Since the default ISR has a 'callback' feature, use that instead.  Here's a thread on how to do that.  (Ignore the fact that the thread deals with a bootloader).
Solved: CmOStart.c -- No return exception handler -- callb... - Infineon Developer Community

 

View solution in original post

0 Likes
2 Replies
BiBi_1928986
Level 7
Level 7
First comment on blog 500 replies posted 250 replies posted

Hello.

You can edit the source file but, each time you Build and Clean, the edited source will be over-written with new Generated Source files.  You can just do Build and you're code will remain in place, but any significant changes to schematic or C functions, will cause the same effect as Build and Clean.  So, your mileage may vary.

Since the default ISR has a 'callback' feature, use that instead.  Here's a thread on how to do that.  (Ignore the fact that the thread deals with a bootloader).
Solved: CmOStart.c -- No return exception handler -- callb... - Infineon Developer Community

 

0 Likes
bugkiller
Level 2
Level 2
10 replies posted 50 sign-ins First like received

Thanks! It helped me a lot.

0 Likes