Skip to content

Instantly share code, notes, and snippets.

@bandwidthcrunch
Created March 10, 2014 11:20
Show Gist options
  • Save bandwidthcrunch/9463302 to your computer and use it in GitHub Desktop.
Save bandwidthcrunch/9463302 to your computer and use it in GitHub Desktop.
dm368 IPNC issues
Install tftpd-hpa: apt-getinstall tftpd-hpa / / tftp
install flex: apt-getinstall flex / / makesysall compilation process used
to install mkcramfs: apt-getinstall mkcramfs / / create the file system
to install libncurses5-dev: sudoapt-get install libncurses5-dev / / make menuconfig needs
4, modify the registry by the root user. Install vsftpd. (Refer to another article)
5, the installation target Linux
sudomkdir / camera/mv_pro_5.0
cd / home / ss
chmod777 mvl_5_0_0_demo_lsp_setuplinux_02_10_00_14.bin
chmod777 mvl_5_0_0801921_demo_sys_setuplinux.bin
./mvl_5_0_ # _demo_sys_setuplinux.bin
Installation directory to / camera/mv_pro_5.0
./mvl_5_0_0_demo_lsp_setuplinux_ # _ # _ # _ #. bin
Installation directory to / camera/mv_pro_5.0
Two files to / opt/mv_pro_5.0 decompression inside
sudotar-zxvf mvltools5_0_0801921_update.tar.gz
To unpack a few minutes
sudotar-zxvf DaVinciLSP_02_10_00_14.tar.gz
6, the installation package DVSDK
Give permission chmod.
./dvsdk_setuplinux_2_10_01_18.bin
Installed in / camera/ss/dvsdk_2_10_01_18
./xdctools_setuplinux_3_15_01_59.bin
Installed in / camera/ss/dvsdk_2_10_01_18/xdctools_3_15_01_59
. / Psp_ # _ # _ # _ #. Bin
Installed in / camera/ss/dvsdk_2_10_01_18 /
host $ tar-zxvf psp_ # _ # _ # _ #. tar.gz
Finished delete the installation file.
Patch, unzip the dvsdk_2_10_00_16_patch.tgz under dvsdk.
Set the working environment for the host
cd ~ / dvsdk_2_10_01_18
viRules.make
Check which settings to ensure consistent and practical path, such as:
DEMO_INSTALL_DIR = $ (DVSDK_INSTALL_DIR) / dvsdk_demos_2_10_00_17
7, install the NFS file system
NFS service pack installation:
sudoapt-get install nfs-kernel-server
Configuration file:
sudogedit / etc / exports
Add the following line:
/ Camera / ss / ipnc / target / filesys * (rw, no_root_squash, no_all_squash, sync)
Activated after the restart the NFS service:
sudo / usr / sbin / exportfs-av
sudo / etc / init.d / nfs-kernel-server restart
Check firewall status:
sudoiptables status
Off Firewall:
sudoiptables-F
10, to establish a development environment
Vi / root / .bashrc (the best are built on ordinary users and Root Users)
In the last to join named below:
export PATH = "/ camera/mv_pro_5.0/montavista/pro/devkit/arm/v5t_le/bin :/ camera/mv_pro_5.0/montavista/pro/bin :/ camera/mv_pro_5.0/montavista/common/bin: $ PATH "
Run:
source ~ /. bashrc
Make the environment variable to take effect.
In naming line input arm + [tab] cross compiler tool appears.
root @ www.linuxidc.com :/ camera/ss/dvsdk_2_10_01_18 # arm
arm2hpdl arm_v5t_le-gprof arm_v5t_le-objcopy
arm_v5t_le-addr2line arm_v5t_le-initdconfig arm_v5t_le-objdump
arm_v5t_le-ar arm_v5t_le-ksymoops arm_v5t_le-prelink
arm_v5t_le-as arm_v5t_le-ld arm_v5t_le-prelink-rtld
arm_v5t_le-c + + arm_v5t_le-ldconfig arm_v5t_le-ranlib
arm_v5t_le-c + + filt arm_v5t_le-ldd arm_v5t_le-readelf
arm_v5t_le-cpp arm_v5t_le-libindex arm_v5t_le-shellconfig
arm_v5t_le-g + + arm_v5t_le-libopt arm_v5t_le-size
arm_v5t_le-gcc arm_v5t_le-libtoolize arm_v5t_le-strings
arm_v5t_le-gcov arm_v5t_le-nm arm_v5t_le-strip
11, install LSP support package
Method one:
Copy MontaVistaLinux Support Package to the working directory, which contains the Davinci driver.
cp-R/camera/mv_pro_5.0/montavista/pro/devkit/lsp/ti-davinci/linux-2.6.18_pro500 / * / camera / ss / ipnc / ti-davinci /
Method Two: (Use this method)
Copy lsp_ipnc_dm36x_0.7.0.tgz to / camera / ss / ipnc / under decompression, generate ti-davinci folder.
12, create a file system folder
Decompression / camera / ss / ipnc / Under
ipnc_app_dm365_priv_0.7.0.tgz
ipnc_app_dm365_open_0.7.0.tgz
ipnc_app_dm365_aewb_0.7.0.tgz
Modify / camera / ss / ipnc / under Rules.make path.
HOME: = / camera / ss / ipnc
DVSDK_BASE_DIR: = / camera/ss/dvsdk_2_10_01_18
TFTP_HOME: = / var / lib / tftpboot
MVTOOL_DIR: = / camera/mv_pro_5.0/montavista/pro/devkit/arm/v5t_le
TARGET_FS: = $ (HOME) / target / filesys
KERNELDIR: = $ (HOME) / ti-davinci
BASE_DIR: = $ (HOME) / av_capture / build
New in / camera / ss / ipnc / next target, established at its next filesys, cramfs folder, cramfsImage_ipnc_dm365_0.7.0 copied to the target.
root @ www.linuxidc.com :/ Camera / SS / IPNC / target # LS
cramfs cramfsImage_ipnc_dm365_0.7.0 filesys root @ www.linuxidc.com :/ Camera / SS / IPNC / target # Mount-O loop-tcramfs cramfsImage_ipnc_dm365_0.7.0cramfs / root @ www.linuxidc.com :/ Camera / SS / IPNC / target # LS cramfs / bin etc lib mnt proc sbin tmp var dev init linuxrc opt root SYS usr root @ www.linuxidc.com :/ Camera / SS / IPNC / target # cp-av cramfs / * filesys /
13, and then you can run:
rm-rf / camera / ss / ipnc / target / filesys / root / .esm *
rm-rf / camera / ss / ipnc / target / filesys / usr / local / etc / *
make-s sysall
rm-rf / camera / ss / ipnc / target / rdmnt
rm/camera/ss/ipnc/target/cramfsUby00
mkdir / camera / ss / ipnc / target / rdmnt
cp-av / camera / ss / ipnc / target / filesys / * / camera / ss / ipnc / target / rdmnt
sudomkcramfs / camera/ss/ipnc/target/rdmnt/camera/ss/ipnc/target/cramfsUby00
cp / camera / ss / ipnc / ti-davinci / arch / arm / boot / uImage / home/ss/uImageUby00
# / Var/lib/tftpboot/uImage_00
cp/camera/ss/ipnc/target/cramfsUby00 / home/ss/cramfsUby00
There are:
# Make-s lsp / / incrementally build LSP
# Make-s lspclean / / clean all generated files in LSP
# Make-s lspall / / cleanand rebuild all LSP
# Make-s dvsdk / / incrementally buildDVSDK
# Make-s dvsdkclean / / clean all generatedfiles in DVSDK
# Make-s dvsdkall / / clean and rebuild all DVSDK
# Make-s / / incrementally build AV server and IPNC APP
# Make-s clean / / cleanall generated files in AV server and IPNC APP
# Make-s all / / clean and rebuild all AV Server and IPNC APP
# Make-s sys / / incrementally build LSP, DVSDK, AV server and IPNC APP
# Make-s sysclean / / clean all generated files LSP, DVSDK, AV serverand IPNCAPP
# Make-s sysall / / clean and rebuild all LSP, DVSDK, AVserver and IPNC APP
@bandwidthcrunch
Copy link
Author

