DM8148 开发记录 四

Starting with TI EZSDK C6A816x – Video Tutorial



This tutorial is useful for Hardware and Software engineers.

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

General notes:

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

***********************************************

BOOTING THE BOARD from Network, SD or NAND


***********************************************


Running Kernel and File system from network


——————————————

Prepare Kernel image
Follow the steps in: Kernel compilation

Booting from Linux EZSDK
dhcp
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

One line command (Ready for Copy & Paste):
dhcp;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


Booting from SD CARD


—————–

Prepare uBoot MLO
Follow the steps in: U-Boot compilation – SD min
cp u-boot.min.sd MLO
cp MLO /home/vmplanet/ti-ezsdk_dm816x-evm_5_02_02_60/board-support/host-tools/

Prepare uBoot for NAND or SPI (depends what memory you would like to use to store ENV variables)
Follow the steps in: U-Boot compilation – NAND / SPI
cp u-boot.bin /home/vmplanet/ti-ezsdk_dm816x-evm_5_02_02_60/board-support/host-tools/

Prepare Kernel Image
Follow the steps in: Kernel compilation
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 /home/vmplanet/ti-ezsdk_dm816x-evm_5_02_02_60/board-support/host-tools/

Prepare File system
cd /home/vmplanet/targetfs
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/

Create SD card
cd /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

Create SD CARD boot script
cd /home/vmplanet/ti-ezsdk_dm816x-evm_5_02_02_60/board-support/u-boot-2010.06-psp04.00.00.12/tools/
gedit boot.txt

Copy and save following text in the file (Note: Check the host IP and Serial console number):
setenv bootargs 'console=ttyO2,115200n8 root=/dev/mmcblk0p2 mem=128M rootwait notifyk.vpssm3_sva=0xBF900000 vram=50M ti816xfb.vram=0:16M,1:16M,2:6M'
setenv bootcmd 'mmc init; fatload mmc 1 0x81000000 uImage; bootm 0x81000000'
boot

Create the script
mkimage -A arm -O linux -T script -C none -n TI_script -d boot.txt boot.scr

Unplug and Plug the SD card
cp boot.scr /media/boot/


Booting from NAND


——————–

Flashing Kernel
Follow the steps in: Kernel compilation

ALWAYS CHECK size of uImage after tftp transfer and correct the value 0×280000. Check host IP.
Flashing Kernel to NAND
dhcp
setenv serverip 192.168.0.22
mw.b 0x81000000 0xFF 0x280000
tftp 0x81000000 uImage
nand erase 0x00280000 0x00280000
nand write 0x81000000 0x00280000 0x280000

One line command (Ready for Copy & Paste):
dhcp;setenv serverip 192.168.0.22;mw.b 0x81000000 0xFF 0x280000;tftp 0x81000000 uImage;nand erase 0x00280000 0x00280000;nand write 0x81000000 0x00280000 0x280000

Flashing File system
Follow the steps in: File system

ALWAYS CHECK size of rd-jffs2.bin after tftp transfer and correct the value 0×0700000. Check host IP.
Flashing File system to NAND
dhcp
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

One line command (Ready for Copy & Paste):
dhcp;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

Set ENV variables
ALWAYS CHECK if the size is correct and same as in Kernel and File system above
setenv bootcmd 'nand read 0x81000000 0x280000 0x280000;nand read 0x82000000 0x6C0000 0x700000;bootm 0x81000000'
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

One line command (Ready for Copy & Paste):
setenv bootcmd 'nand read 0x81000000 0x280000 0x280000;nand read 0x82000000 0x6C0000 0x700000;bootm 0x81000000';setenv bootargs 'mem=1024M 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

***********************************************************************

FLASHING UBoot (On a board booted up from SD and connected to network)


***********************************************************************

Flashing u-Boot to NAND


—————
Prepare NAND uBoot
Follow the steps in: U-Boot compilation – NAND
cp u-boot.noxip.bin /tftpboot/

Note: ALWAYS CHECK size of u-boot.noxip.bin after tftp transfer and correct the value 0×260000 if needed. Check IP address.
Flashing UBoot to NAND:
dhcp
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

One line command (Ready for Copy & Paste):
dhcp;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


Flashing u-Boot to SPI


—————

Prepare SPI uBoot
Follow the steps in: U-Boot compilation – SPI
cp u-boot.noxip.bin.spi /tftpboot/

Note: ALWAYS CHECK size of u-boot.noxip.bin.spi after tftp transfer and correct the value 0×40000 if needed. Check IP address.
Flashing UBoot to SPI:
dhcp
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

