How to build the binaries for the TNY-A9G20-LPW from buildroot

Issue make calao_tny_a9g20_lpw_defconfig or make calao_tny_a9g20_lpw_dt_defconfig if you want to use DT

Issue make 2>&1 | tee build.log to build the binaries for the TNY-A9G20-LPW

Note: By default we use the toolchain provided by buildroot. If you want to use an external toolchain you can issue
make menuconfig and go to the Toolchain Menu in order to configure the path and prefix of your toolchain.

How to modify the barebox default config from buildroot

You can modify the default barebox settings by issuing the following command:

make barebox-menuconfig

From the menu you can add/remove features and then rebuild barebox by issuing the following command:

make

If you want to save your config file your can save by issuing the following command:

make savedefconfig

How to modify the linux kernel default config from buildroot

You can modify the default linux kernel settings by issuing the following command:

make linux-menuconfig

From the menu you can add/remove features and then re-build the linux kernel by issuing the following command:

make

If you want to save your config file you can save by issuing the following command:

Note: Depending on your linux distro you should have to issue the following command in order to create a symlink to
/dev/ttyACM0: ln -s /dev/ttyACM0 /dev/ttyUSB0

From the window below choose the tny9g20-lpw board and click on the Connect button.

Once sam-ba is loaded you should see the following window

Click on the Script File menu and click on Execute

Choose the tny-a9g20-lpw.tcl script in the calao directory.

When the tny-a9g20-lpw.tcl is interpreted, SAM-BA will ask you to browse your home directory in order to find the at91 bootstrap loader binary.

Browse your home directory in order to load the nandflash_tny_a9g20_lpw.bin file.

Note: By default the tny-a9g20-lpw.tcl script will load the binaries from ~/buildroot/output/images/

- Nand Flash Mapping Table

NAND Offset

Size

Reserved for

0x00000

128KB

at91bootstrap loader (nandflash_tny_a9g20_lpw.bin)

0x20000

256KB

bootloader (barebox.bin)

0xA0000

128KB

Device tree blob (tny_a9g20_lpw.dtb)

0xC0000

4MB

Linux kernel image (default:zImage)

0x4A0000

120MB

UBI rootfs (default:rootfs.ubifs)

After a while your board is re-flash

NOTE: If you plan to use DT you should use the DT script. Indeed this script will install the DT blob at 0xA0000

How to use barebox

Introduction

Barebox (formerly known as u-boot-v2) is a bootloader that inherits the best of U-Boot and the Linux kernel: The size and look-and-feel of u-boot, with driver model and lots of design concepts from the kernel.

Start with barebox

Once your TNY-A9G20-LPW is re-flashed, you can plug in a TTL<>RS232 converter on the 4 pin connector located on the bottom side as shown below:

Then start a terminal program on your host (minicom for instance), setup your serial link with the following parameters: 115200,n,8,1.

In your terminal window you should see something similar to the information displayed below:

If you don't stop the auto countdown, you can notice barebox tries to boot from the network.

Issue a ctrl-c from your terminal to stop the network boot stage as it is not probably well configured.

How to install a UBI rootfs from barebox

Prepare the Flash before UBI rootfs install

The /dev/nand0.root partition can be attached to ubi using

ubiattach /dev/nand0.rootfs

NOTE: Before attaching the rootfs partition to ubi please erase it with erase /dev/nand0.rootfs

Create a volume on the UBI device

ubimkvol /dev/ubi0 root 0

Load a file from a tftp server

Setup a tftp server on your host and copy the UBI rootfs from ~/buildroot/output/images/ to your tftp directory.

Setup your network from barebox:

If you have a dhcp server available on your network you can see the network parameters by issuing the following command:

devinfo eth0

If you want to modify for example the serverip variable you have to issue the following command:

eth0.serverip=192.168.1.10

Now your network setup is ok, you can load a file from barebox with the command below:

tftp zImage zImage

Issue ls and you should see your file in the / directory

Note: As the TNY-A9G20-LPW is not equipped with an ethernet interface, you will have use the MOB-TNY-MD2 development board.

Flash the UBI rootfs from barebox

Save your network settings

From the barebox command line you can save your network settings by editing the config file in /env directory:

edit env/config