DAVINCI DM365-DM368 development Raiders - linux-2 .6.32 transplant
2012-01-30 11:21:58
Tags: transplant development Raiders linux leisure DM365 DM368
Original works, for permission to reproduce, be sure to indicate the form of hyperlinks article reprint the original source , author information and this statement. Otherwise it will be held liable. http://zjbintsystem.blog.51cto.com/964211/768652
2012 Chinese New Year this way too, during the holidays, in large projects received no progress in the case (team everyone home for the holiday), the use of this three-day Shenzhen coldest time (5 ° C): 1 25 to 27 months, and quickly completed the manuscript of this article, after a long time did not update the blog, and work behind a busy few customers have large projects; Here also the way to commemorate the father passed away last year's C language - - Dennis Ritchie, father of Unix operating systems are also, he let embedded growing so fast, so rapid technological development, C language is so beautiful, simple, greatly improving the software platform across the main chip transplant, he toiled, I decided "." This article is not used, the direct use ";", and a lot of friends, like, use the ";" End of the line on behalf of C-language instruction, to express his recall;

I. Introduction Linux-2.6.32 :
Linux-2.6.32 online description: adds virtualization memory de-duplicacion, rewritten writeback code, improving the Btrfs file system, add the ATI R600/R700 3D and KMS support, CFQ low transmission delay mode, perf timechart tools, memory controller supports soft limits, supports S + Core architecture that supports Intel Moorestown and its new firmware interface, support for power management, and new drivers runtime; these I do not know, but I just noticed that common LINUX operating System RADHAT Enterprise 6, ubuntu-10.04, debian 6.0 stable version, these are using linux-2.6.32 This version, even more smartphones, android phones (HTC-G7 Mobile version of the classic use linux-2.6.32.15 and android version 2.2 combine), because only from linux-2.6.32 later, in order to take advantage of android system; however mononuclear DM368 either 432MHz or new out of more than 500 MHz, running android system is very difficult, only to run QT, here no discussion ;

I wrote the kernel environment and path are based on the basis of the first two articles carried, starting Rules.make dvsdk_dm368_4_02_00_06 \ Makefile under and began to see Rules.make line 45,

LINUXKERNEL_INSTALL_DIR = $ (DVSDK_INSTALL_DIR) / psp/linux-2.6.32.17
Obviously we have changed the name of the kernel linux-2.6.32.17, originally installed to extract out of the name is too long, so to change it in Rules.make line 45; Makefile is compiled script, TI developed the entire DVSDK4.02 Environmental unified together, reflected in the Makefile, after reading this Makefile, you should know how to compile the entire DVSDK in all packages, see the 143 kernel compile command line begins; using make linux at dvsdk_dm368_4_02_00_06 \ directory, make linux_config, make linux_clean and other commands to compile the kernel;

Second, start transplants: delete unnecessary files from the folders and files to start:
1, dvsdk_dm368_4_02_00_06/psp/linux-2.6.32.17/arch/arm/configs
Leaving only davinci_dm365_defconfig

Figure -1
Then press the figure -1, first use the default config file kernel configuration,
cp arch/arm/configs/davinci_dm365_defconfig. config
Note that path;

2, delete the non-ARM processor chip platform
Enter dvsdk_dm368_4_02_00_06/psp/linux-2.6.32.17/arch, retention arm, um, x86 three folders, other files deleted;
Then enter dvsdk_dm368_4_02_00_06/psp/linux-2.6.32.17/arch/um folder, leaving only the scripts folder, and other deleted, including that several documents and other documents are also Kconfig deleted;
Continues into dvsdk_dm368_4_02_00_06/psp/linux-2.6.32.17/arch/x86 folder, leaving only include folders and mm, and a few files, delete other folders shown below -2:

Figure -2
Continues into dvsdk_dm368_4_02_00_06/psp/linux-2.6.32.17/arch/arm folder, keep mach-davinci folder and keep the drawing of folders and files, other-delete mach with it, space, and time accounts for backup compression time

Figure -3

The figure is the result of -3 after deleting directories under dvsdk_dm368_4_02_00_06/psp/linux-2.6.32.17/arch/arm display;

3, modify dvsdk_dm368_4_02_00_06/psp/linux-2.6.32.17/arch/arm/Makefile,
The first line starts from 120, # Machine-$ (CONFIG_ARCH_AAEC2000) : = aaec2000
Up to 172 lines,

Machine-$ (CONFIG_ARCH_MXC91231) : = mxc91231

Leaving only the Machine-$ (CONFIG_ARCH_DAVINCI) : = davinci , all the other using the "#" to shield off, we just Machine-$ (CONFIG_ARCH_DAVINCI) : = davinci
176 lines to 184 all use the "#" to shield off, do not these chips platforms;

4, modify dvsdk_dm368_4_02_00_06/psp/linux-2.6.32.17/arch/arm/Kconfig
The first line starts from 707 until 793 line, these "#" all use to shield off, keep the first 795 lines of source "arch / arm / mach-davinci / Kconfig", and then continue to use the first line 797-805 " "Give masked;
After deleting the above, the use of tar jcf or tar zcf compressed linux-2.6.32.17 down 51M, no more than reduce the size of the deleted nearly half; our pursuit of simple, clear thinking; fact, there are many places you can remove, we Slowly experience, including include, old-fashioned device driver inside, there is not a long-winded; remember to delete the corresponding Kconfig and Makefile to shield off;

Third, starting from the kernel configuration

Figure -4

Because already done cp arch/arm/configs/davinci_dm365_defconfig config we specify the path on the map by using make linux_config, so you see the familiar kernel configuration interface, as shown below -5:

Figure -5
Now a configuration of a sequence, of course, many configuration options are configured using TI davinci_dm365_defconfig we analyze them, cutting, modify,
Enter "General setup" Configuration

Figure -6
The figure is more than we chose the compression RAM disk file system support, the default is to use gzip production RAM DISK file system, you can also use bzip2 and LZMA (higher compression ratio than the previous two);

Figure -7
Enter the "System Type" configuration, according to TI above the original configuration,

Figure -8
Then go directly to "TI Davinci Implementations", by the above choices, the rearmost 27000000 means that your main chip oscillator is 27MHz or 24MHz, 24MHz crystal oscillator of the company is, we put 27 million into 24 million;

Figure -9
Returning to Figure -5, enter "Networking support", your system if there is no WIFI wireless module, the wireless "wireless" agreement can not vote;

Figure -10
Mainly on the "Networking options" configuration, where basically IPV4 and IPV6 protocol configuration, we had the choice by TI with "M" option can also use the "*" compiled into the kernel, rather than the module;

Figure -11

Figure -12
Returning to Figure -5 enter "Device Drivers", which is the focus kernel configuration shown in Figure 11 and Figure -12

Figure -13
First of NAND FLASH MTD partitions configured in order, direct reference to TI default configuration;

Figure -14
Figure -14 RAM / ROM / FLASH and TI below 3 use the default configuration,

Figure -15
Enter "NAND device Support" configuration, be sure to select "Support NAND on Davinci SoC",

Figure -16
This is 2.6.32 new features, began to support UBI file system, the file system appears UBI allows JFFS2, YAFFS2 out of the market, running android system, must be used, where we can not choose, you can choose, depending on your What kind of board you want to use the file system;

Figure -17
Returning to Figure -11 enter "Block devices" configuration, we directly use TI's configuration,

Figure -18
Returning to Figure -11 enter "SCSI device support" configuration, select this to support U disk, U disk otherwise you can not be DM368 board recognition, we generally set the DM368 USB HOST mode;

Figure -19
Returning to Figure -11 enter "Network device support" configuration, general RJ45 network port and select "10M or 100Mbit", DM368 does not support 1000Mbit, Wireless "Wireless LAN" You do not, then you can not choose; "PPP" This can not vote , but sometimes it support 3G module, PPP protocol (see Figure 10 in the configuration) and device support to choose;

Figure -20
Enter "10M or 100Mbit", select "TI Davinci EMAC Support;

Figure -21
Returning to Figure -11 enter "Input device support", which choose whether to support touch screen, mouse and keyboard input, do not have access to our side, not directly elected;

Figure -22
Returning to Figure -11 enter "Char device", be sure to choose DM365 IPIPE, IMP Previewer, IMP Resizer, this time to debug video capture program requires Previewer, Resizer, etc. DAVINCI technology;