One line command (Ready for Copy & Paste):
dhcp;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

***********************************************

USING JTAG to FLASH UBOOT INTO NAND


***********************************************

*******************************************************

PREPARING THE BINARY FILES (UBOOT, KERNEL, FILE SYSTEM)


*******************************************************

U-Boot compilation


——————-

In case gcc cant be located (Error: /bin/sh: arm-none-linux-gnueabi-gcc: command not found) use following commands:
cd /home/vmplanet/ti-ezsdk_dm816x-evm_5_02_02_60/board-support/u-boot-2010.06-psp04.00.00.12/
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


U-Boot for SD min

cd /home/vmplanet/ti-ezsdk_dm816x-evm_5_02_02_60/board-support/u-boot-2010.06-psp04.00.00.12/
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


U-Boot for NAND

cd /home/vmplanet/ti-ezsdk_dm816x-evm_5_02_02_60/board-support/u-boot-2010.06-psp04.00.00.12/
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


U-Boot for SPI

cd /home/vmplanet/ti-ezsdk_dm816x-evm_5_02_02_60/board-support/u-boot-2010.06-psp04.00.00.12/
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

Kernel compilation


——————
In case gcc cant be located (Error: /bin/sh: arm-none-linux-gnueabi-gcc: command not found) use following commands:
cd /home/vmplanet/ti-ezsdk_dm816x-evm_5_02_02_60/board-support/linux-2.6.37-psp04.00.00.12/
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
cd /home/vmplanet/ti-ezsdk_dm816x-evm_5_02_02_60/board-support/linux-2.6.37-psp04.00.00.12/
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/

File system


—————
In case mkfs.jffs3 is not installed run:
sudo apt-get install mtd-utils

Note: Original EZSDK targetfs is quite large. I will use VOIPAC file system.

cd /home/vmplanet
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 ttymxc0 115200 vt100
::respawn:/sbin/getty -L tty1 115200

to
#::respawn:/sbin/getty -L ttymxc0 115200 vt100
::respawn:/sbin/getty -L ttyO2 115200 //use correct console number: for standard EZSDK board use: ttyO2

then Save and Close

Make the image
mkfs.jffs2 -lqn –e 128 -r rootfs-bb-1-17-final2/ -o /tftpboot/rd-jffs2.bin

************************

Other useful things …


************************
Using GPIO
———–
gedit /home/vmplanet/ti-ezsdk_dm816x-evm_5_02_02_60/board-support/linux-2.6.37-psp04.00.00.12/arch/arm/configs/ti8168_evm_defconfig
CTRL+F and look for: CONFIG_GPIO_SYSFS
Change from:
# CONFIG_GPIO_SYSFS is not set
to:
CONFIG_GPIO_SYSFS=y

Set the selected pins into GPIO mode
gedit /home/vmplanet/ti-ezsdk_dm816x-evm_5_02_02_60/board-support/linux-2.6.37-psp04.00.00.12/arch/arm/mach-omap2/board-ti8168evm.c
CTRL+F and look for: TI816X_MUX(GPMC_A27, OMAP_MUX_MODE1), /* gpio-20 */
Add custom configuration:

//CUSTOM GPIO PINS
//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 GPIOs

//module LED
root@dm816x-evm:~# cd /sys/class/gpio/
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# echo 41 > export
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#

UBOOT: Set different serial port in U-Boot for console output (by default it is UART2)
————————————————————————————–
gedit /home/vmplanet/ti-ezsdk_dm816x-evm_5_02_02_60/board-support/u-boot-2010.06-psp04.00.00.12/include/configs/ti8168_evm.h
CTRL+F and look for: #define CONFIG_SYS_NS16550_COM1

Change from:
#define CONFIG_SYS_NS16550_COM1 0x48024000 /* Base EVM has UART2 */

to:
#define CONFIG_SYS_NS16550_COM1 0x48020000 /* Base EVM has UART0 */

UBOOT: Add support for recognision of an unsupported Winbond SPI memory chip (Example!)
————————————————————————————–
gedit /home/vmplanet/ti-ezsdk_dm816x-evm_5_02_02_60/board-support/u-boot-2010.06-psp04.00.00.12/drivers/mtd/spi/winbond.c

Change from:
#define WINBOND_ID_W25X64 0x3017
to:
#define WINBOND_ID_W25X64 0x3017
#define WINBOND_ID_W25Q64 0x4017

Change from:
{
.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",
},


  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

听海拉拉

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值