CYGPKG_DEVS_WATCHDOG_NIOS2_AVALON_TIMER — eCos Support for a Nios II Avalon Timer-based Watchdog Device


A Nios II hardware design can include an Avalon timer which acts as a watchdog device. Once started it will automatically reset the processor unless software updates the device at regular intervals. The package CYGPKG_DEVS_WATCHDOG_NIOS2_AVALON_TIMER provides an eCos driver for this device, complementing the generic package CYGPKG_IO_WATCHDOG. The functionality should be accesssed via the standard eCos watchdog functions.

Configuration Options

The Avalon watchdog driver package should be loaded automatically when creating an eCos configuration for a hardware design which includes a suitable watchdog device, and it should never be necessary to load the package explicitly. The package is inactive unless the generic watchdog support CYGPKG_IO_WATCHDOG is loaded. Depending on the choice of eCos template it may be necessary to load the latter.

The package provides a configuration option CYGIMP_WATCHDOG_HARDWARE. This can be used to disable the use of the hardware watchdog and switch to a software emulation provided by the generic watchdog package instead. This may prove useful during debugging. The package also provides two configuration options for manipulating the compiler flags used to build the driver.


A hardware design requiring a watchdog should include an Avalon timer labelled “watchdog”. This timer should use the presets for a watchdog device: no writeable period, no readable snapshot, no start/stop control bits, no timeout pulse, system reset on timeout. The watchdog period can be set to any desired value, subject to the constraints of a 32-bit counter and the hardware's input clock. For example if the hardware runs at 100MHz then the watchdog period is limited to at most 42.9 seconds.

The hardware design HAL package should include definitions for HAL_NIOS2_AVALON_TIMER_WATCHDOG_BASE and HAL_NIOS2_AVALON_TIMER_WATCHDOG_PERIOD. In addition the ecos.db target entry should list CYGPKG_DEVS_WATCHDOG_NIOS2_AVALON_TIMER as one of the hardware packages.