Starting with TI EZSDK C6A816x – Video Tutorial
For HW engineers it demonstrates how to build Linux for a board and Software engineers will find here some useful commands for using TI EZSDK.
Before you start – install TI EZSDK as described in this post:
TI EZSDK Installation Tutorial for DM816x / C6A816x / AM389x / DM814x / AM387x
Content
BOOTING THE BOARD from Network, SD or NAND
Running Kernel and File system from network
Booting from SD CARD
Booting from NAND
FLASHING UBoot
Flashing u-Boot to NAND
Flashing u-Boot to SPI
USING JTAG to FLASH UBOOT INTO NAND
PREPARING THE BINARY FILES (UBOOT, KERNEL, FILE SYSTEM)
U-Boot compilation
Kernel compilation
File system
Other useful things …
Using GPIO
UBOOT: Set different serial port in U-Boot for console output
UBOOT: Add support for recognision of an unsupported Winbond SPI memory chip
Always check/update IP address which is used in many commands of this tutorial. The address should be the same as IP address of your linux Machine with EZSDK installed on it. Check host IP address by command: ifconfig
Always check console number. Some boards use a different serial port for console output e.g ttyO0, ttyO2 (default for EZSDK), …
Always check file size after TFTP transfer. If needed, adjust the size which is used in many commands in case the image is being flashed into memory
Follow the steps in: Kernel compilation
setenv bootcmd ´run addip;tftp 81000000 uImage;bootm´
setenv hostname KDS01
setenv addip ´setenv bootargs ${bootargs} ip=${ipaddr}:${nfsserver}:${gatewayip}:${netmask}:${hostname}:eth0:off´
setenv autoload no
setenv nfsserver 192.168.0.22
setenv bootargs ´console=ttyO2,115200n8 root=/dev/nfs nfsroot=192.168.0.22:/home/vmplanet/targetfs,nolock rw mem=128M rootdelay=4 notifyk.vpssm3_sva=0xBF900000 vram=50M ti816xfb.vram=0:16M,1:16M,2:6M´
setenv serverip 192.168.0.22
saveenv
Follow the steps in: U-Boot compilation – SD min
cp MLO /home/vmplanet/ti-ezsdk_dm816x-evm_5_02_02_60/board-support/host-tools/
Follow the steps in: U-Boot compilation – NAND / SPI
Follow the steps in: Kernel compilation
cp MLO /home/vmplanet/ti-ezsdk_dm816x-evm_5_02_02_60/board-support/host-tools/
tar czvf /home/vmplanet/nfs.tar.gz *
cp /home/vmplanet/nfs.tar.gz /home/vmplanet/ti-ezsdk_dm816x-evm_5_02_02_60/board-support/host-tools/
mount
umount /media/boot
umount /media/rootfs
sudo ./mksd-ti816x.sh /dev/sdc MLO u-boot.bin uImage nfs.tar.gz
gedit boot.txt
setenv bootcmd ´mmc init; fatload mmc 1 0x81000000 uImage; bootm 0x81000000´
boot
Follow the steps in: Kernel compilation
ALWAYS CHECK size of uImage after tftp transfer and correct the value 0x280000. Check host IP.
setenv serverip 192.168.0.22
mw.b 0x81000000 0xFF 0x280000
tftp 0x81000000 uImage
nand erase 0x00280000 0x00280000
nand write 0x81000000 0x00280000 0x280000
Follow the steps in: File system
ALWAYS CHECK size of rd-jffs2.bin after tftp transfer and correct the value 0x0700000. Check host IP.
setenv serverip 192.168.0.22
mw.b 0x81000000 0xFF 0x0700000
tftp 0x81000000 rd-jffs2.bin
nand erase clean 0x006C0000 0x0700000
nand write 0x81000000 0x006C0000 0x700000
ALWAYS CHECK if the size is correct and same as in Kernel and File system above
setenv bootargs ´mem=128M console=ttyO2,115200n8 noinitrd root=/dev/mtdblock7 rw rootfstype=jffs2 notifyk.vpssm3_sva=0xBF900000 vram=50M ti816xfb.vram=0:16M,1:16M,2:6M´
saveenv
Follow the steps in: U-Boot compilation – NAND
Note: ALWAYS CHECK size of u-boot.noxip.bin after tftp transfer and correct the value 0x260000 if needed. Check IP address.
setenv serverip 192.168.0.22
mw.b 0x81000000 0xFF 0x260000
tftp 0x81000000 u-boot.noxip.bin
nand erase 0x0 0x260000
nandecc hw 2
nand write.i 0x81000000 0x0 0x260000
nandecc hw 0
Follow the steps in: U-Boot compilation – SPI
Note: ALWAYS CHECK size of u-boot.noxip.bin.spi after tftp transfer and correct the value 0x40000 if needed. Check IP address.
setenv serverip 192.168.0.22
mw.b 0x81000000 0xFF 0x100000
tftp 0x81000000 u-boot.noxip.bin.spi
sf probe 0:0
sf erase 0x0 0x40000
sf write 0x81000000 0x0 0x40000
export PATH=/home/vmplanet/CodeSourcery/Sourcery_G++_Lite/bin:$PATH
export PATH=/home/vmplanet/ti-ezsdk_dm816x-evm_5_02_02_60/board-support/u-boot-2010.06-psp04.00.00.12/tools:$PATH
make CROSS_COMPILE=arm-none-linux-gnueabi- ARCH=arm distclean
make CROSS_COMPILE=arm-none-linux-gnueabi- ARCH=arm ti8168_evm_min_sd
make CROSS_COMPILE=arm-none-linux-gnueabi- ARCH=arm u-boot.ti
make CROSS_COMPILE=arm-none-linux-gnueabi- ARCH=arm distclean
make CROSS_COMPILE=arm-none-linux-gnueabi- ARCH=arm ti8168_evm_config_nand
make CROSS_COMPILE=arm-none-linux-gnueabi- ARCH=arm u-boot.ti
make CROSS_COMPILE=arm-none-linux-gnueabi- ARCH=arm distclean
make CROSS_COMPILE=arm-none-linux-gnueabi- ARCH=arm ti8168_evm_config_spi
make CROSS_COMPILE=arm-none-linux-gnueabi- ARCH=arm u-boot.ti
export PATH=/home/vmplanet/CodeSourcery/Sourcery_G++_Lite/bin:$PATH
export PATH=/home/vmplanet/ti-ezsdk_dm816x-evm_5_02_02_60/board-support/u-boot-2010.06-psp04.00.00.12/tools:$PATH
Kernel compilation
make CROSS_COMPILE=arm-none-linux-gnueabi- ARCH=arm distclean
make CROSS_COMPILE=arm-none-linux-gnueabi- ARCH=arm ti8168_evm_defconfig
make CROSS_COMPILE=arm-none-linux-gnueabi- ARCH=arm uImage
cp /home/vmplanet/ti-ezsdk_dm816x-evm_5_02_02_60/board-support/linux-2.6.37-psp04.00.00.12/arch/arm/boot/uImage /tftpboot/
Note: Original EZSDK targetfs is quite large. I will use VOIPAC file system.
wget http://voipac.com/downloads/imx/25/bin/rootfs-nfs-bb-1-17-vmx25-vmx25-vpac3.tar.gz
sudo tar xvf rootfs-nfs-bb-1-17-vmx25-vmx25-vpac3.tar.gz
sudo gedit rootfs-bb-1-17-final2/etc/inittab
change from:
::respawn:/sbin/getty -L tty1 115200
to
::respawn:/sbin/getty -L ttyO2 115200 //use correct console number: for standard EZSDK board use: ttyO2
then Save and Close
Make the image
CTRL+F and look for: CONFIG_GPIO_SYSFS
Change from:
to:
Set the selected pins into GPIO mode
CTRL+F and look for: TI816X_MUX(GPMC_A27, OMAP_MUX_MODE1), /* gpio-20 */
Add custom configuration:
//Pin names and MODE are based on MUX81xx.c file
TI816X_MUX(SC0_DET, OMAP_MUX_MODE2), /* gpio1-9: Custom Baseboard LED */
TI816X_MUX(SC0_C4, OMAP_MUX_MODE1), /* gpio1-13: Custom Module LED */
Save and Close
Compile new Kernel
Follow the steps in: Kernel compilation
Run your board with the new kernel and use following commands to control GPIO
//module LED
root@dm816x-evm:/sys/class/gpio# echo 45 > export
root@dm816x-evm:/sys/class/gpio# cd gpio45
root@dm816x-evm:/sys/devices/virtual/gpio/gpio45# echo "out" > direction
root@dm816x-evm:/sys/devices/virtual/gpio/gpio45# echo 1 > value
root@dm816x-evm:/sys/devices/virtual/gpio/gpio45# echo 0 > value
root@dm816x-evm:/sys/devices/virtual/gpio/gpio45#
//Base Board LED
root@dm816x-evm:/sys/class/gpio# cd gpio41
root@dm816x-evm:/sys/devices/virtual/gpio/gpio41# echo "out" > direction
root@dm816x-evm:/sys/devices/virtual/gpio/gpio41# echo 0 > value
root@dm816x-evm:/sys/devices/virtual/gpio/gpio41# echo 1 > value
root@dm816x-evm:/sys/devices/virtual/gpio/gpio41#
CTRL+F and look for: #define CONFIG_SYS_NS16550_COM1
to:
#define WINBOND_ID_W25Q64 0x4017
.id = WINBOND_ID_W25X64,
.l2_page_size = 8,
.pages_per_sector = 16,
.sectors_per_block = 16,
.nr_blocks = 128,
.name = "W25X64",
},
to:
.id = WINBOND_ID_W25X64,
.l2_page_size = 8,
.pages_per_sector = 16,
.sectors_per_block = 16,
.nr_blocks = 128,
.name = "W25X64",
},
{
.id = WINBOND_ID_W25Q64,
.l2_page_size = 8,
.pages_per_sector = 16,
.sectors_per_block = 16,
.nr_blocks = 128,
.name = "W25Q64",
},