Watchdog Timer Sample Code - Advantech ROM-3420CD-MDA1E User Manual

Rom-3420 series risc-based rtx module with freescale i.mx6 arm cortex a9 processor
Table of Contents

Advertisement

Edit the helloworld.c with the following source code:
#include <stdio.h>
void main()
{
   printf("Hello World!\n");
}
10.
Save the file and exit.
#$CC ‐o helloworld helloworld.c (To compile helloworld.c)
11.
12.
Then you can see "helloworld" in current directory.
13.
Insert the Linux system SD card to your development computer.
#cp helloworld /media/rootfs/tool (/media/rootfs is the mounted point of
14.
your Linux system SD card)
15.
Remove this SD card and insert it to ROM-DB3900, then open debug console.
On ROM-3420 platform, type #root (Login)
16.
On ROM-3420 platform, type #cd /tool
17.
On ROM-3420 platform, type #./helloworld 
18.
19.
Now you should be able to see "Hello World!" shown on ROM-3420.
3.8.2

Watchdog Timer Sample Code

WatchDog Timer (WDT) sample code is as below:
   #include <stdio.h>
   #include <stdlib.h>
   #include <fcntl.h>
   #include <linux/watchdog.h>
   #include <sys/ioctl.h>
   #include <unistd.h>
   void help_info(void);
   int main(int argc, const char *argv[])
   {
   
int fd, timeout, sleep_sec, test;
   
int count=1;
   
if (argc < 2) {
   
   
   
}
   timeout = atoi(argv[1]);
   
sleep_sec = atoi(argv[2]);
   
if (sleep_sec <= 0) {
   
   
   
   
}
   
test = atoi(argv[3]);
help_info();
return 1;
sleep_sec = 1;
printf("correct 0 or negative sleep time to %d seconds\n",
       sleep_sec);
31
ROM-3420 User Manual

Advertisement

Table of Contents
loading

This manual is also suitable for:

Rom-3420wd-mda1eRom-3420cq-mda1eRom-3420wq-mda1e

Table of Contents