'Bare' (no PEx, no SDK) projects created with KDS V1.0.1 beta have the issue that the watchdog is not disabled (see KDS V1.0.1beta release notes).
This document explains how to disable the watchdog for the FRDM-KL25Z (steps are similar to other boards).
Add the derivative header file to your project. The header files are located in
C:\Freescale\KDS_1.0.1\eclipse\ProcessorExpert\lib\Kinetis\iofiles
Copy the matching header into the Startup_Code folder:
Open startup.c and locate the function __init_hardware().
Include the derivative header file and the code to disable the watchdog:
This will disable the watchdog during startup. The above project is attached as a reference.
#define STARTUP_WDOG_STCTRLH_VALUE | 0x01D2U /* WDOG_STCTRLH value */ |
#define STARTUP_WDOG_KEY_1 | 0xC520U /* Watchdog unlock key 1 */ |
#define STARTUP_WDOG_KEY_2 | 0xD928U /* Watchdog unlock key 2 */ |
void __attribute__ ((weak)) __init_hardware(void)
{
/* Disable the WDOG module */
WDOG_UNLOCK = (uint16_t)STARTUP_WDOG_KEY_1; /* Key 1 */
WDOG_UNLOCK = (uint16_t)STARTUP_WDOG_KEY_2; /* Key 2 */
WDOG_STCTRLH = (uint16_t)STARTUP_WDOG_STCTRLH_VALUE; /* Disable WDOG */
}