Initialize watchdog when running on Mynewt

On Mynewt some flash drivers on very slow devices tickle the watchdog to
avoid possible hangs; those were also trying to tickle the watchdog in
mcuboot when performing an upgrade or serial boot, without initializing
the watchdog, causing an invalid memory write and reset issue.

Signed-off-by: Fabio Utzig <utzig@apache.org>
This commit is contained in:
Fabio Utzig 2018-07-26 14:53:36 -03:00 committed by Fabio Utzig
parent 6400f0bf97
commit 0f29c48e8d
1 changed files with 5 additions and 0 deletions

View File

@ -213,6 +213,11 @@ main(void)
hal_bsp_init();
#if !MYNEWT_VAL(OS_SCHEDULING) && MYNEWT_VAL(WATCHDOG_INTERVAL)
rc = hal_watchdog_init(MYNEWT_VAL(WATCHDOG_INTERVAL));
assert(rc == 0);
#endif
#if defined(MCUBOOT_SERIAL) || defined(MCUBOOT_HAVE_LOGGING)
/* initialize uart without os */
os_dev_initialize_all(OS_DEV_INIT_PRIMARY);