env/config <ctrl-d>: Save and quit <ctrl-c>: quit
#!/bin/sh
# use 'dhcp' to do dhcp in barebox and in kernel
# use 'none' if you want to skip kernel ip autoconfiguration
ip=dhcp-barebox
dhcp_vendor_id=barebox-tny-a9g20
# or set your networking parameters here
#eth0.ipaddr=a.b.c.d
#eth0.netmask=a.b.c.d
#eth0.gateway=a.b.c.d
#eth0.serverip=a.b.c.d
# can be either 'nfs', 'tftp', 'nor' or 'nand'
kernel_loc=nand
# can be either 'net', 'nor', 'nand' or 'initrd'
rootfs_loc=nand
# can be either 'nfs', 'tftp', 'nor', 'nand' or empty
oftree_loc=none

env/config <ctrl-d>: Save and quit <ctrl-c>: quit
#!/bin/sh
# use 'dhcp' to do dhcp in barebox and in kernel
# use 'none' if you want to skip kernel ip autoconfiguration
# ip=dhcp-barebox
dhcp_vendor_id=barebox-tny-a9g20
# or set your networking parameters here
#eth0.ipaddr=a.b.c.d
#eth0.netmask=a.b.c.d
#eth0.gateway=a.b.c.d
#eth0.serverip=a.b.c.d
# can be either 'nfs', 'tftp', 'nor' or 'nand'
kernel_loc=nfs
# can be either 'net', 'nor', 'nand' or 'initrd'
rootfs_loc=net
# can be either 'nfs', 'tftp', 'nor', 'nand' or empty
oftree_loc=none
# can be either 'jffs2' or 'ubifs'
rootfs_type=ubifs

replace ip by none & modify the kernel_loc and rootfs_loc by nand as shown below:

# use 'dhcp' to do dhcp in barebox and in kernel
# use 'none' if you want to skip kernel ip autoconfiguration
# ip=dhcp-barebox
ip=none
dhcp_vendor_id=barebox-tny-a9g20
# or set your networking parameters here
#eth0.ipaddr=a.b.c.d
#eth0.netmask=a.b.c.d
#eth0.gateway=a.b.c.d
#eth0.serverip=a.b.c.d
# can be either 'nfs', 'tftp', 'nor' or 'nand'
kernel_loc=nand
# can be either 'net', 'nor', 'nand' or 'initrd'
rootfs_loc=nand
# can be either 'nfs', 'tftp', 'nor', 'nand' or empty
oftree_loc=nand
# can be either 'jffs2' or 'ubifs'
rootfs_type=ubifs
rootfsimage=root.$rootfs_type
kernelimage=zImage
#kernelimage=uImage
#kernelimage=Image
#kernelimage=Image.lzo

Save your config file by issuing Ctrl-d

Note: If you built a linux kernel with DT, you should specify where your DT blob is located with oftree_loc

Now to save your config issue the following command :

saveenv

Issue reset in order to check your default boot sequence

reset

How to use the dfu

DFU for Device Firmware upgrade can be used to download and upload barebox, linux kernel and the rootfs to the TNY-A9G20-LPW connected over USB.

Let's assume that you want to upgrade your kernel image from barebox.

Plug a usb cable in the micro USB connector as shown below:

Note: As there's no user push button available on the TNY-A9G20-LPW, you will have to start the dfu
from the barebox command line by issuing the following command:dfu ${dfu_config} -P ${product_id} -V ${vendor_id}

Now from your host you can start dfu-util

Note: dfu-util can be installed on your host from buildroot or by downloading the package.

Note: The rootfs.ubi is an image of the UBI rootfs and can be built from buildroot

How to download a file from the serial port

If you want to download a file through the serial port you can issue the following command on your target:

loadb -f filename -c

From your host you can use for instance C-Kermit and issue the command below in order to send a file to your TNY-A9G20-LPW:

~$ kermit
?SET SPEED has no effect without prior SET LINE
C-Kermit 8.0.211, 10 Apr 2004, for Linux
Copyright (C) 1985, 2004,
Trustees of Columbia University in the City of New York.
Type ? or HELP for help.
Linux Kermit> send filename

Note: You should configure kermit by editing the kermrc file located in /etc/kermit/