From 4f33dd14d4e969b1250ec72b46fd222339fcb3a5 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Wed, 18 May 2016 19:21:51 -0600 Subject: [PATCH] apps/examples/watchdog: Remove call to up_wdginitialize(). This must be done in board-specific initialization. The call fram application space is not permitted. --- examples/watchdog/Kconfig | 15 +++++++++++++++ examples/watchdog/watchdog_main.c | 29 +---------------------------- 2 files changed, 16 insertions(+), 28 deletions(-) diff --git a/examples/watchdog/Kconfig b/examples/watchdog/Kconfig index 6e9e5c55f..42121531d 100644 --- a/examples/watchdog/Kconfig +++ b/examples/watchdog/Kconfig @@ -9,6 +9,21 @@ config EXAMPLES_WATCHDOG ---help--- Enable the watchdog timer example + In order to use this example, board specific logic must register the + watchdog timer driver. That would be in the board bring-up logic + in the configs//src directory for the board. + + The way that this is done depends on the underlying MCU architecture. + For STM32, this would be done like: + + #include "stm32_wdg.h" + + #if defined(CONFIG_STM32_WWDG) + stm32_wwdginitialize(CONFIG_STM32_WDG_DEVPATH); + #elif defined(CONFIG_STM32_IWDG) + stm32_iwdginitialize(CONFIG_STM32_WDG_DEVPATH, CONFIG_STM32_LSIFREQ); + #endif + if EXAMPLES_WATCHDOG config EXAMPLES_WATCHDOG_DEVPATH diff --git a/examples/watchdog/watchdog_main.c b/examples/watchdog/watchdog_main.c index aeff559dd..edce88b4e 100644 --- a/examples/watchdog/watchdog_main.c +++ b/examples/watchdog/watchdog_main.c @@ -1,7 +1,7 @@ /**************************************************************************** * examples/watchdog/watchdog_main.c * - * Copyright (C) 2012 Gregory Nutt. All rights reserved. + * Copyright (C) 2012, 2016 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -53,10 +53,6 @@ #include "watchdog.h" -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - /**************************************************************************** * Private Types ****************************************************************************/ @@ -68,18 +64,6 @@ struct wdog_example_s uint32_t timeout; }; -/**************************************************************************** - * Private Function Prototypes - ****************************************************************************/ - -/**************************************************************************** - * Private Data - ****************************************************************************/ - -/**************************************************************************** - * Public Data - ****************************************************************************/ - /**************************************************************************** * Private Functions ****************************************************************************/ @@ -238,17 +222,6 @@ int wdog_main(int argc, char *argv[]) parse_args(&wdog, argc, argv); - /* Initialization of the WATCHDOG hardware is performed by logic external to - * this test. - */ - - ret = up_wdginitialize(); - if (ret != OK) - { - printf("wdog_main: up_wdginitialize failed: %d\n", ret); - goto errout; - } - /* Open the watchdog device for reading */ fd = open(CONFIG_EXAMPLES_WATCHDOG_DEVPATH, O_RDONLY);