From 9bc6fc039ee773b097944f97edd4a685ae0f0ce1 Mon Sep 17 00:00:00 2001 From: Robert Tivy Date: Thu, 7 May 2015 16:23:14 -0700 Subject: [PATCH] Throw error if configured device not found in Watchdog deviceTable Previously Watchdog.xs would cryptically error out if an unsupported device tried to use Deh. This change produces a clean error statement. --- packages/ti/deh/Watchdog.xs | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/packages/ti/deh/Watchdog.xs b/packages/ti/deh/Watchdog.xs index bf7c69d..baa7aef 100644 --- a/packages/ti/deh/Watchdog.xs +++ b/packages/ti/deh/Watchdog.xs @@ -362,6 +362,7 @@ if (xdc.om.$name == "cfg" || typeof(genCdoc) != "undefined") { function module$use() { var device; + var found = false; /* Only process during "cfg" phase */ if (xdc.om.$name != "cfg") { @@ -391,11 +392,13 @@ function module$use() Watchdog.timerSettings[i].clkCtrl = null; Watchdog.timerSettings[i].intNum = device.intNum; Watchdog.timerSettings[i].eventId = device.eventId; + + found = true; } else { print("Watchdog Timer configuration is not found for " + "timer " + timerIds[id] + " for the specified device (" + - Program.cpu.deviceName + ")."); + Program.cpu.deviceName + "). Supported devices:"); for (device in deviceTable[catalogName]) { print("\t" + device); @@ -409,6 +412,17 @@ function module$use() } } + if (!found) { + print("Watchdog Timer configuration is not found for the specified " + + "device (" + Program.cpu.deviceName + "). Supported devices:"); + + for (device in deviceTable[catalogName]) { + print("\t" + device); + } + + throw new Error ("Watchdog Timer unsupported on device!"); + } + var Settings = xdc.module("ti.sysbios.family.Settings"); var Hwi = xdc.useModule(Settings.getDefaultHwiDelegate()); -- 2.39.2