Figure -23
In Figure -22, choose to enter "Serial driver", here is the serial port is configured DM368, DM368 supports UART0 and UART1, UART1 and other GPIO multiplexing, distribution and use of hardware resources carefully, and DM6446, are driving 8250, The DM6446 can be configured three UART;

Figure -24
Returning to Figure -11 enter "I2C Support", this did not have to say, definitely use chosen,

Figure -25

TI chip development board I2C extended use, we do not need, so External do not, just choose the "Davinci I2C driver";

Figure -26
Returning to Figure -11 enter "SPI Support", if you do not have an external board chip SPI interface, where you can not choose;

Figure -27
Returning to Figure -11 enter "GPIO Support", TI chips use more GPIO pin expansion, we do not need, can not vote;

Figure -28
Returning to Figure -11 enter "Watchdog Timer Support", who use the software watchdog, needs this election, DM368 and DM6446 chips support software watchdog, note choice is "Davinci watchdog";

Figure -29
Returning to Figure -11 enter "Multimedia support", multimedia support, this is the Davinci focus

-30
By TI default selection, MT9P031 500 megapixel SERSEOR be elected, you have other companies SENSOR, can also refer MT9P031 SENSOR way your drive, and then modify the linux-2.6.32.17 \ drivers \ media \ video inside Makefile and Kconfig files on OK;

Figure -31
Then from -30's "encoders / decoders and xxxx" into select TVP5146, HD Ypbpr output THS7303, choose to support TH7353 chip companies use our TVP5158, I add it to the kernel compiled, so here display TVP5158, TVP7002 we did not use, So do not choose;

Figure -32
Returning to Figure -11 enter "Graphics Suppor", this is to choose to support TFT3.5, TFT4.3 inch LCD screen driver, it is through the RGB interface supports screen output, I do not support the board, you can also choose a default by TI Set;

Figure -33
Returning to Figure -11 enter "Sound card Suppor", sound choice

Figure -34
Audio function module with the DM368 main chip set directly by the TI,

Figure -35
Returning to Figure -11 into "USB Suppor", we run the DM368 to use LINUX system as HOST, "HID Support" is to support things like mouse and keyboard, you can also choose not to; basically using the default configuration of TI

Figure -36
Here choose to support U disk, and said earlier this is the corresponding SCSI Spport;

Figure -37
Returning to Figure -11 enter "MMC / SD / SDIO Suppor", linux-2.6.32 SD card driver fully supports 32G capacity, DM368 supports two SD card interfaces 0 and 1, the basic need to use what SD0 transplant, using SD1 Note the use of the kernel driver SD1 card, multiplexed GPIO pin is not required;

Figure -38
Returning to Figure -11 into "Real Time Clock", DM368 supports RTC clock chip, namely "TI Davinci RTC", our own board supports external RTC clock chip PCF8563, according to peripheral selection;

Figure -39
Returning to Figure -5 enter "File systems", the need for supported file systems to choose, choose EXT2/EXT3/EXT4 file system in case of power failure protection for storage devices and log recovery, much better than FAT32, such as the SD FAT32 formatted card EXT3/EXT4 better than using;

Figure -40
Other reservations TI configuration

Figure -41
Into support "DOS / FAT / NT" file system, according to the above choices, NTFS is not used, I do not know if it works in the embedded purpose here is to be able to choose to use U disk storage devices, etc.;

Figure -42
Enter "Pseudo filesystems", leave the default configuration of TI;

Figure -43

Figure -44
Enter "Miscellaneous filesystems", configure NAND FLASH supported file system, YAFFS2 file system is I downloaded and then press the patch on the line transplantation, TI had not, select YAFF2, JFFS2, there cramfs, SquashFS, UBI file system is currently no verification, have time to try again, just mentioned, are the most commonly used embedded NAND filesystem is to burn into the NAND FLASH;

Figure -45
Figure -45 NFS file system is set up, we run on the board is NFS client mode, that client, and the development environment is the NFS SERVER end; inside the SMB (SAMBA) do not need support on the board, we do not choose to remove ;

Figure -46
Figure -46 kernel support is to choose the language;

Then backup configuration: In dvsdk_dm368_4_02_00_06 directory

Cp psp/linux-2.6.32.17/.config psp/linux-2.6.32.17/dm368_20111227.config

Note that the path after every use make distclean and make linux_clean commands, config does not exist, then we have to use:

Cp psp/linux-2.6.32.17/dm368_20111227.config psp/linux-2.6.32.17/.config attention config, so the whole kernel configuration basically ended. ".";

Fourth, analyze and modify the code:

1, mach-davinci \ board-dm365-evm.c
This is where the focus DM368 kernel porting, system initialization functions are here, and external devices in their drive initialization file; open 156 line # define NAND_BLOCK_SIZE SZ_128K
While shielding / * # define NAND_BLOCK_SIZE SZ_512K * / this is 4K-PAGE NAND FLASH
Because we are using the company's board 2K-PAGE of NAND FLASH, 512 bytes of NAND is not suitable for the new file system will slowly be phased out;

