How to debug a system using the High-performance Embedded Workshop?

Question:

When debugging a system that embeds an H8S/Tiny series MCU using the High-performance Embedded Workshop, the WDT reset is generated even when WDT (watchdog timer) is stopped.

Answer:

It is possible that the WDT reset is being generated before the code that stops the WDT is executed in the program.

When a workspace is created with the High-performance Embedded Workshop, a code similar to the following ( resetprg.c ) is generated.

__entry(vect=0) void PowerON_Reset(void) {

set_imask_ccr((_UBYTE)1); _INITSCT();

HardwareSetup(); set_imask_ccr((_UBYTE)0);

main();

sleep(); }

For example, if the code is described in the program to stop the WDT in the HardwareSetup function, the WDT reset might be generated when the INITSCT function is executed and before the stop code is executed.

The H8S/Tiny series MCUs operate at low speed 0C0 (125KHz) during initialization, and the INITSCT function is be performed as follows.

The static variable area (non-initialized data area), for which the default value is not set, is initialized at zero.

The default value of the initialized data area is copied from the ROM to the RAM.

As the number of codes in the INITSCT function increases, the execution time also increases. Consequently, the probability of the WDT reset being generated before execution of the code that stops the WDT is also higher.

The following is a method for preventing the generation of such a WDT reset.