This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Enabling hardware watchdog from u-boot in am335x gives error

Hi,

I am using am335x sdk with ti-processor-sdk-linux-am335x-evm-01.00.00.00-Linux-x86-Install.bin and u-boot with u-boot-2014.07-g7e537bf. I want to enable hardware watchdog from from board_init(void) function which is as below.

int board_init(void)
{
#if defined(CONFIG_HW_WATCHDOG)
        hw_watchdog_init();
#endif
      |
      |

}


So i defined CONFIG_HW_WATCHDOG macro in include/watchdog.h. But while compiling it gives following error.

HOSTCC  tools/mkimage.o
  HOSTLD  tools/mkenvimage
  HOSTLD  tools/dumpimage
tools/lib/sha1.o: In function `sha1_csum_wd':
sha1.c:(.text+0x251f): undefined reference to `hw_watchdog_reset'
sha1.c:(.text+0x254d): undefined reference to `hw_watchdog_reset'
tools/lib/sha256.o: In function `sha256_csum_wd':
sha256.c:(.text+0x312f): undefined reference to `hw_watchdog_reset'
sha256.c:(.text+0x315d): undefined reference to `hw_watchdog_reset'
collect2: error: ld returned 1 exit status
scripts/Makefile.host:127: recipe for target 'tools/dumpimage' failed
make[1]: *** [tools/dumpimage] Error 1
Makefile:1008: recipe for target 'tools' failed
make: *** [tools] Error 2

Is there anything else need to add/change in code?

Thanks in advance,

Nilesh

  • I think you also need #define CONFIG_OMAP_WATCHDOG. Put CONFIG_HW_WATCHDOG and CONFIG_OMAP_WATCHDOG in the include/configs/am335x_evm.h file.

    Steve K.
  • Hi Steve,

    I did as you mentioned, but still it's not solves my problem. board.c files includes watchdog.h and not include/configs/am335x_evm.h. So i think that's why it's not taking effect.

    Regards,
    Nilesh
  • All the #define CONFIG_ should go in am335x_evm.h. When you do the 'make am335x_evm_config' the file include/configs.h will have #include <am335x_evm.h> in it. Then config.h is included in common.h which is included in board.c.

    Steve K.
  • Steve i did this thing also but still it gives error while compiling. error is undefined reference to `hw_watchdog_reset'. After defining CONFIG_HW_WATCHDOG, Please give me any other solution.

    Thanks,

    Nilesh

  • Did you also define CONFIG_OMAP_WATCHDOG? These are the last few lines in my include/configs/am335x_evm.h

    #endif  /* NOR support */

    #define CONFIG_HW_WATCHDOG
    #define CONFIG_OMAP_WATCHDOG


    #endif  /* ! __CONFIG_AM335X_EVM_H */

    I build without errors.

    Steve K.

  • Hi Steve,

    As you suggested, defining these two macro builds without any error. But arch/arm/cpu/armv7/omap-common/boot-common.c file have below line in spl_board_init() function.

    #if defined(CONFIG_HW_WATCHDOG)

    hw_watchdog_init();

    #endif

    Now as this macro is defined in am335x_evm.h function hw_watchdog_init() should be called. But it's not. Any way i have commented out #if defined(CONFIG_HW_WATCHDOG) check and now watchdog works. If you can give any solution on this then it would be better for me otherwise i can comment out check.

    Now Second problem is that hw_watchdog_init() is goes to call file drivers/watchdog/omap_wdt.c. My question is that watchdog timeout is almost 5 minutes though it was defined as 1 minute as below.

    /* Hardware timeout in seconds */

    #define WDT_HW_TIMEOUT 60

    Also i have tried to change 60 to 2 but timeout remains almost 5 minutes. So i think changing WDT_HW_TIMEOUT doesn't take any effect. From where can i change this watchdog timeout?

    Thanks,

    Nilesh