UG: DaVinci PSP Installation on DM36x EVM
From Texas Instruments Embedded Processors Wiki
Flashing DM36x EVM using NAND Writer utilities (CCS environment)
For flashing the DaVinci DM36x EVM using NAND Writer utilities, refer to the following instructions. The pre-built binaries for NAND Writer, UBL and U-Boot can be downloaded from DaVinci GIT Linux Kernel Releases
- System Requirements – CCS 3.3.38 or above installed on Windows XP with Service Pack 2
- Use the Configuration and gel file to set up CCS from the Spectrum Digital Website
- Make sure the Boot Mode / Configuration Select Switch SW4 is set for the NAND boot mode and 8-bit AEMIF configuration -
| S4:1 (AECFG0) | S4:2 (AECFG1) | S4:3 (AECFG2) | S4:4 (BITSEL0) | S4:5 (BITSEL1) | S4:6 (BITSEL2) |
| OFF | OFF | OFF | OFF | OFF | OFF |
- Also make sure the Board Configuration Select Switch SW5 is set for the Vcore=1.35 Volts configuration -
| S5:1 (NAND/ONE NAND) | S5:2 (EXTRA1) | S5:3 (EXTRA2) | S5:4 (EXTRA3) | S5:5 (VCORE ADJ) | S5:6 (NTSC/PAL) |
| OFF | OFF | OFF | OFF | ON | OFF |
- Connect the XDS510 to the TI JTAG
- Setup CCS 3.3 with the CCS configuration and GEL files corresponding to the DM36x EVM
- Open CCS 3.3, Alt+C to connect to the device. Ctrl+R to reset from CCS
- If the EVM has been loaded with older flash utilities then run the NAND eraser binary that is now supplied as part of the release. This is essential if the EVM has been flashed with utilities from older LSP releases. This is done so that the entire NAND is erased and we want the Bad Block Tables to be re written
- Load the NANDEraser_DM36x.out from the release and run it (Press F5). The eraser will ask for an input. Input “0x02000000”. Run the eraser again. This time input “0x02004000”. The program need not be run the second time if the 4K NAND from SAMSUNG that is going to be tested as part of the release is being flashed. The need to re run the eraser is dependent on whether the NAND being flashed is internally 1 or 2 devices.
- Load the NAND programmer - NANDWriter_DM36x.out and run it
- The NAND programmer will ask for input for the UBL binary. Choose the UBL_DM36x_NAND.bin file from the release.
- NAND programmer will then ask for the U-Boot binary. Choose the binary u-boot-dm365-evm.bin. Set 0x81080000 for the Application Entry Point and set 0x81080000 for the Application Load Address
- Turn off the board and disconnect the CCS from the device. Alt+C and disconnect XDS510 from the device
- Connect the RS232 cable between your PC and EVM
- You will see console messages, UBL identifying the U-Boot magic number and giving control to U-Boot
MMC/SD boot mode and SD flashing tool
For booting DM36x via SD card and flashing the EVM for MMC/SD boot mode, refer to SD card boot and flashing tool for DM36x.
SPI boot mode and SPI flashing tool
For booting DM36x via SPI flash and flashing the EVM for SPI boot mode, refer to SPI flash boot and flashing tool for DM36x. The link also describes how to setup the kernel for SPI FLASH on the DM36x
Flashing DM36x EVM (PG 1.2 Silicon or newer) using Serial flash utilities
For flashing the DaVinci DM36x EVM using Serial Flash utilities, refer to the following instructions. The pre-built binaries for Serial Flash, UBL and U-Boot can be downloaded from DaVinci GIT Linux Kernel Releases.
- Connect the RS232 cable between your PC and EVM .
- Make sure the Boot Mode / Configuration Select Switch SW4 is set for the UART boot mode and 8-bit AEMIF configuration -
| S4:1 (BITSEL2) | S4:2 (BITSEL1) | S4:3 (BITSEL0) | S4:4 (AECFG2) | S4:5 (AECFG1) | S4:6 (AECFG0) |
| OFF | ON | ON | OFF | OFF | OFF |
- Also make sure the Board Configuration Select Switch SW5 is set for the Vcore=1.35 Volts configuration -
| S5:1 (NAND/ONE NAND) | S5:2 (EXTRA1) | S5:3 (EXTRA2) | S5:4 (EXTRA3) | S5:5 (VCORE ADJ) | S5:6 (NTSC/PAL) |
| OFF | OFF | OFF | OFF | ON | OFF |
- There will be a serial flasher for DM36x "sfh_DM36x.exe" and a UBL "ubl_DM36x_nand.bin" in the release package
- Use the above utilities and a U-Boot binary meant for DM365 to flash the NAND on the DM36x EVM.
- Issue the following command in CYGWIN or DOS.
sfh_DM36x.exe -nandflash <UBL binary file> <binary application file>
- Turn off the board
- Once this is done, change to NAND boot mode
- Make sure the Boot Mode / Configuration Select Switch SW4 is set for the NAND boot mode and 8-bit AEMIF configuration -
| S4:1 (BITSEL2) | S4:2 (BITSEL1) | S4:3 (BITSEL0) | S4:4 (AECFG2) | S4:5 (AECFG1) | S4:6 (AECFG0) |
| OFF | OFF | OFF | OFF | OFF | OFF |
- Power cycle the EVM. You will see console messages, UBL identifying the U-Boot magic number and giving control to U-Boot
- NOTE: The serial utility has an issue where the utility just hangs and is unable to flash the NAND on the DM36x EVM. This is an issue with the core drivers inherited from the flash utilities repository in the GFORGE server. It affects other SOCs as well. Resetting the EVM and running the serial flasher again results in success.
Booting the DM36x EVM using pre-built binaries
After flashing the EVM for UBL and U-Boot binaries, using one of the above methods (using CCS utilities or Serial flash utilities), the EVM can now be loaded with Kernel and Filesystem images for the complete out-of-box experience.
Refer to Booting DM36x Out of the Box for information on booting the EVM.
Booting Linux Kernel from a SDRAM (via TFTP download to SDRAM)
- Copy the Linux Kernel image (uImage-dm365-evm.bin) from the images/dm365-evm/ directory of the DaVinci PSP installation to the /tftpboot (TFTP root) directory of your host workstation. If you do not have a TFTP server configured please see the Setting up a TFTP Server.
- Set the following U-Boot ENV variables to download the Linux Kernel image to the SDRAM location
setenv bootfile uImage-dm365-evm.bin setenv serverip <ipaddress-of-your-host-workstation> setenv bootcmd 'dhcp; bootm' saveenv
- These commands will download the uImage-dm365-evm.bin to the default SDRAM location - 0x80700000. Note that U-Boot will get its IP Address from DHCP on each reboot.
Hit any key to stop autoboot: 0
BOOTP broadcast 1
*** Unhandled DHCP Option in OFFER/ACK: 44
*** Unhandled DHCP Option in OFFER/ACK: 46
*** Unhandled DHCP Option in OFFER/ACK: 150
*** Unhandled DHCP Option in OFFER/ACK: 44
*** Unhandled DHCP Option in OFFER/ACK: 46
*** Unhandled DHCP Option in OFFER/ACK: 150
DHCP client bound to address 192.168.1.197
TFTP from server 192.168.1.25; our IP address is 192.168.1.197
Filename 'uImage-dm365-evm.bin'.
Load address: 0x80700000
Loading: #################################################################
#################################################################
###########
done
Bytes transferred = 2066356 (1f87b4 hex)
## Booting kernel from Legacy Image at 80700000 ...
Image Name: Arago/2.6.31+2.6.32-rc1-r26+gitr
Image Type: ARM Linux Kernel Image (uncompressed)
Data Size: 2066292 Bytes = 2 MB
Load Address: 80008000
Entry Point: 80008000
Verifying Checksum ... OK
Loading Kernel Image ... OK
OK
Starting kernel ...
Booting Linux Kernel from NAND flash
To boot the Linux Kernel image from NAND flash, it has to be downloaded first and copied to the NAND partition.
- Download the Linux Kernel image (uImage-dm365-evm.bin) from the TFTP server and copy to the NAND partition
tftp 0x80700000 uImage-dm365-evm.bin nand erase 0x400000 0x200000 nand write 0x80700000 0x400000 0x200000
- The above commands will download the image and write to the NAND partition
DM365 EVM > tftp 0x80700000 uImage-dm365-evm.bin
TFTP from server 192.168.1.25; our IP address is 192.168.1.197
Filename 'uImage-dm365-evm.bin'.
Load address: 0x80700000
Loading: #################################################################
#################################################################
###########
done
Bytes transferred = 2066356 (1f87b4 hex)
DM365 EVM > nand erase 0x400000 0x200000 NAND erase: device 0 offset 0x400000, size 0x200000 Erasing at 0x400000 -- 100% complete. OK
DM365 EVM > nand write 0x80700000 0x400000 0x200000 NAND write: device 0 offset 0x400000, size 0x200000 2097152 bytes written: OK
- Setup the bootcmd ENV variable to boot the Linux Kernel image from NAND partition
setenv bootcmd 'nboot 0x80700000 0 0x400000; bootm'
- On each reboot, the Linux Kernel image will be read from NAND partition and copied to SDRAM location
Hit any key to stop autoboot: 0
Loading from NAND 1GiB 3,3V 8-bit, offset 0x400000
Image Name: Arago/2.6.31+2.6.32-rc1-r26+gitr
Image Type: ARM Linux Kernel Image (uncompressed)
Data Size: 2066292 Bytes = 2 MB
Load Address: 80008000
Entry Point: 80008000
## Booting kernel from Legacy Image at 80700000 ...
Image Name: Arago/2.6.31+2.6.32-rc1-r26+gitr
Image Type: ARM Linux Kernel Image (uncompressed)
Data Size: 2066292 Bytes = 2 MB
Load Address: 80008000
Entry Point: 80008000
Verifying Checksum ... OK
Loading Kernel Image ... OK
OK
Starting kernel ...
Setting up the target filesystem
DaVinci PSP 03.xx release uses Arago filesystem. The latest filesystem images can be downloaded from DaVinci GIT Linux Kernel Releases.
There are two types of filesystems generated by Arago build system:
- Minimal base filesystem:
arago-base-image-arago.ext2.gz arago-base-image-arago.jffs2 arago-base-image-arago.tar.gz
- "Demo" filesystem for DM36x EVM
arago-demo-image-dm365-evm.ext2.gz arago-demo-image-dm365-evm.jffs2 arago-demo-image-dm365-evm.tar.gz
Booting with RAMDISK as a root filesystem
- Download the Arago minimal base filesystem image (RAMDISK: arago-base-image-arago.ext2.gz) from the TFTP server and copy to the NAND partition
tftp 0x82000000 arago-base-image-arago.ext2.gz nand erase 0xC00000 0x300000 nand write 0x82000000 0xC00000 0x300000
- The above commands will download the Arago base filesystem image and write to the NAND partition
DM365 EVM > tftp 0x82000000 arago-base-image-arago.ext2.gz
operating at 100M full duplex mode
TFTP from server 192.168.1.25; our IP address is 192.168.1.199
Filename 'arago-base-image-arago.ext2.gz'.
Load address: 0x82000000
Loading: #################################################################
#################################################################
#################################################################
####################
done
Bytes transferred = 3148726 (300bb6 hex)
DM365 EVM > nand erase 0xC00000 0x300000 NAND erase: device 0 offset 0xc00000, size 0x300000 Erasing at 0xc00000 -- 100% complete. OK
DM365 EVM > nand write 0x82000000 0xC00000 0x300000 NAND write: device 0 offset 0xc00000, size 0x300000 3145728 bytes written: OK
- Setup the bootcmd ENV variable to boot the Linux Kernel image from NAND partition and also load Arago base filesystem (RAMDISK) into SDRAM from NAND partition
setenv bootcmd 'nand read 0x82000000 0xC00000 0x300000; nboot 0x80700000 0 0x400000; bootm'
- Setup the bootargs ENV variable to boot with RAMDISK as the root filesystem
setenv bootargs mem=116M console=ttyS0,115200n8 root=/dev/ram0 rw initrd=0x82000000,4M ip=dhcp
- On each reboot, the Linux Kernel and Arago base filesystem images (RAMDISK) will be read from the corresponding NAND partition and copied to corresponding SDRAM location
Hit any key to stop autoboot: 0
NAND read: device 0 offset 0xc00000, size 0x300000
3145728 bytes read: OK
Loading from NAND 1GiB 3,3V 8-bit, offset 0x400000
Image Name: Arago/2.6.31+2.6.32-rc1-r26+gitr
Image Type: ARM Linux Kernel Image (uncompressed)
Data Size: 2066292 Bytes = 2 MB
Load Address: 80008000
Entry Point: 80008000
## Booting kernel from Legacy Image at 80700000 ...
Image Name: Arago/2.6.31+2.6.32-rc1-r26+gitr
Image Type: ARM Linux Kernel Image (uncompressed)
Data Size: 2066292 Bytes = 2 MB
Load Address: 80008000
Entry Point: 80008000
Verifying Checksum ... OK
Loading Kernel Image ... OK
OK
Starting kernel ...
...
RAMDISK: gzip image found at block 0
VFS: Mounted root (ext2 filesystem) on device 1:0.
Freeing init memory: 128K
INIT: version 2.86 booting
Please wait: booting...
Starting udev
Populating dev cachetar: short write
Remounting root file system...
Mon Oct 19 13:53:00 UTC 2009
INIT: Entering runlevel: 5
Starting telnet daemon.
Starting syslogd/klogd: done
_____ _____ _ _
| _ |___ ___ ___ ___ | _ |___ ___ |_|___ ___| |_
| | _| .'| . | . | | __| _| . | | | -_| _| _|
|__|__|_| |__,|_ |___| |__| |_| |___|_| |___|___|_|
|___| |___|
Arago Project http://arago-project.org dm365-evm ttyS0
Arago 2009.09 dm365-evm ttyS0
dm365-evm login:
Booting with NFS as a root filesystem
- The "demo" filesystem for DM36x EVM (arago-demo-image-dm365-evm.tar.gz) should be exported from the NFS server on your host Linux workstation. Perform the following steps (You only need to perform these steps once)
- Log in with a user account on the host Linux workstation
- Perform the following commands to prepare a location for the Arago target file system. For example:
host $ cd /home/<useracct> host $ mkdir -p workdir/filesys host $ cd workdir/filesys
- Switch user to root on the host Linux workstation
host $ su root
- Perform the following commands to create a copy of the target file system with permissions set for writing to the shared area as <useracct>. Substitute you user name for <useracct>.
host $ cp -a <release-location>/images/dm365-evm/arago-demo-image-dm365-evm.tar.gz . host $ tar xvfz arago-demo-image-dm365-evm.tar.gz host $ chmod 777 -R /home/<useracct>/workdir/filesys
- Edit the /etc/exports file on the host Linux workstation (not the exports file on the target file system). Add the following line for exporting the filesys directory, substituting your user name for <useracct>. Use the full path from root; ~ may not work for exports on all file systems.
/home/<useracct>/workdir/filesys *(rw,no_root_squash,no_all_squash,sync) NOTE: Make sure you do not add a space between the * and the ( in the above command.
- Still as root, use the following commands to make the NFS server aware of the change to its configuration and to invoke an NFS restart.
host $ /usr/sbin/exportfs -av host $ /sbin/service nfs restart NOTE: Use exportfs -rav to re-export all directories. Use /etc/init.d/nfs status to verify that the NFS status is running.
- Setup the following ENV variables for NFS at the U-Boot commandline prompt
setenv nfshost <Linux Host IP address> setenv rootpath <directory to mount>
- Setup the bootargs ENV variable to boot with NFS target filesystem as the root filesystem
setenv bootargs mem=116M console=ttyS0,115200n8 root=/dev/nfs rw nfsroot=$(nfshost):$(rootpath) ip=dhcp
- Here is an example of the console dump
DM365 EVM > setenv nfshost 192.168.1.25 DM365 EVM > setenv rootpath /opt/workdir/filesys DM365 EVM > setenv bootargs mem=116M console=ttyS0,115200n8 root=/dev/nfs rw nfsroot=$(nfshost):$(rootpath) ip=dhcp DM365 EVM > print ... nfshost=192.168.1.25 rootpath=/opt/workdir/filesys bootargs=mem=116M console=ttyS0,115200n8 root=/dev/nfs rw nfsroot=192.168.1.25:/opt/workdir/filesys ip=dhcp DM365 EVM >
...
eth0: attached PHY driver [Generic PHY] (mii_bus:phy_addr=1:01, id=221613)
Sending DHCP requests .
PHY: 1:01 - Link is Up - 100/Full., OK
IP-Config: Got DHCP answer from 0.0.0.0, my address is 192.168.1.197
IP-Config: Complete:
device=eth0, addr=192.168.1.197, mask=255.255.255.0, gw=192.168.1.1,
host=192.168.1.197, domain=xxx.com,
bootserver=0.0.0.0, rootserver=192.168.1.25, rootpath=/opt/workdir/filesys
Looking up port of RPC 100003/2 on 192.168.1.25
Looking up port of RPC 100005/1 on 192.168.1.25
VFS: Mounted root (nfs filesystem) on device 0:14.
Freeing init memory: 128K
INIT: version 2.86 booting
Please wait: booting...
Starting udev
Populating dev cache
Remounting root file system...
NET: Registered protocol family 10
INIT: Entering runlevel: 5
Starting telnet daemon.
Starting syslogd/klogd: done
Starting thttpd.
_____ _____ _ _
| _ |___ ___ ___ ___ | _ |___ ___ |_|___ ___| |_
| | _| .'| . | . | | __| _| . | | | -_| _| _|
|__|__|_| |__,|_ |___| |__| |_| |___|_| |___|___|_|
|___| |___|
Arago Project http://arago-project.org dm365-evm ttyS0
Arago 2009.09 dm365-evm ttyS0
dm365-evm login:
Video Input/Output Source Configuration
The video capture (VPFE) and display (VPBE) drivers in DaVinci PSP release allow input and output sources to be configured from the bootargs ENV variable in U-Boot.
- VPFE input source can be configured via vpfe_capture.interface settings in the bootargs (replace if it is already there, append to current bootargs otherwise). The VPFE capture driver on DM36x also allows dynamic switching of TVP5146 and TVP7002 video input decoder sources.
vpfe_capture.interface=2 for TVP7002 (default)
vpfe_capture.interface=1 for Micron sensor - MT9T031
vpfe_capture.interface=0 for TVP5146
- Default VPFE input standard is Composite and mode is NTSC. The input standard can be switched to Component or S-Video using S_INPUT IOCTL and mode can be switched to PAL or any other resolutions (720P-60, 1080I-30 etc) using the S_STD IOCTL.
- Buffer allocation for the VPFE capture driver can be configured using vpfe_capture.bufsize settings in the bootargs (replace if it is already there, append to current bootargs otherwise).
vpfe_capture.bufsize=4147200 for 1080I-30 (1920*1080*2=4147200)
vpfe_capture.bufsize=1843200 for 720P-60 (1280*720*2=1843200)
vpfe_capture.bufsize=829440 for PAL (720*576*2=829440) - default
vpfe_capture.bufsize=691200 for NTSC (720*480*2=691200)
- Default VPBE ouput is Composite and mode is NTSC. The output/mode can be switched to different output/mode using the davinci_enc_mngr settings in the bootargs (replace if it is already there, append to current bootargs otherwise). Currently there is an issue with the sequencing of driver loading. The Video display drivers seem to initialize before the I2C probing of video encoders/decoders. Due to this, configuring the video display output/mode settings from the bootargs are known to fail. The same configuration can be achieved at run time using the sysfs attributes - /sys/class/davinci_display/ch0/output and /sys/class/davinci_display/ch0/mode.
davinci_enc_mngr.ch0_output=COMPOSITE davinci_enc_mngr.ch0_mode=pal
davinci_enc_mngr.ch0_output=COMPONENT davinci_enc_mngr.ch0_mode=720P-60
davinci_enc_mngr.ch0_output=COMPONENT davinci_enc_mngr.ch0_mode=1080I-30
davinci_enc_mngr.ch0_output=LCD davinci_enc_mngr.ch0_mode=480x272 for LCD mounted on the DM36x EVM
Building PSP Components
Rebuilding the Linux kernel
The rebuild the Linux kernel, follow the steps below.
Preparing your Environment
- If you have not already done so, install the CodeSourcery tools on your Linux host. For additional documentation on installing the CodeSourcery tools, please visit the CodeSourcery website.
- If U-Boot is not built yet, build U-Boot first, as building Linux Kernel requires mkimage utility, which gets built along with U-Boot. Refer to Rebuilding U-Boot for steps to build U-Boot. Once built, mkimage will be present under the tools folder of U-Boot source (/home/<user>/DaVinci-PSP-SDK-xx.xx.xx.xx/src/u-boot/uboot-xx.xx.xx.xx/tools). Ensure that this path is added to the $PATH variable by adding the following
- host$ export PATH=home/<user>/DaVinci-PSP-SDK-xx.xx.xx.xx/src/u-boot/uboot-xx.xx.xx.xx/tools:$PATH
to the ~/.bashrc file. You can then source the ~/.bashrc file with the following command
- host$ source ~/.bashrc
- Use your Linux host to extract source files for building the target Linux kernel from the src/kernel/linux-#.#.#.#.tar.gz tarball from the Linux PSP package, which is located in the DaVinci-PSP-SDK-#.#.#.# directory under the main SDK installation directory (/home/<user>/DaVinci-PSP-SDK-xx.xx.xx.xx/src/kernel for default path installation). Use the tar command to extract the sources.
- host$ tar zxf linux-#.#.#.#.tar.gz
NOTE
Patches from the kernel-patches-#.#.#.#.tar.gz file have already been applied on Linux Kernel. This is the list of patches which have been developed on top of the base Linux kernel version. You can find information about the base Linux kernel version from the release notes accompanying the PSP release.- Change directory (cd command) to the top-level directory of the Linux kernel source files obtained in the previous step.
- host$ cd linux-xx.xx.xx.xx
Basic Configuration of the Kernel
Based on what chip and development board you are using, you will need to configure the kernel for different options. Most of these setings are build into the Make file provided by TI, and you can switch between builds using some simple make options.
- Clean your installation of previous build settings
- host$ make distclean ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi-
- Configure the kernel according to the default configuration provided. The steps below assume that the CodeSourcery tools are already present in your $PATH variable. Information on how to add the tools to your $PATH can be obtained form the Getting Started Guide for the CodeSourcery tools.
- For DM36x (DM365 and DM368)
- host$ make davinci_dm365_defconfig ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi-
- Modify the kernel options you would like to run. This may take some planning, but the default settings are a good place to start. For more information on these settings, look further down the page at Driver configuration in the Linux kernel or see detaile instructions for | a different processors root file system]. there are two menu configs that are commmon to run:
- host$ make ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi- menuconfig
- (or)
- host$ make ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi- xconfig
Building uImage
Run the following command to build the kernel image:
- host$ make uImage ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi-
The compiled uImage is copied into the arch/arm/boot directory under the kernel tree.
Once the kernel has been compiled, if you are using tftp boot, use the following commands to copy the uImage to a place where U-Boot can use TFTP to download it to the EVM. These commands assume you are using the default TFTP root area, which is /tftpboot. If you use another TFTP root location, please change /tftpboot to your own TFTP root location:
- host$ cp arch/arm/boot/uImage /tftpboot
Note
If the uImage build fails with a similar message as follows:"mkimage" command not found - U-Boot images will not be built
it could be that the path to the u-boot uImage script has not been added to the command search path. Include the path "{u-boot source path}/tools" to your PATH environment variable.
Building Modules
To build all features configured as modules (M), issue the following command:
- host$ make modules ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi-
Installing modules to Target File System
To install the compiled modules into the target root file system, issue the following command:
- host$ make modules_install INSTALL_MOD_PATH=<root fs path> ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi-
where the <root fs path> is the path of your target root file system on the host machine (/home/user/workdir/filesys for example).
See Loading Linux Kernel Modules for more information on using kernel modules after you build them.Rebuilding U-Boot
Follow these steps to rebuild U-Boot:
- If you have not already done so, install the CodeSourcery tools on your Linux host. For documentation on installing the CodeSourcery tools, please visit the CodeSourcery website.
- Use your Linux host to extract source files for building U-Boot from the src/u-boot/u-boot-#.#.#.#.tar.gz tarball from the Linux PSP package, which is located in the DaVinci-PSP-SDK-#.#.#.# directory under the main SDK installation directory. Use the tar command to extract the sources.
Note: Patches from the uboot-patches-#.#.#.#.tar.gz file have already been applied to U-Boot. This is the list of patches which have been developed on top of the base version. You can find information about the base U-Boot version from the release notes accompanying the PSP release. - Go to the u-boot directory created when you extracted the files.
- Run the following commands on your Linux host to build U-Boot. Note: The steps below assume that the CodeSourcery tools are already present in your $PATH variable. Information on how to add the tools to your $PATH can be obtained form the Getting Started Guide for the CodeSourcery tools.
host$ make distclean CROSS_COMPILE=arm-none-linux-gnueabi-
- for DM36x (DM365 and DM368) EVM
host$ make davinci_dm365evm_config CROSS_COMPILE=arm-none-linux-gnueabi-
host$ make all CROSS_COMPILE=arm-none-linux-gnueabi-
- The compiled u-boot.bin file will be created in the same directory.
- To change the default options, the EVM configuration file needs to be edited.
- for DM36x (DM365 and DM368) EVM are specified in the include file include/configs/davinci_dm365evm.h
To change U-Boot environment area location or size:
- CONFIG_ENV_SIZE Configures the environment variable size.
- CONFIG_ENV_OFFSET Configures the environment variable offset.
Building the User Boot Loader (UBL)
Follow the steps mentioned below for releases before the 03.21.xx.xx release:
The latest source code for UBL can be downloaded from Arago GIT server. Once the source is extracted (from source tarball), following steps can be followed to build UBL.
- Start CCStudio v3.3.
- From the menus, choose Project->Open.
- Browse to the extracted UBL source and open the UBL.pjt project. Project file can be found under <flash-utils-install-dir>\DM36x\CCS\UBL\ folder of the extracted source.
- To build for different ARM and DDR frequencies, select the "Config" option suitably in CCStudio window.
- From the menus, choose Project->Build.
- When the build is complete, the binary file (UBL_DM36x_NAND*.bin) suitable for flashing is generated in the Project Root directory (<flash-utils-install-dir>\DM36x\CCS\UBL\)
For 03.21.xx.xx Release:
Use your Linux host to extract the UBL code from the src/boot-strap/flash-utils-#.#.#.#.tar.gz tarball from the Linux PSP package, which is located in the DaVinci-PSP-SDK-#.#.#.# directory under the main SDK installation directory. Use the tar command to extract the sources. If the extracted files are not accessible from your Microsoft Windows host, copy all the extracted files to a location that is accessible.
When using CCStudiov5:
- Start CCStudiov5.
- From the menus, choose File->Import. Choose CCS->Existing CCS/CCE Eclipse Project. Browse to DM36x/CCS directory inside the extracted UBL source and select the UBL folder.
- From the list of Discovered projects:
- Select UBL_NAND for NAND boot mode.
- Select UBL_SDMMC for MMC/SD boot mode.
- From the menus, choose Project->Build Project
- When build is complete:
- The binary file (ubl_DM36x_NAND.bin) suitable for flashing is created in the directory (<flash-utils-install-dir>\DM36x\CCS\UBL\UBL_NAND)
When using Cygwin or Linux Host:
- For a particular platform, the extracted package will consist of a 'Common' directory and a '<PlatformName>' directory.
- Enter into the '<PlatformName>/GNU' directory.
cd '<PlatformName>/GNU'
- If you wish to rebuild everything, simply run 'make' at this point.
- When build is complete:
- The binary files (ubl_DM36x_xxx.bin) for supported ARM and DDR frequencies, suitable for flashing is created in the directory (<flash-utils-install-dir>\DM36x\GNU\ubl).
- The serial flasher (sfh_DM36x.exe) which can be used for flashing NAND is created in the directory (<flash-utils-install-dir>\DM36x\GNU).
Note
Currently, serial flasher built from the source code will not work. Till this problem is resolved, please use the serial flasher available in pre-built binaries folder.- If you wish to clean-up already built components, run 'make clean' from the path you wish to clean.
Building the NAND Flash writer
NAND flash writer is used to flash the UBL and U-Boot images to NAND flash. The flash writer also supports flashing a given image at a chosen offset.
Use the following steps to build NAND Flash writer using CCStudio v5:
- Use your Linux host to extract the flash utilities code from the src/boot-strap/flash-utils-#.#.#.#.tar.gz tarball from the Linux PSP package, which is located in the DaVinci-PSP-SDK-#.#.#.# directory under the main SDK installation directory. Use the tar command to extract the sources. If the extracted files are not accessible from your Microsoft Windows host, copy all the extracted files to a location that is accessible.
- Start CCStudio v5.
- From the menus, choose File->Import. Choose CCS->Existing CCS/CCE Eclipse Project. Browse to DM36x/CCS directory inside the extracted source and select the NANDWriter folder.
- From the list of Discovered projects, select NANDWriter.
- From the menus, choose Project->Build Project. The built image NANDWriter_DM36x.out is placed in the ccsv4/Debug under the top directory.
To flash images to NAND Flash, see Flashing images to NAND Flash.
To boot U-Boot from NAND Flash, see Booting from NAND Flash.
To boot the Linux kernel from NAND Flash using U-Boot, see Booting the Linux kernel from NAND Flash.NAND Partitions
The NAND writer writer the UBL to Block 1 and U-boot to block 25. We reserve 24 blocks for UBL becuase RBL will search for a valid UBL header from blocks 1 to 24
- Block 1 through 24 : UBL
- Block 25 through 30 : U-Boot
- Block 31 to 32 : Environment
Building and using the MT9P031 CMOS image sensor driver
This section contains the information on compiling and installing the CMOS sensor driver, as well as the use of an application demo to capture video at 1080p30 (1920x1080 30fps) and display up to 1080I60.
The demo has a semi-auto exposure and semi-auto white balance algorithm, which only requires one-time calibration under unchanged lighting condition. The calibration is simple and easy. It is performed by pointing the camera to a white scene and pressing one key. This algorithm is contributed to the open source by Leopard Imaging, Inc.
The demo is tested on DM36x EVM with LI-5M02 rev2 image sensor board from Leopard Imaging,Inc.
1. Building the driver
The CMOS sensor driver is available at arago git tree in this directory : drivers/media/video/davinci/. The major part of the driver is in mt9p031.c.
- Getting the latest linux git tree
git clone git://arago-project.org/git/projects/linux-davinci.git linux-davinci
- building the kernel with the driver enabled
Follow the steps in section “Building the Kernel” on this page. Make sure “CONFIG_SOC_CAMERA_MT9P031=y” is included in linux-davinci/arch/arm/configs/davinci_dm365_deconfig. If not, it can be configured using:
make ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi- menuconfig
check “device drivers -> Multimedia Support -> Video for Linux” and “device drivers -> Multimedia Support -> Video Capture Adapters -> mt9p031 support”. It can be built in the kernel or dynamically loaded as a module.
- To load the driver using the dynamically-loadable modules, copy the modules (.ko files) to the target file system. Execute the following command on the DM36x to load the CMOS sensor driver (If the driver is built inside the kernel, this step can be ignored):
insmod mt9p031.ko
- Execute the following command on the DM36x to unload the CMOS sensor Driver:
rmmod mt9p031.ko
2 . Building the demo applicationThe latest sample application code for DaVinci PSP release can be downloaded/cloned from examples-davinci Git tree.
- Getting the examples:
git clone git://arago-project.org/git/projects/examples-davinci.git examples-davinci
- Go to the root directory of sample application. (the demo application is capture_prev_rsz_onthe_fly_bayer_mew)
cd examples-davinci/imp-prev-rsz/dm365/
- Export the Linux Kernel directory and the LINUXLIBS_DIR. Linuxlibs is available in Davinci PSP release.
export KERNEL_DIR=<kernel directory> export LINUXLIBS_DIR=<linuxlibs directory>
- Clean any object files previously created
make ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi- clean
- Build the application
make ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi-
- Copy the application to the target file system.
cp capture_prev_rsz_onthe_fly_bayer_mew <target filesys addr>/opt/
3. Running the demo
- To run the demo, bootargs should be set as follows. The bootargs is for booting with NFS.
setenv bootargs console=ttyS0,115200n8 noinitrd rw ip=dhcp root=/dev/nfs nfsroot=<linux host IP>:<nfs host directory>,nolock mem=60M video=davincifb:vid0=OFF:vid1=OFF:osd0=1920x1080x4,32400K dm365_imp.oper_mode=0 vpfe_capture.interface=1 vpfe_capture.bufsize=4147200 davinci_enc_mngr.ch0_mode=1080I-30
the meaning of the parameters:
- dm365_imp.oper_mode
select the image mode, 0:default, 1:continuous,2: XOR mode
- vpfe_capture.interface
select the vpfe input interface, 0:tvp5146 composite input. 1:mt9p031 CMOS sensor bayer input. 2:tvp7002 component input.
-vpfe_capture.bufsize
make sure the buffer size is equal to or larger than : 1920*1080*2 = 4147200 bytes
-davinci_enc_mngr.ch0_mode
Select the display mode, 1080I-30 standards for 1920*1080 interleaved @30fps
- Make sure the loadmodules_hd.sh and binary files are under /opt in the file system. After boot up the file system, log in as root and enter the commands below:
cd /opt ./loadmodules_hd.sh ./capture_prev_rsz_onthe_fly_bayer_mew -i1 -m4 -h50 or ./capture_prev_rsz_onthe_fly_bayer_mew -i1 -m4 -h60 or ./capture_prev_rsz_onthe_fly_bayer_mew -i1 -m10 –h50 or ./capture_prev_rsz_onthe_fly_bayer_mew -i1 -m10 -h60
For the arguments that follows “./capture_prev_rsz_onthe_fly_bayer_mew”:
-i1: select input type is CMOS sensor input
-m4/m10: select standard is 720P-30/1080P-30
-h50/h60: select 50Hz/60Hz anti-flicker
- semi-auto exposure and semi-auto white balance
When the loop-back video is on the TV screen, point the camera to a white or grey area, such as a piece of white paper, a white wall, or the professional 18% grey card, type 'w' key, a square frame will show up in the center of the video, make sure the frame covers a uniform white/grey area, type 'w' key again, it will ajust sensor exposure time and gain, IPIPE white balance gains and RGB matrix to get a decent quality video.
MT9P031 CMOS Sensor Driver Overview
This section provides a brief overview of the driver and its features. The driver is under GPL license, contributed to the open source community by Leopard Imaging, Inc.
1. Overview
The MT9P031 CMOS sensor driver can work as built-in driver or loadable module. It mainly handles the communication and configuration of the CMOS sensor. And it fits into the V4l2 structure as a video capture device.
- building Blocks
The CMOS sensor driver can be divided into the following blocks:
Module init:
This block handles all the initialization activities including driver registration, driver un-registration, probe and remove registration.
Sensor init:
This block handles CMOS sensor reset and enable.
Configuration and Control:
This block handles the CMOS sensor function.
Standard and Format:
This block handles standard and format supported by the CMOS sensor.
2. Features
The CMOS sensor driver supports communication and configuration of sensor through I2C bus, as well as other features such as:
Multiple Standards
Binning or non-binning mode
Set and get control status
Set, set and query standard
Set and try(check) format
Get and set sensor registers
- Standards
The CMOS sensor driver supports the following standards:
-V4L2_STD_720P_30 (1280*720 progressive 30fps), binning mode, tested-V4L2_STD_1080P_30 (1920*1080 progressive 30fps), non-binning mode, tested
-V4L2_STD_525_60, non-tested
-V4L2_STD_625_50, non-tested
-V4L2_STD_525P_60, non-tested
-V4L2_STD_625P_50, non-tested
- Get and Set sensor control
The CMOS sensor drive can supports set and get the current control, the control type includes:
- VFLIP control
- HFLIP control
- Gain control
- Exposure and Auto-Exposure control
- Get, Set and query standard support
The CMOS sensor driver supports set and get the standard.
- Set and try(check) format
- The CMOS sensor driver supports checking the width & height setting as well as setting different registers, such as:
- PLL config
- Enable or Disable sensor
- Bin and Skip mode - Width and Height
- Row start and Column start
- Horizontal blank and Vertical blank
- Get and Set the sensor registers
The CMOS sensor driver supports reading and setting the sensor register values.
- Default
By default, the driver initializes the CMOS sensor in V4L2_STD_1080P_30 standard, which is 1920*1080 progressive 30fps, non-binning mode.
Leave a CommentComments
Comments on UG: DaVinci PSP Installation on DM365 EVM
Sdusse said ...
Sdusse said ...
Similarly, the latest Arago pre-built base system image is greater than 0x300000 bytes so the above instructions should be changed for section "Booting with RAMDISK as a root filesystem" to be
nand erase 0xC00000 0x303000 nand write 0x82000000 0xC00000 0x303000
and the bootcmd set needs to be
setenv bootcmd 'nand read 0x82000000 0xC00000 0x303000; nboot 0x80700000 0 0x400000; bootm'
--Sdusse 13:44, 23 February 2010 (CST)

The latest Arago kernel pre-built image is greater than 0x200000 bytes so the above instructions should be changed for section "Booting Linux Kernel from NAND flash" to be
Then boot proceeds rather than giving a CRC error.
--Sdusse 13:23, 23 February 2010 (CST)