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

Code Examples

YoIs_1298666
Level 5
250 sign-ins 100 replies posted 100 sign-ins
Level 5

Hello,

This sample project is for testing WDT.

I assume three types of runaway.

1. Hard fault occurs because of Undefined instruction on RAM address 0x20000a00 then Execution of an Undefined instruction

2. Infinite loop on RAM address 0x20000a00

3. Jump to the area padded to 0x0000 of FLASH and execute NOP to the end of FLASH.

 NOP execution from FLASH address 0x6800 to 0x7fff then Execution of an instruction from an XN memory address

The hardware fault handler CY_ISR(IntDefaultHandler) is in Cm0plusStart.c.

The hardware configuration is as follows.

pastedImage_2.png

LED11 blinks when WDT is cleared. When a reset occurs in WDT, LED9 is turned on for 10ms only.

When a reset occurs, the last byte of the array uint8 InitParameter[128] of raw unit located at address 0x1000 of FLASH memory is incremented.

To place the array uint8 InitParameter[128] at address 0x1000 in FLASH, "-Wl,--section-start=.FlashData=0x00001000" must be described in the Commander of Linker.

pastedImage_3.png

pastedImage_5.png

Please enable one of the following defines.

    #define UndefInst              // Undefined instruction on RAM address 0x20000a00 then Execution of an Undefined instruction

    #define InfiLoop                // Infinite loop on RAM address 0x20000a00

    #define NopExecut           // NOP execution from FLASH address 0x6800 to 0x7fff then Execution of an instruction from an XN memory

                                                 address

pastedImage_9.png

Best regards,

Yocchi

0 Likes
1 Reply
JeetendraA_51
Moderator
Moderator 10 replies posted 5 replies posted First reply posted
Moderator

Dear YoIs_1298666​,

Thank you for your contribution


Regards

Jeetendra Ashok

0 Likes