TX09Linux

Getting Started

The following examples are applicable for all TMPA9x0 boards which use the TMPA9xx U-Boot.

↑ Install U-Boot via JTAG  #

What's required?

Configure OpenOCD

Recent OpenOCD has the required board and interface configuration files for the TMPA900 board already. Create a configuration file for OpenOCD (topas900-jlink.cfg) containing these lines:

adapter_khz 1000
source [find interface/jlink.cfg]
source [find board/topasa900.cfg]

If you use a different board you need to use its board configuration file instead of topasa900.cfg for TopasA900 here.

Run OpenoOCD

openocd -f topas900-jlink.cfg

You should see some output like this:

Open On-Chip Debugger 0.5.0 (2011-12-03-08:57)
Licensed under GNU GPL v2
For bug reports, read
	http://openocd.berlios.de/doc/doxygen/bugs.html
1000 kHz
Info : only one transport option; autoselect 'jtag'
trst_and_srst separate srst_gates_jtag trst_push_pull srst_open_drain
adapter_nsrst_delay: 20
jtag_ntrst_delay: 20
dcc downloads are enabled
Info : clock speed 1000 kHz
Info : JTAG tap: tmpa900.cpu tap/device found: 0x07926031 (mfg: 0x018, part:0x7926, ver: 0x0)
Info : Embedded ICE version 6
Info : tmpa900.cpu: hardware has 2 breakpoint/watchpoint units

Use OpenOCD to upload U-Boot images

Now connect to OpenOCD:

$ telnet localhost 4444
Trying 127.0.0.1...
Connected to clarke.
Escape character is '^]'.
Open On-Chip Debugger

Now you halt the board with the following command:

reset halt

JTAG tap: tmpa900.cpu tap/device found: 0x07926031 (mfg: 0x018, part:0x7926, ver: 0x0)
target state: halted
target halted in ARM state due to breakpoint, current mode: Supervisor

Now initialise board and load the images to RAM. The first is used to run right from RAM in order to flash the second one into NAND.

topasa900_init
load_image /path/to/u-boot.bin 0x43f00000 
load_image /path/to/u-boot_nand_topasa900.bin 0x40100000

Run U-Boot in RAM:

resume 0x43f00000

Now you should see U-Boot output on the serial console and get a boot prompt here. Use these command to write the previously loaded U-Boot into NAND flash:

U-Boot> nand erase 0 0x80000
U-Boot> nand write 0x40100000 0 0x80000

You should get output like this:

NAND write: device 0 offset 0x0, size 0x80000                                   
 524288 bytes written: OK       

Now make sure the board is configured to boot from NAND. All DIP switches except of SELJTAG (2nd) need to be off (up).
Finally reset the board (either using button or OpenOCD).

↑ Configure networking  #

The following examples use the TFTP protocol to load image files over a network into the RAM of the board. This requires a working network connection and a properly configured TFTP server. The default IP configuration for the server's IP address is 192.168.1.1 and the board's IP address 192.168.1.2. Other addresses can be used by reconfiguring the U-Boot environment variables "ipaddr" and "serverip", e.g.:

U-Boot> setenv ipaddr 192.168.41.42
U-Boot> setenv serverip 192.168.41.43

Apart from using fixed IP adresses like these you can use DHCP for configuration (see below).

To save the new settings persistently into the NAND flash of the board the environment needs to be written into NAND flash using the following command:

U-Boot> saveenv

As a final setup step the files that shall be uploaded into the board must be copied to the appropriate position on the TFTP server.

↑ Flash Partitions  #

U-Boot currently has the following default partition layout:

device nand0 , # parts = 5
 #: name                size            offset          mask_flags
 0: u-boot              0x00060000      0x00000000      0
 1: u-boot_env          0x00020000      0x00060000      0
 2: splash              0x00300000      0x00080000      0
 3: kernel              0x00300000      0x00380000      0
 4: rootfs              0x0f980000      0x00680000      0

The symbolic partition names like "splash" or "kernel" etc. can be used with flash commands instead of addresses, e.g. the following command will erase the entire content from the partition "splash" of the NAND flash:

U-Boot> nand erase splash

↑ Install Linux Kernel Image  #

The Linux kernel image "uImage" will be loaded via TFTP into the RAM and be flashed into the "kernel" partition of the NAND flash. If you use the command "dhcp" instead of "tftp" the network will be configured using DHCP instead of used fixed adresses.

U-Boot> tftp uImage
U-Boot> nand erase kernel
U-Boot> nand write 0x40600000 kernel

↑ Install Root-Filesystem Image  #

In the same sense the root-filesystem image can be loaded via TFTP and be flashed into the "rootfs" partition of the NAND flash:

U-Boot> tftp root-filesystem-image.jffs2
U-Boot> nand erase rootfs
U-Boot> nand write 0x40600000 rootfs 0x${filesize}

The U-Boot environment contains an aditional variable which specifies the root filesystem type and location - "rootfs_base". This variable by default has the following value:

U-Boot> printenv rootfs_base
rootfs_base=setenv rootfs ${rootfs_jffs2}
U-Boot> printenv rootfs_jffs2
rootfs_jffs2=root=/dev/mtdblock5 rootfstype=jffs2

This settings causes the kernel to mount the rootfilesystem from the MTD partition no. 5 using the JFFS2 filesystem. If UBI is to be used then the following commands will do the set-up:

U-Boot> printenv rootfs_ubifs
rootfs_ubifs=ubi.mtd=5 root=ubi0:rootfs rootfstype=ubifs
U-Boot> setenv rootfs_base setenv rootfs \$\{rootfs_ubifs\}
U-Boot> saveenv

The backslashes in front of the "$" and the curly braces "{}" are necessary in order to prevent U-Boot from expanding the variable. The variable "rootfs_base" should now have the following content:

U-Boot> printenv rootfs_base
rootfs_base=setenv rootfs ${rootfs_ubifs}

Hint: Latest U-Boot release have predefined convenience scripts for installing kernel and file system. Use the commands "run update_rootfs" and "run update_kernel".

Hint: The maximum size of images to be loaded into RAM is limited by the size of the RAM! The RAM start address is at 0x40000000, U-Boot runs from RAM and is located at the end of the RAM, plus its stack. If e.g. the total RAM size is 64MB then the maximum image size is about 50-55MB. If larger images need to be written the ELDIO tool can be used.