Modify NAND FLASH partitions,
static struct mtd_partition davinci_nand_partitions [] = {
{
/ * UBL (a few copies) plus U-Boot * /
. Name = "bootloader",
. Offset = 0x80000,
. Size = 3 * NAND_BLOCK_SIZE,
. Mask_flags = 0,
/ * Tongye:. Mask_flags = MTD_WRITEABLE, * / / * force read-only * /
, {
/ * U-Boot environment * /
. Name = "params",
. Offset = 0xe0000,
. Size = 1 * NAND_BLOCK_SIZE,
. Mask_flags = 0,
, {
. Name = "kernel",
. Offset = 0x100000,
. Size = SZ_4M + SZ_512K,
. Mask_flags = 0,
, {
. Name = "basefs",
. Offset = 0x100000 + SZ_4M + SZ_512K,
. Size = SZ_32M-SZ_4M,
. Mask_flags = 0,
/ * Tongye: 28M-byte for ramdisk, cramfs, squashfs rootfs * /
, {
. Name = "userfs",
. Offset = 0x100000 + SZ_32M + SZ_512K,
. Size = SZ_64M + SZ_16M,
. Mask_flags = 0,
/ * Tongye: 80M-byte for jffs2, yaffs2 rootfs * /
, {
. Name = "userdata",
. Offset = SZ_64M + SZ_32M + SZ_16M + SZ_1M + SZ_512K,
. Size = 0x8000000-SZ_64M-SZ_32M-SZ_16M-SZ_1M-SZ_512K,
. Mask_flags = 0,
}

   / * Two blocks with bad block table (and mirror) at the end * /

};

UBL code in 0x20000 ~ 0x40000 location, general NAND FLASH BLOCK front five chance of bad blocks is very small, rarely go in the product maintenance updates UBL, so there is no single point of the UBL partition; while other spaces appear chance of bad blocks is relatively large, so give U-BOOT divided into 3 to 4 BLOCK enough, the kernel of 5M-BYTE is good enough, and the U-BOOT parameters of 1 to 2 BLOCK, the Company directly into 0x60000 ~ 0x80000 space can be, there is no requirement; behind the file system partition on the size of the partition conducted according to the type of file you are cutting system, file system;

static struct i2c_board_info i2c_info [] = {
/ * {
I2C_BOARD_INFO ("dm365evm_keys", 0x25),
}
{
I2C_BOARD_INFO ("24c256", 0x50),
. Platform_data = & eeprom_info,
}

  • /
    {
    I2C_BOARD_INFO ("tlv320aic3x", 0x18),
    }

    {
    I2C_BOARD_INFO ("ths7303", 0x2c),
    }
    / * {
    I2C_BOARD_INFO ("PCA9543A", 0x73),
    } * /
    {
    I2C_BOARD_INFO ("pcf8563", 0x51),
    }
    };
    This structure is to look at what kind of equipment you I2C bus with, depending on your I2C device address, added to this, so as to call into the device initialization function; seen from the above changes, our board does not need these EEPROM AT24C256 chip, you can get rid of;

static void dm365evm_reset_imager (int rst)
{
u8 val;
/ / Tongye

If 0

val = __ raw_readb (cpld + CPLD_POWER) | BIT (3) | BIT (11) | BIT (19) | BIT (27);
__raw_writeb (val, (cpld + CPLD_POWER));

val = __ raw_readb (cpld + CPLD_MUX) | BIT (6) | BIT (14) | BIT (22) | BIT (30);
__raw_writeb (val, (cpld + CPLD_MUX));

   / * Reset bit6 of CPLD_IMG_DIR2 * /
   val = __ raw_readb (cpld + CPLD_IMG_DIR2) & ~ BIT (6);
   __raw_writeb (val, (cpld + CPLD_IMG_DIR2)); 

   / * Set bit5 of CPLD_IMG_MUX5 * /
   val = __ raw_readb (cpld + CPLD_IMG_MUX5) | BIT (5);
   __raw_writeb (val, (cpld + CPLD_IMG_MUX5));      

   / * Reset bit 0 of CPLD_IMG_MUX5 * /
   val = __ raw_readb (cpld + CPLD_IMG_MUX5) & ~ BIT (0);
   __raw_writeb (val, (cpld + CPLD_IMG_MUX5));      

Endif

   / **
    * Configure GPIO40 to be output and high. This has dependency on MMC1
    * /

If 1

   davinci_cfg_reg (DM365_PWM3_G85);
   davinci_cfg_reg (DM365_PWM3_G86);
   gpio_request (85, "sensor_reset");
   gpio_request (86, "sensor_standby");
   gpio_direction_output (85, 0);
   gpio_direction_output (86, 0);
   gpio_set_value (85,1);
   gpio_set_value (86,1);
   mdelay (15);  header file to add # include <linux/delay.h>
   gpio_set_value (85,0);
   gpio_set_value (86,0);
   mdelay (25);
   gpio_set_value (85,1);
   gpio_set_value (86,1);
   mdelay (25);

Else

   davinci_cfg_reg (DM365_GPIO40);
   gpio_request (40, "sensor_reset");
   if (rst)
          gpio_direction_output (40, 1);
   else
          gpio_direction_output (40, 0);

Endif

}
The above function modification: We do not need CPLD, so masked, we directly use the GPIO control MT9P031 SENSOR reset and STANDBY signal;

static struct vpfe_subdev_info vpfe_sub_devs [] = {

   {
          . Module_name = "tvp5158",
          . Grp_id = VPFE_SUBDEV_TVP5146,
          . Num_inputs = ARRAY_SIZE (tvp5158_inputs),
          . Inputs = tvp5158_inputs,
          . Routes = tvp5158_routes,
          . Can_route = 1,
          . Ccdc_if_params = {
                 . If_type = VPFE_BT656,
                 . Hdpol = VPFE_PINPOL_POSITIVE,
                 . Vdpol = VPFE_PINPOL_POSITIVE,
          }
          . Board_info = {
                 I2C_BOARD_INFO ("tvp5158", 0x5B),
                 . Platform_data = & tvp5158_pdata,
          }
   }
   {
          . Module_name = "tvp7002",
          . Grp_id = VPFE_SUBDEV_TVP7002,
          . Num_inputs = ARRAY_SIZE (tvp7002_inputs),
          . Inputs = tvp7002_inputs,
          . Ccdc_if_params = {
                 . If_type = VPFE_BT1120,
                 . Hdpol = VPFE_PINPOL_POSITIVE,
                 . Vdpol = VPFE_PINPOL_POSITIVE,
          }
          . Board_info = {
                 I2C_BOARD_INFO ("tvp7002", 0x5c),
                 . Platform_data = & tvp7002_pdata,
          }
   }
   {
          . Module_name = "ths7353",
          . Grp_id = VPFE_SUBDEV_TVP7002,
          . Board_info = {
                 I2C_BOARD_INFO ("ths7353", 0x2e),
          }
   }
   {
          . Module_name = "mt9p031",
          . Is_camera = 1,
          . Grp_id = VPFE_SUBDEV_MT9P031,
          . Num_inputs = ARRAY_SIZE (mt9p031_inputs),
          . Inputs = mt9p031_inputs,
          . Ccdc_if_params = {
                 . If_type = VPFE_RAW_BAYER,
                 . Hdpol = VPFE_PINPOL_POSITIVE,
                 . Vdpol = VPFE_PINPOL_POSITIVE,
          }
          . Board_info = {
                 I2C_BOARD_INFO ("mt9p031", 0x48),
                 / * This is for PCLK rising edge * /
                 . Platform_data = (void *) 1,
          }
   }

};
TI's DM368 development board supports TVP5146, TVP7002, MT9P031; TVP5146 representatives SD composite video input capture chip (D1 format), TVP7002 behalf HD YPbPr input composite video capture chip, MT9P031 represents 500 million pixels SENSOR collection;

/ * Set the input mux for TVP7002/TVP5146/MTxxxx sensors * /
static int dm365evm_setup_video_input (enum vpfe_subdev_id id)
{
const char * label;
u8 mux, resets;
/ / Jingbo

   / / / / / Mux = __ raw_readb (cpld + CPLD_MUX);
   / / / / Mux & = ~ CPLD_VIDEO_INPUT_MUX_MASK;
   / / / / Resets = __ raw_readb (cpld + CPLD_RESETS);

   switch (id) {
          case VPFE_SUBDEV_TVP5146:
                 mux | = CPLD_VIDEO_INPUT_MUX_TVP5146;
                 resets & = ~ BIT (0);
                 label = "tvp5158 SD";
                 dm365evm_reset_imager (0);
                 break;
          case VPFE_SUBDEV_MT9P031:
                 mux | = CPLD_VIDEO_INPUT_MUX_IMAGER;
                 resets | = BIT (0); / * Put TVP5146 in reset * /
                 label = "HD imager";

                 dm365evm_reset_imager (1);
                 / * Switch on pca9543a i2c switch * /
                 / / / / If (have_imager ())
                        / / / / Dm365evm_enable_pca9543a (1);
                 break;
          case VPFE_SUBDEV_TVP7002:
                 resets & = ~ BIT (2);
                 mux | = CPLD_VIDEO_INPUT_MUX_TVP7002;
                 label = "tvp7002 HD";
                 break;
          default:
                 return 0;
   }
   / / / / __raw_writeb (Mux, cpld + CPLD_MUX);
   / / / / __raw_writeb (Resets, cpld + CPLD_RESETS);

   pr_info ("EVM: switch to% s video input \ n", label);
   return 0;

}
The above function to remove the CPLD things, the video capture chip choice is and the parameters of U-BOOT-one correspondence, the U-BOOT bootargs parameters, the added davinci_capture.device_type = 0 means that the use of TVP5146 collection, davinci_capture.device_type = 1 means MT9P031 collection, davinci_capture.device_type = 2 that the use of TVP7002 capture, read U-BOOT kernel parameter determines whether to call what kind of capture chip driver initialization; Therefore, we in the kernel configuration, they can choose simultaneously the three chips;
static void __ init evm_init_i2c (void)
{
davinci_init_i2c (& i2c_pdata);

If 0

   if (have_imager ())
          i2c_add_driver (& pca9543a_driver);

Endif

   i2c_register_board_info (1, i2c_info, ARRAY_SIZE (i2c_info));

}
This pca9543a I2C switch chips we do not need;

static void __ init evm_init_cpld (void)
{
u8 mux, resets;
const char * label;
struct clk * aemif_clk;
struct davinci_soc_info * soc_info = & davinci_soc_info;

   / * Make sure we can configure the CPLD through CS1. Then
    * Leave it on for later access to MMC and LED registers.
    * /
   aemif_clk = clk_get (NULL, "aemif");
   if (IS_ERR (aemif_clk))
          return;
   clk_enable (aemif_clk);

If 0

   if (request_mem_region (DM365_ASYNC_EMIF_DATA_CE1_BASE, SECTION_SIZE,
                 "Cpld") == NULL)
          goto fail;
   cpld = ioremap (DM365_ASYNC_EMIF_DATA_CE1_BASE, SECTION_SIZE);
   if (! cpld) {
          release_mem_region (DM365_ASYNC_EMIF_DATA_CE1_BASE,
                        SECTION_SIZE);

fail:
pr_err ("ERROR: can't map CPLD \ n");
clk_disable (aemif_clk);
return;
}

   / * External muxing for some signals * /
   mux = 0;

   / * Read CPLD version number * /
   soc_info-> cpld_version = __ raw_readb (cpld + CPLD_VERSION);

   / * Read SW5 to set up NAND + keypad _or_ OneNAND (sync read).
    * NOTE: SW4 bus width setting must match!
    * /
   if ((__raw_readb (cpld + CPLD_SWITCH) & BIT (5)) == 0) {
          / * External keypad mux * /
          mux | = BIT (7);

          platform_add_devices (dm365_evm_nand_devices,
                        ARRAY_SIZE (dm365_evm_nand_devices));
   } Else {
          / * No OneNAND support yet * /
   }

   / * Leave external chips in reset when unused. * /
   resets = BIT (3) | BIT (2) | BIT (1) | BIT (0);

   / * ... And ENET ... * /
   dm365evm_emac_configure ();
   soc_info-> emac_pdata-> phy_mask = DM365_EVM_PHY_MASK;
   soc_info-> emac_pdata-> mdio_max_freq = DM365_EVM_MDIO_FREQUENCY;
   resets & = ~ BIT (3);

   / * ... And AIC33 * /
   resets & = ~ BIT (1);

   / * Static video input config with SN74CBT16214 1-of-3 mux:
    * - Port b1 == tvp7002 (mux lowbits == 1 or 6)
    * - Port b2 == imager (mux lowbits == 2 or 7)
    * - Port b3 == tvp5146 (mux lowbits == 5)
    *
    * Runtime switching could work too, with limitations.
    * /
   if (have_imager ()) {
          label = "HD imager";
          mux | = CPLD_VIDEO_INPUT_MUX_IMAGER;
          / * Externally mux MMC1 to imager * /
          mux | = BIT (6);
          dm365evm_reset_imager (1);

   } Else {

          / * We can use MMC1 ... * /
          dm365evm_mmc_configure ();
          davinci_setup_mmc (1, & dm365evm_mmc_config);

          if (have_tvp7002 ()) {
                 mux | = CPLD_VIDEO_INPUT_MUX_TVP7002;
                 resets & = ~ BIT (2);
                 label = "tvp7002 HD";
          } Else {
                 / * Default to tvp5146 * /
                 mux | = CPLD_VIDEO_INPUT_MUX_TVP5146;
                 resets & = ~ BIT (0);
                 label = "tvp5158 SD";
                 dm365evm_reset_imager (0);
          }
   }
   __raw_writeb (mux, cpld + CPLD_MUX);
   __raw_writeb (resets, cpld + CPLD_RESETS);

Else

   platform_add_devices (dm365_evm_nand_devices,
          ARRAY_SIZE (dm365_evm_nand_devices));

   / * ... And ENET ... * /
   dm365evm_emac_configure ();
   soc_info-> emac_pdata-> phy_mask = DM365_EVM_PHY_MASK;
   soc_info-> emac_pdata-> mdio_max_freq = DM365_EVM_MDIO_FREQUENCY;

   / / If (have_imager ())
   {
          dm365evm_reset_imager (1);
          / / Pr_info ("EVM: reset mt9p031 imager \ n");
   }
   / / Pr_info ("EVM:% s video input \ n", label);

Endif

   / * REVISIT export switches: NTSC / PAL (SW5.6), EXTRA1 (SW5.2), etc * /

}
The above function is very important, in addition to removing CPLD things outside, must take
platform_add_devices (dm365_evm_nand_devices,
ARRAY_SIZE (dm365_evm_nand_devices));
Reservations, otherwise your kernel boot time, there is no display NAND drives and partitions;
dm365evm_emac_configure (); certainly want, otherwise there is no network driver called LINUX it? TI is through the CPLD to control some of the peripherals, CPLD expensive, not suitable for low-cost mass production, so we removed;

static __ init void dm365_evm_init (void)
{
dm365evm_gpio_configure (); / / tongye: copy it here
evm_init_i2c ();
davinci_serial_init (& uart_config);

   dm365evm_emac_configure ();
   dm365evm_usb_configure ();

   davinci_setup_mmc (0, & dm365evm_mmc_config);

   / * Maybe setup mmc1/etc ... _after_ mmc0 * /
   evm_init_cpld ();

   dm365_init_asp (& dm365_evm_snd_data);
   / / Dm365_init_rtc ();
   / / Dm365_init_ks (& dm365evm_ks_data);

/ / Dm365_init_spi0 (BIT (0), dm365_evm_spi_info,
/ / ARRAY_SIZE (dm365_evm_spi_info));

   / / Dm365_init_tsc2004 ();
   dm365evm_gpio_configure ();

}
This function is for MMC / SD, USB, and other interfaces initialized, tsc2004 This is a touchscreen chips, dm365evm_gpio_configure () inside we've added a lot of initial value defines the GPIO;

2, modify mach-davinci \ dm365.c
This should and arch \ arm \ mach-davinci \ include \ mach \ mux.h tie look,
Mux_config dm365_pins good look at this definition, the DM368 is pin multiplexing is very complex, a feature enabled, then the corresponding additional functions can not be used, so be very careful with, in particular, and GPIO multiplexing;

These latter source is introduced and analyzed tips:
drivers \ char \ There dm365_ipipe.c
, Imp_common.c, imp_previewer.c, imp_resizer.c, and other documents;

drivers \ i2c \ busses \ There i2c-davinci.c

Highlights: drivers \ media \ video \ There V4L2 interface driver;
drivers \ media \ video \ mt9p031.c, tvp514x.c, tvp7002.c;

drivers \ media \ video \ davinci \ li things a lot, dm365_ccdc.c, vpfe_capture.c

drivers \ net \ There davinci_emac.c

drivers \ usb \ musb \ li davinci.c
GPIO use has not been clear how this new kernel is always a time for every U disk reset, and 2.6.18 is not the same, and made a U disk has been successfully enumerated the device, then re-assign a new USB DEVIDE reset address;

drivers \ watchdog \ There davinci_wdt.c
Line 32 # define DEFAULT_HEARTBEAT 2 / / tongye removed 60s
Only one application to use Open to open the device, WDG will take effect, do not feed the dog for 2 seconds on the software reset;

linux-2.6.32.17 \ sound \ soc \ codecs have tlv320aicxx.c other audio chip driver;
linux-2.6.32.17sound \ soc \ davinci There PCM, I2S and other drivers;

Then display drivers \ video \ davincifb.c, this should and drivers \ media \ video \ davinci 's vpbe_encoder.c, davinci_display.c, davinci_osd.c ah etc. files VPBE interface corresponds;

Finally, add a build script in dvsdk_dm368_4_02_00_06 directory build_linux.sh:

#! / Bin / sh
make linux
chmod 777 / home/davinci/dm368/dvsdk_dm368_4_02_00_06/psp/linux-2.6.32.17/arch/arm/boot/uImage
cp-f / home/davinci/dm368/dvsdk_dm368_4_02_00_06/psp/linux-2.6.32.17/arch/arm/boot/uImage / tftpboot/dm368_kernel.bin
Direct. / Build_linux.sh, you can get in the / tftpboot directory dm368_kernel.bin, on the board, through U-BOOT kernel programming, debugging through the first NFS, U-BOOT on articles transplant article describes the U- BOOT for NFS parameters defined here is not long-winded;

Well, linux-2.6.32 transplanted to this end, basically I currently only debug through TVP5158 single D1 (720 * 576) image capture and compression, validate our core board OK on the line, such as software engineers to debug through 1080p just released a new development board, because DM368 development program is not our focus;

Now kernel version update very fast, we just need to pick a stable version of the product do not frantically to follow suit, although TI has launched a version of linux-2.6.37, but the product was chosen to make a stable and relatively new version; Linux -2.6.18 bit behind, but in China, the vast majority of companies still use dvsdk_2_10_01_18 current version, this side is using Linux-2.6.18 kernel; This situation is a common problem in China, because we do not own the country The main chip (yes, say something serious, shell, with those real estate vacancy rate of more than 70% of the same; future, over time, as if there is no estimated food even BT gene (transgene) are controlled by others ), a lot of things people are being dragged by the nose, people technology has developed rapidly, that this upgrade is very natural, and we felt this upgrade is jumping, many companies have no energy to update technology; on such DM642, the 2005 was already out of the large low-power extensions + chip, TI is now in China or even up to an image processing chip shipments, many companies simply ignore what you dual-core DM6446, OMAP3730, DM6467T, DM8168, CA8168, multicore C667X, They think that version on a CCS3.X do product development to meet, and too lazy to update technology, even more cost-effective DM6446; Time waits for no man, not just the software version updated quickly, the main chip update speed is very fast, and now the popular ARM Cortex -A8 and ARM Cortex-A9, then TI launched ARM Cortex-A8 + floating point DSP, Qualcomm QCOM introduced lower power ARM Cortex-A9 + DSP (Huawei, ZTE, HTC's new smartphone using the main chip), etc. etc., Samsung also launched ARM Cortex-A9 main chip, low power + feature-rich mainstream;
As mentioned DM368 is not the focus of our development, we are more concerned about ARM + DSP chips that are more powerful, because the chip is suitable for those who make innovative products; senior point now is to make their own domestic companies ARM + FPGA programs Because nothing less than FPGA Xilinx (Xilinx, or race Ling silk, funny little) as the representative of SoPC; more advanced companies such as Huawei Hass (Huawei is the parent company, was acquired by Taiwan Hass), do yourself ARM program chip tapeout in Hass, now filled with low-end security products (DVR, IP-CAMERA, DVS, etc.) are Huawei Hass Hi35XX chip, because the chip can not do intelligent image analysis, machine vision products, So we do not have to develop, so have the opportunity to go play and the capital, after Huawei Hass chips are escalating; Godson MIPS architecture, do not mention, directly STMicroelectronics taped up (was going to say the flow X's, well, anyway, we have been fooled, and was tossing numb), people STMicroelectronics% 5 patents that MIPS instruction is insurmountable, and we do not have high-precision machine tools, advanced semiconductor processing technology ;
2012 is destined to be an extraordinary year, because of the large economic environment even worse, the first in Europe to be a big problem, China's crisis came, in times of crisis is best used for internal strength, not brandished a knife from the palace, NB's people " crisis "as a" machine ", NC are doomed to drift, no sense of crisis, there is no thought, nor dare, not to talk about do it; rather grandiose toss, destined to fall into the abyss; Technology development in the developing world , and now a large group of people who want to return to a bygone era, it really is hopeless; There are more funny chopper real-name system, which in turn is an absurd extreme; are regressive;
Long-winded, then do not say, users feel linux-2.6.32 transplant reference value to you, you help the top look; there is information that friends do not reprint articles beginning 51cto to remove, I found a TI Chinese site contains several articles into their own forum, and began to remove my blog information, and too insufficient ethics of;

@bandwidthcrunch
Copy link
Author

DAVINCI DM365-DM368 development Raiders - U-BOOT-2010 .12 and UBL transplant
2011-11-13 22:20:40
Tags: U-BOOT UBL DM368 development Raiders core board
Original works, for permission to reproduce, be sure to indicate the form of hyperlinks article reprint the original source , author information and this statement. Otherwise it will be held liable. http://zjbintsystem.blog.51cto.com/964211/713240
From the summer came late autumn, we continue DAVINCI DM365-DM368 development. Ashamed to say, people 51CTO enthusiastic support of this blog, but I was never like the other blog as frequently updated blog star, was indeed justified. Management company really tired, anxious customers more projects to do, we successfully launched the first core board DM6446-810MHz is ( http://www.tongyetech.com ), during the Security Exhibition in Shenzhen also met with several other City customers, and continue to develop our DM368.

One, DM36X the BOOT process introduced
DM36x the BOOT process and DM6446, DM6467 exactly the same, as are ARM926EJS architecture, inside there is a RBL, which RBL in the factory when the chips are programmed in the ROM, the chip power-on reset RBL running, then read Take BOOT MODE pin state level, the decision is from NAND FLASH mode or from the MMC / SD, UART, USB, SPI, EMAC, HPI one of the BOOT, see specific SPRS558A.pdf and SPRUSG5A.pdf introduction, this two documents for hardware engineers, software engineers is very important driver.

This article and subsequent DM36X basic introduction to the DM368-based, because DM365 --- dvsdk_dm365_4_02_00_06 and DM368 ---- dvsdk_dm368_4_02_00_06 of UBL, U-BOOT, KERNEL source exactly the same, if you do not consider 2A algorithm, DM368 DM365 is overclocked out of the super-high-definition!

Two, DM36X of UBL transplant
About UBL transplant, I intend to write a separate article, but too close to the UBL and UBOOT is TI davinci chip features, so to speak put together. We focus on NAND BOOT transplant, the UBL version is V1.50, in dvsdk_dm368_4_02_00_06 \ psp \ flash-utils \ DM36x and flash-utils \ directory under the Common, Common directory, there are many things, including UBL driver source code , tools, scripts, and so on. Our main concern arch, drivers, src, ubl. UBL's main () function in dvsdk_dm368_4_02_00_06 \ psp \ flash-utils \ Common \ ubl \ src \ ubl.c where these folders open to see it to understand what it means, there is not wordy.
DM36x under CCS, Common, GNU three folders:
CCS folder:
This side of the program needs to be compiled under the TI CCS through emulators and JTAG debugging and programming NAND FLASH or NOR FLASH on DM36X board, there is an application programming Writer, open the project file with CCS, will be connected to dvsdk_dm368_4_02_00_06 \ psp \ flash-utils \ Common \ drivers inside.
Common folder: Common core file device.c there and device_nand.c. device.c is the most important document, a lot of things here to initialize the system, see DEVICE_init ():
1, mask all interrupts;
2, clear the interrupt flag;
3, DEVICE_PSCInit (), Power and Sleep Controller;
4, the main chip pin multiplexing settings DEVICE_pinmuxControl (), DM36X pin multiplexing many, very complex, a total of five PINMUX register must be configured;
5, DEVICE_PLL1Init (), PPL1 configuration, see the beginning of the introduction SPRUSG5A.pdf 35, using different frequencies DM36X, these values ​​are different, but the parameters have been provided with reference to TI, is our core board DM365: ARM297_DDR243_OSC24, DM368 core board are: ARM432_DDR340_OSC24;
6, DEVICE_PLL2Init (), PPL2 configuration used above, different values ​​for different frequencies;
7, DEVICE_DDR2Init () configuration, DDR2 memory chips require different parameters on different market, in this function.
8, DEVICE_EMIFInit (), the timing for accessing NAND FLASH interface or NOR FLASH interface configuration;
9, DEVICE_UART0Init () configuration, this is what we DM36X serial debugging settings, we use UART0 to debug LINUX, where the configuration is not good, do not develop behind debugging.
10, DEVICE_TIMER0Init () TIMER0 timer settings;
11, DEVICE_I2C0Init () is provided;
GNU folder:
This is a compilation UBL environment in the LINUX environment, modify the makefile dvsdk_dm368_4_02_00_06 \ psp \ flash-utils \ DM36x \ GNU \ ubl under the

$ (MAKE)-C build TYPE = nor commented out, leaving only the $ (MAKE)-C build TYPE = nand, then make clean and make production ubl_DM36x_nand.bin documents;

If there is: device.c: (. Text +0 x2ec): undefined reference to __aeabi_uidiv 'and device.c: (. Text +0 x2e8): undefined reference to __aeabi_uidivmod' the BUG, ​​is DDR_Get_Val () function inside the division and remainder of the sentence and configure your compiler does not result.
result = ((parm * freq) / 10000) - 1; and if (((parm * freq)% 10000)), we evaluated parameters directly:
tRFC = xxx; / / DDR_Get_Val (DDR_T_RFC, DDR_FREQ);
tRP = xxx; / / DDR_Get_Val (DDR_T_RP, DDR_FREQ);
tRCD = xxx; / / DDR_Get_Val (DDR_T_RCD, DDR_FREQ);
tWR = xxx; / / DDR_Get_Val (DDR_T_WR, DDR_FREQ);
tRAS = xxx; / / DDR_Get_Val (DDR_T_RAS, DDR_FREQ);
tRC = xxx; / / DDR_Get_Val (DDR_T_RC, DDR_FREQ);
tRRD = xxx; / / DDR_Get_Val (DDR_T_RRD, DDR_FREQ);
tWTR = xxx; / / DDR_Get_Val (DDR_T_WTR, DDR_FREQ);
Not DDR_Get_Val () function evaluation, so that you can compile it. Later, I found TI's http://e2e.ti.com/support/dsp/davinci_digital_media_processors/f/100/p/115574/425950.aspx where this man was also resolved, Oh, I did not expect a solution and as a netizen The. I remember debugging Samsung 2440 UBOOT when someone points to before, where I forget what changed.

Third, introduce u-boot-2010.12 characteristics
u-boot-2010.12 architecture organizations are increasingly closer to the LINUX architecture, which is the development trend of the U-BOOT. DM36x of UBOOT source on dvsdk_dm368_4_02_00_06 \ psp below, folder called u-boot-2010.12-rc2-psp03.01.01.39, too long, our direct u-boot-2010.12. The u-boot-2010.12 support YAFFS2, UBI and other file system, support for SD card, USB, VIDEO, etc. driver to support lzma and lzo compressed kernel image, as well as the classic linux shell command support model that tab so magical, that is In "U-boot>" on the same type and LINUX host command prompt development, of course, very little of this order, and some commands are user added. Relative to the previous u-boot-1.3.4 version and other versions, the new U-BOOT the configuration script to remove the many platforms.

Four, u-boot-2010.12 transplant
DAVINCI chip series UBOOT transplant similar, relatively simple.
1, the first modifications: Makefile:
Line 140: # examples / standalone
Line 141: # examples / api
Line 246: # LIBS + = api / libapi.o
Wait a minute, we can put some unrelated folder to delete, to u-boot-2010.12 thin.
Line 323: ALL + = $ (obj) u-boot.srec $ (obj) u-boot.bin $ (obj) System.map $ (U_BOOT_NAND) $ (U_BOOT_ONENAND) u-boot.img
Increased u-boot.img behind this u-boot.img is what we want to be programmed into the NAND inside the BIN file that can be UBL to BOOT up files because u-boot.img through the u-boot-2010.12 \ tools mkimage tool under production with the first header of the file, which can be UBL header information to identify, so can be programmed into the NAND FLASH or NOR FLASH go inside. The u-boot.bin is no increase in file header information file can not be UBL directly to BOOT up. u-boot.bin only use software BOOT, such as: tftp 0x82080000 u-boot.bin; go 0x82080000.
The most important places modification: the first 350 lines:-a $ (CONFIG_SYS_TEXT_BASE)-e 0x81080000
Or-a $ (CONFIG_SYS_TEXT_BASE)-e $ (CONFIG_SYS_TEXT_BASE)
The beginning-e 0 is false, we U-BOOT-2010.12 EntryPoint the definitions to 0x81080000 , the DDR address in u-boot-2010.12 \ board \ davinci \ dm365evm \ config.mk
CONFIG_SYS_TEXT_BASE = 0x81080000
The-e (entrypoint) can not be 0 , otherwise it can not be UBL to BOOT.

Section 953 does not require changes to the line:
davinci_dm365evm_config: unconfig
@ $ (MKCONFIG) $ (@: _config =) arm arm926ejs dm365evm davinci davinci
Dm365evm DM368 also use the same name.

2, start deleting irrelevant folder
u-boot-2010.12 \ api folder
u-boot-2010.12 \ examples
u-boot-2010.12 \ nand_spl
u-boot-2010.12 \ onenand_ipl
u-boot-2010.12 \ arch \ retain only arm in the folder
u-boot-2010.12 \ arch \ arm \ cpu folder, leaving only arm926ejs
u-boot-2010.12 \ arch \ arm \ cpu \ arm926ejs folder, leaving only davinci folder, we just delete the folder, cpu.c and Makefile next do not delete, and so on;
u-boot-2010.12 \ board inside, leaving only davinci folder, delete all others;
u-boot-2010.12 \ board \ davinci \ li, leaving only dm365evm and common, other deleted;
u-boot-2010.12 \ include \ configs inside, leaving only davinci_dm365evm.h, other files and folders deleted;
Through the above operations, our u-boot-2010.12 simplify more.

3, modify the most important davinci_dm365evm.h
In the u-boot-2010.12 \ include \ configs inside, davinci_dm365evm.h
Modify # define CONFIG_SYS_NAND_MAX_CHIPS 1 , the previous two into one, which means that the system only supports a NAND FLASH;
The # define CONFIG_BOOTCOMMAND "if mmc rescan 0; Then if fatload mmc 0 0x80600000 boot.scr; Then Source 0x80600000; else fatload mmc 0 0x80700000 uImage; bootm 80700000; Fi; Fi" to comment out, we do not want to use the SD card to save the kernel BIN file uImage;
Then define # define CONFIG_BOOTCOMMAND "run nand_boot", said reading the kernel from NAND FLASH;
BOOTARGS UBOOT modify the parameters of: # define CONFIG_BOOTARGS
"Console = ttyS0, 115200n8 mem = 60M noinitrd rw ip = 192.168.1.188:192.168.1.252:192.168.1.1:255.255.255.0 root = / dev / nfs nfsroot = 192.168.1.252 :/ home/davinci/dm368/dvsdk_dm368_4_02_00_06/filesystem / dm368rootfs, nolock "
We mention here mem = 60M, is based on our board is 128M-BTYE, because behind DVSDK4.02 inside encodedecode and other examples of the need to use CMEM, and DM6446 like this, it is defined as 60M.
See dvsdk_dm368_4_02_00_06 \ filesystem \ dvsdk-dm368-evm-rootfs unpacked etc \ init.d \ loadmodule-rc file:
Default DM368 EVM Memory Map #

Start Addr Size Description

------------------------------------- ------

0x00001000 32K ARM TCM Memory

48 MB Linux # 0x80000000
0x83000000 # Driver 12 MB ​​Video Memory (Linux)

0x83C00000 68 MB CMEM

0x88000000 BOTTOM ADDRESS

load () {
modprobe cmemk phys_start = 0x83C00000 phys_end = 0x88000000 AllowOverlap = 1 phys_start_1 = 0x00001000 phys_end_1 = 0x00008000 pools_1 = 1x28672 useHeapIfPoolUnavailable = 1
modprobe irqk
modprobe edmak
modprobe dm365mmap
mknod / dev/dm365mmap c awk" \ \ $ 2 == \ "dm365mmap \ "{Print \ \ $ 1 } "/ proc / Devices 0
}
Some people define CMEM smaller shared memory, then this value can be greater than 60M. Behind the argument is to use a static IP of NFS SERVER fixed path, be NFS debugging;

Addition

Define CONFIG_IPADDR 192.168.1.188

Define CONFIG_SERVERIP 192.168.1.252

Define CONFIG_ETHADDR 00:03:55:88:00:00

Define the board's own IP and MAC, the MAC in MAC assurance and other network devices that do not conflict premise own way when debugging assignment. SERVERIP LINUX is the host IP address of our development environment, mainly used as TFTP and NFS debugging.

Define CONFIG_EXTRA_ENV_SETTINGS \

"Eraseenv = nand erase 0x00060000 0x00020000 \ 0"
"Eraseall = nand erase 0x00000000 0x08000000 \ 0"
"Updateuboot = tftp 0x84000000 dm368_uboot.bin; nand erase 80000 80000; nand write 84000000 80000 80000 \ 0"
"Updatecore = tftp 0x84000000 dm368_kernel.bin; nand erase 0x00100000 0x00480000; nand write 84000000 100000 300000 \ 0"
"Nand_boot = nboot 0x80700000 0 0x100000; bootm \ 0"
"Tftp_boot = tftpboot 0x80700000 dm368_kernel.bin; bootm \ 0"
This is very classic, I used the DM6446 at U-BOOT-2009.03 transplant said in u-boot-> prompt, use the run command, you can do some automatic batch operation. CONFIG_EXTRA_ENV_SETTINGS that have used u-boot-2010.12 \ common \ env_common.c and u-boot-2010.12 \ common \ env_embedded.c. Although you can be defined here.
run eraseenv said erase u-boot parameters;
run eraseall said erase the entire piece NAND;
run updateuboot said dm368_uboot.bin to the board via TFTP programming;
run updatecore said programming kernel file 300000 BIN represents the size of the kernel, we will die here directly, 3M's core BIN file length enough, of course, you can change the dynamic programming method based on the length of the kernel size;
TFTP to download the BIN file (uImage) to the DDR 0x84000000 address, and then programmed into the district's own definition, the kernel linux-2.6.32.17 district is one to one, it is very important;
"Nand_boot = nboot 0x80700000 0 0x100000; bootm \ 0"; kernel on the NAND 0x100000, we use the run nand_boot board-level kernel boot;
"Tftp_boot = tftpboot 0x80700000 dm368_kernel.bin; bootm \ 0" using TFTP boot a kernel software, compiler debugging kernel;
In the run eraseenv, we use 0x00060000 as the U-BOOT parameters stored in the offset address, length of use 128K-BYTE, so start at line 183:

Ifdef CONFIG_NAND_DAVINCI

define CONFIG_ENV_SIZE (128 << 10) / * 128KiB * / / / 128K-byte for EVN

define CONFIG_ENV_IS_IN_NAND

define CONFIG_ENV_OFFSET 0x00060000

undef CONFIG_ENV_IS_IN_FLASH

endif

By the way, we generally do not recommend the U-BOOT inside and programming via TFTP to download the file system of at least tens of M, we try to simplify the U-BOOT function, because our product focus is on LINUX kernel, all development, application, the upgrade process is based on the LINUX kernel, so we recommend LINUX kernel drivers to be programmed by the file system, which is something.

4, so that I can use the tab key function
This feature is the ability to use the tab key to U-boot-> command prompt, so that
There must be defined in davinci_dm365evm.h CONFIG_AUTO_COMPLETE on line "# define CONFIG_SYS_HUSH_PARSER" or the next line;
In the u-boot-2010.12 \ common \ command.c, the first 165 lines, the "# if 0" into "# if 1";
In the u-boot-2010.12 \ common \ env_common.c, the first 247 lines of the "# if 0" into "# if 1";

5, increasing the GPIO driver functionality and modify some BUG
Reset chip peripherals, such as Ethernet port using GPIO control chip reset, the u-boot-2010.12 \ board \ davinci \ dm365evm \ dm365evm.c of board_init () function, increase GPIO reset the drive, for some peripheral chip reset bit;
In the u-boot-2010.12 \ common \ cmd_nvedit.c, the first 227 lines, the "((strcmp (name," ethaddr ") == 0)" with "(0", so you can save any modifications in the net mouth MAC address ethaddr;

6, began to compile
In the u-boot-2010.12 \ arch \ arm in the config.mk

CROSS_COMPILE? = Arm-linux-

CROSS_COMPILE = arm-none-linux-gnueabi-
We use the Code Sourcery ARM GCC Tool Chain of Sourcery G+ + Lite 2009q1-203 for ARM GNU / Linux.
Note that in addition to UBL UBL folder in internal compiler, other documents DVSDK package u-boot, linux, dm365mm, irq, edma, ceexamples, dmai, there psp_examples, etc., are compiled in dvsdk_dm368_4_02_00_06 directory , see the specific dvsdk_dm368_4_02_00_06 the Makefile.
compile u-boot is: make u-boot, make u-boot_clean etc.;
We can also produce a build_uboot.sh own command in this directory

Build u-boot in dvsdk4_02

make u-boot
chmod 777 / home/davinci/dm368/dvsdk_dm368_4_02_00_06/psp/u-boot-2010.12/u-boot.img
cp-f / home/davinci/dm368/dvsdk_dm368_4_02_00_06/psp/u-boot-2010.12/u-boot.img / tftpboot/dm368_uboot.bin
Or additional build_uboot_all.sh

Build u-boot in dvsdk4_02

make u-boot_clean
make u-boot
chmod 777 / home/davinci/dm368/dvsdk_dm368_4_02_00_06/psp/u-boot-2010.12/u-boot.img
cp-f / home/davinci/dm368/dvsdk_dm368_4_02_00_06/psp/u-boot-2010.12/u-boot.img / tftpboot/dm368_uboot.bin
Use sh file to help you work, how many get in the habit.

Basically, your mouth plate subnet OK, then you can burn through TFTP UBOOT put into it, by burning or other means emulator, we generally do not have the emulator programming, direct way of programming using uart boot, write their own uart boot thing, take a look at dvsdk_dm368_4_02_00_06 \ psp \ flash-utils bag stuff, keep it here.

Here, the entire u-boot-2010.12 transplant completed. There are deficiencies need correction of other users. I maintain two main chip platform, becomes very busy, but I will insist on writing the next one is linux-2.6.32.17 transplant,'ve written three articles about UBOOT, including S3C2440, I aim to let We develop these BOOT shorten development time, because the focus is on the development of the kernel and kernel-based applications (MII also strongly support the open source linux and related technologies), so everyone's audio and video networking products out quickly, improve people's life, and promote the social civilization, civilization is driven by science and technology to make those ugly brutality numbness wicked civilization backwards, fooling means empty distorted intelligence insulting things people exposed soon encounter tricky The problems can be exposed, after all the wisdom of the people is endless, is fully capable of solving the problem. But the premise is that we have such an academic atmosphere, they do not have the basic necessities of extremely heavy shackles, did not waste time in the vast majority of foreign language lessons and XX (look at the people of Germany, right), so we have to stick to our technical road. Civilization is relying on science and technology to promote, and science and technology we need to get down to the tens of thousands of scientists and technicians doing things.

Debugging collection yesterday with TVP5158 D1 finally see images. I was very comfortable. By the way, this time we do sun drying of two core board: DM368 and DM6446-810MHz core board. Core board to maximize customer convenience for extensions, integrated applications, speed up product development and market, reduce the risk of early product development. We tend to compare project cooperation, focusing on the development board is not developed by us.

DM368 core board
DM368 core board hardware interface description:
■ Onboard memory:

  • dynamic memory (DDR2 SDRAM): 1Gb (128M-byte)
  • non-volatile memory (NAND FLASH): 1Gb (128M-byte)
    ■ On-board interfaces:
  • 1 4 Boot Mode Select Interface
  • 16-BIT YCC digital video input interface
  • 2 programmable output clock CLOCK0 and CLOCK2
  • 1 SD analog video output interface TVOUT
  • 1 analog HD YPbPr video output interfaces
  • 1 Mic differential input interface
  • 1 channel linear output interface audio
  • 1 channel speaker differential output
  • 3-way AD acquisition interface
  • an SD card interface SD0
  • 1 a 10/100M Network differential input and output interfaces RX TX
  • 2 x RS232 serial ports (UART0, UART1)
  • a USB 2.0 interface (HOST / DEVICE / OTG)
  • 1 SPI-mouth SPI1
  • 1 standard JTAG interface
  • a 4 × 4 keyboard interface
    • 18 separate GPIO port
  • 3-way power input interface +1.8 V, + 3.3V, +1.2 V
    ■ veneer Dimensions:
    46mm x 46mm x 9.5mm
    which is 9.5mm overall height

DM6446-810MHz core board
DM6446-810MHz core board uses a TI TMD320DM6446BZWT8 dual-core chip, ARM9 the frequency of 405MHz, DSP-C64 + core frequency of 810MHz, DDR2-667 is configured as operating frequency 189MHz, NAND FLASH for the 128M-BYTE. 10M/100M network chip integrated in the core board, designed to facilitate customer base plate, 70mm * 47mm, the overall height of 9mm, smaller than a business card.
Tong Ye Technology DM6446-810MHz core board supports hardware interface:
1, VPFE16 bit bus and H, V signals, can take video capture chip and CMOS SENSOR;
2, VPBE leads to the control signal RGB24, RGB24 LCD screen for easy access;
3 , CVBS analog video output;
4, Ethernet port and Ethernet port signal LED, LINK signal;
5, I2C interfaces;
6, SPI interfaces;
7, SD card interface;
8, ATA hard disk interface;
9, USB2.0 HOST interfaces;
10 , ASP audio interface;
11,3 UART interfaces;
12,18 independent GPIO interfaces and GPIO interfaces to other multiplexing;
13, JTAG emulator interface;
14,3 a PWM control lines;
15, CLK_OUT0 and CLK_OUT1 programmable clock The output signal;
16, TI's H264 ENCODE LIB reach 720P (1280 * 720) in real time;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment