TS-7350: Difference between revisions

From embeddedTS Manuals
No edit summary
No edit summary
Line 183: Line 183:
Entire SD card
Entire SD card
<source lang=bash>
<source lang=bash>
dd if=/dev/mmcblk0 of=/path/to/backup.dd bs=32k
dd if=/dev/mmcblk0 of=/path/to/backup.dd bs=32k && sync && sync
</source>
</source>


Kernel
Kernel
<source lang=bash>
<source lang=bash>
dd if=/dev/mmcblk0p2 of=/path/to/zImage bs=32k
dd if=/dev/mmcblk0p2 of=/path/to/zImage bs=32k && sync && sync
</source>
</source>


Initrd
Initrd
<source lang=bash>
<source lang=bash>
dd if=/dev/mmcblk0p3 of=/path/to/initrd bs=32k
dd if=/dev/mmcblk0p3 of=/path/to/initrd bs=32k && sync && sync
</source>
</source>


Line 200: Line 200:
Entire SD card
Entire SD card
<source lang=bash>
<source lang=bash>
dd if=/path/to/backup.dd of=/dev/mmcblk0 bs=32k
dd if=/path/to/backup.dd of=/dev/mmcblk0 bs=32k && sync && sync
</source>
</source>


Kernel
Kernel
<source lang=bash>
<source lang=bash>
dd if=/path/to/zImage bs=32k of=/dev/mmcblk0p2
dd if=/path/to/zImage bs=32k of=/dev/mmcblk0p2 && sync && sync
</source>
</source>


Initrd
Initrd
<source lang=bash>
<source lang=bash>
dd if=/initrd bs=32k of=/dev/mmcblk0p3
dd if=/path/to/initrd bs=32k of=/dev/mmcblk0p3 && sync && sync
</source>
</source>


''' From SBC '''
''' From TS-7800 '''
----
----
'''Backup'''
'''Backup'''
Line 219: Line 219:
Entire card
Entire card
<source lang=bash>
<source lang=bash>
# Determine the block size
dd if=/dev/tssdcarda of=/path/to/backup.dd bs=512 && sync && sync
eval $(sdctl)
dd if=/dev/nbd5 of=/path/to/backup.dd bs=512 count=$cardsize_sectors conv=sync
</source>
</source>


Kernel
Kernel
<source lang=bash>
<source lang=bash>
sdctl -R 4096 -z 512 --seek part1 > kernel
dd if=/dev/tssdcarda2 of=/path/to/zImage bs=512 && sync && sync
</source>
</source>


Initrd
Initrd
<source lang=bash>
<source lang=bash>
sdctl -R 4096 -z 512 --seek part2 > initrd
dd if=/dev/tssdcarda3 of=/path/to/initrd bs=512 && sync && sync
</source>
</source>


Line 238: Line 236:
The entire card from SBC
The entire card from SBC
<source lang=bash>
<source lang=bash>
dd if=/path/to/2gbsd-noeclipse-latest.dd bs=512 conv=sync of=/dev/nbd5
dd if=/path/to/sdimage.dd of=/dev/tssdcarda conv=sync bs=512 && sync && sync
</source>
</source>


Kernel
Kernel
<source lang=bash>
<source lang=bash>
dd if=/mnt/root/zImage bs=512 conv=sync of=/dev/nbd7
dd if=/path/to/zImage of=/dev/tssdcarda2 conv=sync bs=512 && sync && sync
</source>
</source>


Initrd
Initrd
<source lang=bash>
<source lang=bash>
dd if=/mnt/root/initrd bs=512 conv=sync of=/dev/nbd8
dd if=/path/to/zImage of=/dev/tssdcarda3 conv=sync bs=512 && sync && sync
</source>
 
= Operating System =
Our supported OS is Debian 4.0 (Etch).  While the CPU will support OABI and EABI distributions, the kernel is limited to 2.6.21.  This will run Debian's EABI Lenny, but is not recommended for more new distributions.
 
You can find our provided distributions [ftp://ftp.embeddedarm.com/ts-arm-sbc/ts-7350-linux/distributions/ here].
 
= Linux =
== Kernel Compile Guide ==
 
{{Warning|BACKUP YOUR DATA FIRST}}
 
''' Prerequisites '''
 
This guide is intended to run on an x86 compatible Linux workstation.  While you may be able to compile the kernel on the board, we do not recommend it.  A typical workstation compile will take several minutes.  The same compile on the board will take several hours.
 
RHEL/Fedora/CentOS:
<source lang=bash>
yum install ncurses-devel ncurses
yum groupinstall "Development Tools" "Development Libraries"
</source>
<source lang=bash>
Ubuntu/Debian:
apt-get install build-essential libncurses5-dev libncursesw5-dev
</source>
 
For other distributions, please refer to their documentation to find equivalent tools.  Next you need to set up the cross compiler and sources:
<source lang=bash>
# Download the cross compile toolchain (OABI)from Technologic Systems:
wget ftp://ftp.embeddedarm.com/ts-arm-sbc/ts-7350-linux/cross-toolchains/crosstool-linux-gnueabi-2005q3-2.tar.gz
 
#Extract to current working directory:
tar xvf  crosstool-linux-gnueabi-2005q3-2.tar.gz
 
#Download the kernel sources
wget ftp://ftp.embeddedarm.com/ts-arm-sbc/ts-7350-linux/sources/linux-2.6.21-ts-src-latest.tar.gz
tar xvf linux-2.6.21-ts-src-latest.tar.gz
cd linux-2.6.21-ts
</source>
 
Export the CROSS_COMPILE variable with a path that points to the appropriate cross-compiler.  If you followed the steps above exactly, the toolchain is extracted into the same directory as the kernel.
<source lang=bash>
export CROSS_COMPILE=../arm-none-linux-gnueabi/bin/arm-none-linux-gnueabi-
export ARCH=arm
</source>
 
Now you will want to configure your settings.  You can start with our default config by running:
<source lang=bash>
make ts7350_defconfig
</source>
 
At this point you can configure any additional options with:
<source lang=bash>
make menuconfig
</source>
 
For example, to include CIFS support use the arrow and Enter keys to navigate to Filesystems -> Network File Systems -> CIFS Support.  Press "y" to include CIFS support into the kernel (alternatively, you could modularize the feature with "m" so you can enable or disable the module on demand which will also enable you to simply copy/paste the cifs.ko into the correct path in the kernel instead of copying the entire kernel (outlined below in appendix)).  Keep hitting "exit" until you're prompted to save changes, choose "yes".
 
After you have made your selection, you can build your kernel and modules with:
<source lang=bash>
make && make modules
</source>
 
{{Note|If you receive an error about PATH_MAX not being defined, you will need to edit scripts/mod/sumversion.c and add "#define PATH_MAX 1024". }}
 
The new kernel will be at "arch/arm/boot" in a compressed format called zImage (the uncompressed version is simply called Image, but it is REQUIRED that it fit in the kernel partition.  If it does not fit, you can go back in and change any changed options from included (*) to modules (m).
 
Once you have a zImage that fits, you can copy this to the SD card by following the "Restore Kernel" steps in the [[#Backup / Restore]] section.
 
You will need to install several of these modules to the initrd (third partition) of the SD card.  Mount the third partition of the SD card and copy these files:
<source lang=bash>
# Create a directory to mount this device
mkdir -p /mnt/sd/
 
# Note, your device may be something different.  Check 'dmesg' to get the correct name.  On my system, this is /dev/sdg.
# If you receive an error here, try restoring to the stock image first.  You may also need
# to load kernel modules for filesystem support.
 
mount /dev/sdg3 /mnt/sd
 
# This assumes you are still in the root of the kernel sources
cp ./drivers/mtd/nand/ts7800.ko /mnt/sd/
cp ./drivers/mmc/tssdcard.ko /mnt/sd
cp ./drivers/serial/tsuart1.ko /mnt/sd/
cp ./drivers/serial/tsuart7800.ko /mnt/sd/
cp ./drivers/usb/core/usbcore.ko /mnt/sd/
cp ./drivers/usb/host/ehci-hcd.ko /mnt/sd/
 
umount /mnt/sd && sync && sync
</source>
 
To install the modules in the Debian partition:
<source lang=bash>
mkdir newmodules
INSTALL_MOD_PATH=newmodules make modules_install
 
# Again, your device may be something different.  Check 'dmesg' to get the correct name.  On my system, this is /dev/sdg.
mount /dev/sdg4 /mnt/sd
 
# Remove the old modules
rm -rf /mnt/sd/lib/modules/2.6.21-ts/
 
# Install the new modules
cp -r newmodules/lib/ /mnt/sd/
 
umount /mnt/sd && sync && sync
</source>
 
Once you boot up to the board to Debian, you need to run 'depmod' once to calculate module dependencies.  This will not work from the fastboot as it cannot write to this directory.  After this is run, you can 'modprobe <module>' for your specific device support.
 
 
= Features =
== FPGA Features ==
=== Watchdog ===
 
<source lang=c>
#include <stdio.h>
#include <stdint.h>
#include <fcntl.h>
#include <sys/mman.h>
int main()
{
        int mem;
        volatile uint16_t *syscon;
 
        mem = open("/dev/mem", O_RDWR|O_SYNC);
        syscon = mmap(0,
                      getpagesize(),
                      PROT_READ|PROT_WRITE,
                      MAP_SHARED,
                      mem,
                      0x600FF000);
        for(;;) {
                // This feeds the watchdog for 10s.
                // The syscon starts at 0x80, and the WTD is at 0x56 in the syscon
                syscon[(0x80 + 0x56)/2] = 0x2;
                sleep(5);
        }
 
        return 0;
}
</source>
</source>

Revision as of 12:56, 3 February 2012

TS-7350
TS-7350.jpg
Product Page
Documentation
Schematic
Mechanical Drawing
FTP Path
Cirrus Logic EP9302
CPU User Guide
Specifications
Weight 90g (approx)
Operating Temperature
Cold -40C
Hot 70C
Hot 85C (166 MHz)

Overview

The TS-7350 is a compact full-featured Single Board Computer (SBC) based upon the Cirrus EP9302 200MHz ARM9 CPU, which provides a standard set of on-board peripherals. It features a programmable FPGA which is connected to a dedicated framebuffer and provides additional on-board peripherals.

Getting Started

A Linux PC is recommended for development. For developers who use Windows, virtualized Linux using VMWare or similar are recommended in order to make the full power of Linux available. The developer will need to be comfortable with Linux anyway in order to work with embedded Linux on the target platform. The main reasons that Linux is useful are:

  • Linux filesystems on the microSD card can be accessed on the PC.
  • More ARM cross-compilers are available.
  • If recovery is needed, a bootable medium can be written.
  • A network filesystem can be served.
  • Builds such as Linux kernel, buildroot, yocto, distro-seed will not work from WSL1/2 on a case insensitive filesystem.
WARNING: Be sure to take appropriate Electrostatic Discharge (ESD) precautions. Disconnect the power source before moving, cabling, or performing any set up procedures. Inappropriate handling may cause damage to the board.

The TS-7350 receives 5V-28V through the two power poles, or 5V through the PC104 bus.

Note: Pay attention to the polarity of the power connector as printed on the board.

Get a Console

Connect the TS-9445 to the 24 pin header facing outwards and use the 10 pin header (labeled "Console"). You can also telnet to the board with the default network configuration, though this will omit the TS-BOOTROM messages which are extremely useful for debugging.

Use a null modem cable to connect the ARM system to your workstation. If you do not have a COM port on your system (as many newer systems do not), you can find a USB serial adapter that will bring out RS232.

Console from Linux

There are many serial clients for Linux, but 3 simple ones would be picocom, screen, and minicom. These examples assume that your COM device is /dev/ttyUSB0 (common for USB adapters), but replace them with the COM device on your workstation.

Linux has a few applications capable of connecting to the board over serial. You can use any of these clients that may be installed or available in your workstation's package manager:

Picocom is a very small and simple client.

picocom -b 115200 /dev/ttyUSB0

Screen is a terminal multiplexer which happens to have serial support.

screen /dev/ttyUSB0 115200

Or a very commonly used client is minicom which is quite powerful:

minicom -s
  • Navigate to 'serial port setup'
  • Type "a" and change location of serial device to '/dev/ttyUSB0' then hit "enter"
  • If needed, modify the settings to match this and hit "esc" when done:
     E - Bps/Par/Bits          : 115200 8N1
     F - Hardware Flow Control : No
     G - Software Flow Control : No
  • Navigate to 'Save setup as dfl', hit "enter", and then "esc"

Console from Windows

Putty is a small simple client available for download here. Open up Device Manager to determine your console port. See the putty configuration image for more details.

Device Manager Putty Configuration

Initrd / Busybox

When the board first boots you will see this shell:

 >> TS-BOOTROM - built Jan  7 2009
 >> Copyright (c) 2008-2009, Technologic Systems
 >> Booting from SD card...
 .
 .
 .
 / # 

This is a busybox shell which presents you with a very minimalistic system. This filesystem is loaded into memory, so none of the changes will be saved unless you type 'save', or mount a filesystem as read write. This can also provide a simple mechanism for running your application in an entirely read only environment. The linuxrc script will be the first thing executed as soon as the kernel is loaded.

While busybox itself doesn't contain much functionality, it does mount the Debian partition under /mnt/root/. It will also add common paths and load libraries from the Debian system. Many of the Debian applications will work by default. If an application relies on certain paths being in certain places, or running services, you should instead boot to Debian to run them.

This shell when started on the COM port is what is blocking a Debian boot. If you close it by typing 'exit', the boot process will continue. If you are connected through telnet, this will instead open up its own instance of the shell so typing 'exit' will only end that session. Through any connection method you can relink the linuxrc script to always boot into Debian.

The initrd has these boot scripts available:

Script Function
linuxrc-fastboot (default) Boots immediately to a shell in ramdisk. This will mount whichever boot medium you have selected to /mnt/root/. When you type 'exit', it will boot to that medium.
linuxrc-fastgui This is used by the TS-7390/TS-7395 which starts X11
linuxrc-mtdroot This mounts the onboard flash (not present on the TS-7350)
linuxrc-sdroot Boots immediately to the Debian stored on SD.
linuxrc-nfsroot This script needs to be modified before use, but shows an example of how to use NFS as your debian filesystem.

For example, to set the linuxrc to boot immediately to Debian on SD or NAND, you would run this:

rm linuxrc; ln -s /linuxrc-sdroot /linuxrc; save

To use any of the other boot scripts, you can simply replace 'linuxrc-sdroot' with the script name mentioned above.

The compiled instance of busybox includes several internal commands listed below:

 BusyBox v1.7.1 (2008-08-01 11:47:44 MST) multi-call binary
 Copyright (C) 1998-2006  Erik Andersen, Rob Landley, and others.
 Licensed under GPLv2.  See source distribution for full notice.
 
 Usage: busybox [function] [arguments]...
    or: [function] [arguments]...
 
 	BusyBox is a multi-call binary that combines many common Unix
 	utilities into a single executable.  Most people will create a
 	link to busybox for each function they wish to use and BusyBox
 	will act like whatever it was invoked as!
 
 Currently defined functions:
 	[, [[, ash, basename, cal, cat, catv, chgrp, chmod, chown,
 	chroot, cksum, clear, comm, cp, cttyhack, cut, date, dd,
 	df, dirname, dmesg, du, echo, egrep, env, eptime, expr,
 	false, fdisk, fgrep, find, free, ftpget, ftpput, getopt,
 	getty, grep, gunzip, halt, head, hexdump, hostname, ifconfig,
 	insmod, kill, killall, ln, ls, lsmod, md5sum, mdev, mkdir,
 	mkfifo, mknod, modprobe, more, mount, mtdcp, mv, mvtime,
 	netstat, nice, nohup, nslookup, peekpoke, ping, ping6,
 	pivot_root, playsound, poweroff, printenv, printf, ps,
 	pscan, pwd, reboot, rm, rmdir, rmmod, route, rx, sed,
 	setconsole, setlogcons, sh, sha1sum, sleep, split, stat,
 	stty, sum, sync, tail, tar, tee, telnetd, test, tftp,
 	time, top, tr, traceroute, true, tty, udhcpc, umount,
 	uname, unzip, uptime, usleep, uudecode, uuencode, vi,
 	wget, which, xargs, zcat


We also provide the ts7000.subr which provides the following functions:

 bit_set
 bit_clr
 bit_get
 dio_dir_get
 dio_dir_set
 dio_data_get
 dio_data_set
 usb_init
 usb_off
 usb_numports
 usb_port_devexists
 eth_off
 eth_on
 led0
 led1
 cpu_speed_max
 cpu_speed_166
 cpu_speed_42
 cpu_speed_min
 pc104on
 pc104off
 nand_on
 nand_off
 lcd_on
 lcd_off
 speaker_on
 speaker_off
 wdt_on_338ms
 wdt_on_2706ms
 wdt_on_10824ms
 wdt_on
 wdt_off
 is_ts7390 
 tshelp
 sdmount
 mtdmount
 help

Boot Process

The TS-BOOTROM consists of two parts, the code in the FPGA which does low level initialization of the CPU and MMU. It reads the first 512 bytes of the SD card, and jumps execution to the binary there. The code in the MBR looks at the partition table for the first partition of type 0xda, and loads this to memory 0x8000. The second partition of type 0xda is loaded into memory at 0x1000000. This also sets up the ATAGS which are used by the kernel to identify the hardware, and so it knows where to load the initrd. After that it jumps into execution at 0x8000 to the kernel. The kernel will recognize the ATAGS (which are in a standard location for ARM at 0x100) and it will see the initrd as /dev/ram0. If you look at the default kernel config we define the cmdline as: "root=/dev/ram0 rw init=/linuxrc lpj=498688 console=null". This is so that it executes the 'linuxrc' script as soon as it mounts the initrd.

The debian filesystem is bootstrapped at the end of our own init process from the initrd:

cd /mnt/root
pivot_root . ./initrd
./bin/mount -n --move ./initrd/sys ./sys
./bin/mount -n --move ./initrd/proc ./proc
exec ./usr/sbin/chroot . ./sbin/init < .$CONSOLE > .$CONSOLE 2>&1

Backup / Restore

SD Card

If backing up on a separate workstation, keep in mind Windows does not have direct block device support needed to write these images. You will also need to determine the SD card device. You can usually find this in the output of 'dmesg' after inserting the SD card and you will typically see something like '/dev/sdb' as the block device and '/dev/sdb1' for the first partition. On some newer kernels you will see '/dev/mmcblk0' as the block device and '/dev/mmcblkop1' for the first partition. For these examples I will use the '/dev/mmcblk0' format.

If you are backing up directly on the board you will likely need to use some kind of offboard storage like a thumbdrive or external hard drive.

You can find the latest SD card image here. Make sure you decompress the image first before writing.


From Workstation


Backup

Entire SD card

dd if=/dev/mmcblk0 of=/path/to/backup.dd bs=32k && sync && sync

Kernel

dd if=/dev/mmcblk0p2 of=/path/to/zImage bs=32k && sync && sync

Initrd

dd if=/dev/mmcblk0p3 of=/path/to/initrd bs=32k && sync && sync

Restore

Entire SD card

dd if=/path/to/backup.dd of=/dev/mmcblk0 bs=32k && sync && sync

Kernel

dd if=/path/to/zImage bs=32k of=/dev/mmcblk0p2 && sync && sync

Initrd

dd if=/path/to/initrd bs=32k of=/dev/mmcblk0p3 && sync && sync

From TS-7800


Backup

Entire card

dd if=/dev/tssdcarda of=/path/to/backup.dd bs=512 && sync && sync

Kernel

dd if=/dev/tssdcarda2 of=/path/to/zImage bs=512 && sync && sync

Initrd

dd if=/dev/tssdcarda3 of=/path/to/initrd bs=512 && sync && sync

Restore

The entire card from SBC

dd if=/path/to/sdimage.dd of=/dev/tssdcarda conv=sync bs=512 && sync && sync

Kernel

dd if=/path/to/zImage of=/dev/tssdcarda2 conv=sync bs=512 && sync && sync

Initrd

dd if=/path/to/zImage of=/dev/tssdcarda3 conv=sync bs=512 && sync && sync

Operating System

Our supported OS is Debian 4.0 (Etch). While the CPU will support OABI and EABI distributions, the kernel is limited to 2.6.21. This will run Debian's EABI Lenny, but is not recommended for more new distributions.

You can find our provided distributions here.

Linux

Kernel Compile Guide

WARNING: BACKUP YOUR DATA FIRST

Prerequisites

This guide is intended to run on an x86 compatible Linux workstation. While you may be able to compile the kernel on the board, we do not recommend it. A typical workstation compile will take several minutes. The same compile on the board will take several hours.

RHEL/Fedora/CentOS:

yum install ncurses-devel ncurses
yum groupinstall "Development Tools" "Development Libraries"
Ubuntu/Debian:
apt-get install build-essential libncurses5-dev libncursesw5-dev

For other distributions, please refer to their documentation to find equivalent tools. Next you need to set up the cross compiler and sources:

# Download the cross compile toolchain (OABI)from Technologic Systems:
wget ftp://ftp.embeddedarm.com/ts-arm-sbc/ts-7350-linux/cross-toolchains/crosstool-linux-gnueabi-2005q3-2.tar.gz

#Extract to current working directory:
tar xvf  crosstool-linux-gnueabi-2005q3-2.tar.gz

#Download the kernel sources
wget ftp://ftp.embeddedarm.com/ts-arm-sbc/ts-7350-linux/sources/linux-2.6.21-ts-src-latest.tar.gz
tar xvf linux-2.6.21-ts-src-latest.tar.gz
cd linux-2.6.21-ts

Export the CROSS_COMPILE variable with a path that points to the appropriate cross-compiler. If you followed the steps above exactly, the toolchain is extracted into the same directory as the kernel.

export CROSS_COMPILE=../arm-none-linux-gnueabi/bin/arm-none-linux-gnueabi-
export ARCH=arm

Now you will want to configure your settings. You can start with our default config by running:

make ts7350_defconfig

At this point you can configure any additional options with:

make menuconfig

For example, to include CIFS support use the arrow and Enter keys to navigate to Filesystems -> Network File Systems -> CIFS Support. Press "y" to include CIFS support into the kernel (alternatively, you could modularize the feature with "m" so you can enable or disable the module on demand which will also enable you to simply copy/paste the cifs.ko into the correct path in the kernel instead of copying the entire kernel (outlined below in appendix)). Keep hitting "exit" until you're prompted to save changes, choose "yes".

After you have made your selection, you can build your kernel and modules with:

make && make modules
Note: If you receive an error about PATH_MAX not being defined, you will need to edit scripts/mod/sumversion.c and add "#define PATH_MAX 1024".

The new kernel will be at "arch/arm/boot" in a compressed format called zImage (the uncompressed version is simply called Image, but it is REQUIRED that it fit in the kernel partition. If it does not fit, you can go back in and change any changed options from included (*) to modules (m).

Once you have a zImage that fits, you can copy this to the SD card by following the "Restore Kernel" steps in the #Backup / Restore section.

You will need to install several of these modules to the initrd (third partition) of the SD card. Mount the third partition of the SD card and copy these files:

# Create a directory to mount this device
mkdir -p /mnt/sd/

# Note, your device may be something different.  Check 'dmesg' to get the correct name.  On my system, this is /dev/sdg.
# If you receive an error here, try restoring to the stock image first.  You may also need 
# to load kernel modules for filesystem support.

mount /dev/sdg3 /mnt/sd

# This assumes you are still in the root of the kernel sources
cp ./drivers/mtd/nand/ts7800.ko /mnt/sd/
cp ./drivers/mmc/tssdcard.ko /mnt/sd
cp ./drivers/serial/tsuart1.ko /mnt/sd/
cp ./drivers/serial/tsuart7800.ko /mnt/sd/
cp ./drivers/usb/core/usbcore.ko /mnt/sd/
cp ./drivers/usb/host/ehci-hcd.ko /mnt/sd/

umount /mnt/sd && sync && sync

To install the modules in the Debian partition:

mkdir newmodules
INSTALL_MOD_PATH=newmodules make modules_install

# Again, your device may be something different.  Check 'dmesg' to get the correct name.  On my system, this is /dev/sdg.
mount /dev/sdg4 /mnt/sd

# Remove the old modules
rm -rf /mnt/sd/lib/modules/2.6.21-ts/

# Install the new modules
cp -r newmodules/lib/ /mnt/sd/

umount /mnt/sd && sync && sync

Once you boot up to the board to Debian, you need to run 'depmod' once to calculate module dependencies. This will not work from the fastboot as it cannot write to this directory. After this is run, you can 'modprobe <module>' for your specific device support.


Features

FPGA Features

Watchdog

#include <stdio.h>
#include <stdint.h>
#include <fcntl.h>
#include <sys/mman.h>
 
int main()
{
        int mem;
        volatile uint16_t *syscon;

        mem = open("/dev/mem", O_RDWR|O_SYNC);
        syscon = mmap(0,
                      getpagesize(),
                      PROT_READ|PROT_WRITE,
                      MAP_SHARED,
                      mem,
                      0x600FF000);
 
        for(;;) {
                // This feeds the watchdog for 10s.
                // The syscon starts at 0x80, and the WTD is at 0x56 in the syscon
                syscon[(0x80 + 0x56)/2] = 0x2;
                sleep(5);
        }

        return 0;
}