12/08/2016

DM814x SDK 설치 및 관련 설정

1. EZSDK 설치

수정중
Memory Map 과 구조도 및 Firmware 이해 필요,
Linux File system 부분 수정 부분

1.1 GCC Tool Chain and SDK Download 

  • arm-2009q1-203-arm-none-linux-gnueabi.bin (Code Sourcery ARM GCC Tool Chain)
  • ezsdk_dm814x-evm_5_05_02_00_setuplinux
  http://www.ti.com/tool/linuxezsdk-davinci

1.2 개발환경구성 

  • 환경변수 재설정
아래의 환경변수는 CROSS_COMPILE과 INSTALL_MOD_PATH 등 Makefile과 Rule.make를
보고 필요한부분을 넣었다.
기본정의 Rule.make에 정의가 되어있으면 동작이 제대로 되어야겠지만,
본인이 원하는 대로 동작이 안된다면, 두 파일을 비교하여 오동작되는 부분을 파악해서
환경변수 고치던지 하는것이 편할 것이다.
나는 source 를 이용하여 아래와 같이 그냥 외부에서 설정을 해놓았다.  

$ vi setPATH.sh
#!/bin/sh
# source setPATH.sh
# INSTALL_MOD_PATH : Kernel Module 
# SYSLINK_INSTALL_DIR : syslink.ko 

export PATH=$PATH:/home/jhlee/dm8148/CodeSourcery/Sourcery_G++_Lite/bin
export EZSDK="${HOME}/dm8148/ti-ezsdk_dm814x-evm_xx_xx_xx_xx" 
export CROSS_COMPILE=arm-none-linux-gnueabi-
export ARCH=arm

export INSTALL_MOD_PATH="${HOME}/dm8148/targetfs"     // Kernel module    

$ source setPATH.sh 

  • 개발환경구성설정 (TI에서 제공)
  1. NFS Server 환경구성 
  2. TFTP 설정 
$ cd ~/dm8148/ti-ezsdk_dm814x-evm_5_05_02_00 
$./setup.sh              // 자동으로 설정 NFS/TFTP 



1.3 EZSDK 설치시 구조 및 빌드방법



  • EZSDK 설치시 구조

$ cd ~/dm8148/ti-ezsdk_dm814x-evm_5_05_02_00 
$ tree -d -L 2 
.
├── bin
├── board-support
│   ├── docs
│   ├── external-linux-kernel-modules
│   ├── host-tools
│   ├── linux-2.6.37-psp04.04.00.01
│   ├── media-controller-utils_3_00_00_05
│   ├── prebuilt-images
│   └── u-boot-2010.06-psp04.04.00.01
├── component-sources
│   ├── bios_6_33_05_46
│   ├── c674x-aaclcdec_01_41_00_00_elf
│   ├── codec_engine_3_22_01_06
│   ├── edma3lld_02_11_05_02
│   ├── framework_components_3_22_01_07
│   ├── graphics-sdk_4.04.00.02
│   ├── gst-openmax_GST_DM81XX_00_07_00_00
│   ├── ipc_1_24_03_32
│   ├── linuxutils_3_22_00_02
│   ├── omx_05_02_00_48
│   ├── osal_1_22_01_09
│   ├── rpe_1_00_01_13
│   ├── slog_04_00_00_02
│   ├── syslink_2_20_02_20
│   ├── uia_1_01_01_14
│   ├── xdais_7_22_00_03
│   └── xdctools_3_23_03_53
├── docs
│   └── licenses
├── dsp-devkit
│   ├── cgt6x_7_3_4
│   ├── docs
│   └── packages
├── etc
├── example-applications
│   ├── am-benchmarks-1.1
│   ├── am-sysinfo-1.0
│   ├── linux-driver-examples-psp04.04.00.01
│   ├── matrix-gui-e-1.3
│   └── omtb_01_00_01_07
├── filesystem
├── linux-devkit
│   ├── arm-none-linux-gnueabi
│   ├── bin
│   ├── etc
│   ├── include
│   ├── lib
│   ├── mkspecs
│   ├── share
│   └── usr
└── usr
    ├── lib
    └── share


$ vi Rules.make  // 아래와 같이 수정 
....
#EXEC_DIR=/home/jhlee/dm8148/targetfs/home/root/dm814x-evm   // 기본으로 이것으로 설정하며, 진행한다. 
EXEC_DIR=/home/jhlee/dm8148/targetfs                         // 필요한 것이 있다면 그 때만 이것으로 설정 
                     // 위와 같이 진행하지 않으면 Filesystem이 필요없는것을 다 포함하게되어서 커진다. 

//예를들어 아래와 같이 진행하면, EXEC_DIR/usr/lib/....   설치되므로 필요할때만 위와 같이 변경 
$ make syslink
$ make syslink_install  

//전체 명령어 확인 및 Install 될 주소 확인                                                                
$ make help

Available build targets are  :

    components_linux               : Build the Linux components
    components_dsp                 : Build the DSP components
    components                     : Build the components for which a rebuild is necessary to enable all other build targets listed below. You must do this at least once upon installation prior to attempting the other targets.
    components_clean               : Remove files generated by the 'components' target

    apps                           : Build all Examples, Demos and Applications
    apps_clean                     : Remove all files generated by 'apps' target
    install                        : Install all Examples, Demos and Applications the targets in /home/jhlee/dm8148/targetfs/home/root/dm814x-evm

    linux-devkit                   : Populate the linux devkit
    dsp-devkit                     : Populate the dsp devkit

    cmem                           : Build the CMEM kernel module
    cmem_clean                     : Remove generated cmem files.
    cmem_install                   : Install cmemk module

    syslink                        : Configure and build SYS Link for HLOS and HLOS without sample examples
    syslink_clean                  : Remove generated SysLink files
    syslink_install                : Install HLOS and RTOS link files

    linux                          : Build Linux kernel uImage and module
    linux_clean                    : Remove generated Linux kernel files
    linux_install                  : Install kernel binary and  modules

    u-boot                         : Build the u-boot boot loader
    u-boot_clean                   : Remove generated u-boot files
    u-boot_install                 : Install the u-boot image

    psp-examples                   : Build the driver examples
    psp-examples_clean             : Remove generated driver example files
    psp-examples_install           : Install the psp examples

    osal                           : Build the OSAL
    osal_clean                     : Remove generated OSAL files

    matrix                         : Build matrix application launcher
    matrix_clean                   : Remove all matrix files
    matrix_install                 : Install matrix

    omx                            : Build OMX and OMX IL Clients
    omx_clean                      : Remove OMX generated files
    omx_install                    : Install OMX IL Clients

    omtb                           : Build OMTB IL Clients
    omtb_clean                     : Remove OMTB generated files
    omtb_install                   : Install OMTB IL Clients

    media-controller-utils         : Build media controller utils
    media-controller-utils_clean   : Remove media controller utils generated files
    media-controller-utils_install : Install media controller utils

    edma3lld                       : Build the EDMA3LLD Libraries
    edma3lld_clean                 : Remove generated EDMA3LLD files

    sgx-driver                     : Build SGX kernel module
    sgx-driver_clean               : Remove SGX generated files
    sgx-driver_install             : Install SGX kernel module

    gstomx                         : Build TI GST OpenMax Plugin
    gstomx_clean                   : Remove TI GST OpenMax generated files
    gstomx_install                 : Install TI GST OpenMax Plugin

    rpe                            : Build Remote Processor Execute
    rpe_clean                      : Remove Remote Processor Execute generated files
    rpe_install                    : Install Remote Processor Execute

    all                            : Rebuild everything
    clean                          : Remove all generated files

    install                        : Install all the targets in 
                            /home/jhlee/dm8148/targetfs/home/root/dm814x-evm // 중요: EXEC_DIR 수정 후 변경됨 


  • TI에서 제공하는 User Manual
  http://processors.wiki.ti.com/index.php/Category:EZSDK

  http://developer.ridgerun.com/wiki/index.php/Getting_Started_Guide_for_DM8148_EVM

  http://processors.wiki.ti.com/index.php/DM814x_AM387x_PSP_User_Guide

  http://processors.wiki.ti.com/index.php/DM814x_AM387x_PSP_User_Guide#Linux_Kernel

1.4 Video TEST

  • MPEG4 HDMI Decoding TEST 
$ gst-launch filesrc location= test1.mp4 ! qtdemux name=mux mux.video_00 ! queue  ! h264parse output-format=1 ! omx_h264dec ! omx_scaler ! omx_ctrl display-mode=OMX_DC_MODE_1080P_30 ! omx_videosink enable-last-buffer=false

  • IP Camera TEST
$ gst-launch -v rtspsrc location=rtsp://192.168.1.168:8556/PSIA/Streaming/channels/2?videoCodecType=H.264 caps="video/x-h264,mapping=/video " ! rtph264depay ! queue ! h264parse ! omx_h264dec ! omx_mdeiscaler name=d d.src_00 ! omx_ctrl display-mode=OMX_DC_MODE_1080P_30 ! omx_videosink enable-last-buffer=false 

$ gst-launch rtspsrc location=rtsp://192.168.1.168:8556/PSIA/Streaming/channels/2?videoCodecType=H.264 ! rtph264depay ! queue ! \
h264parse output-format=1 ! omx_h264dec ! omx_scaler ! omx_ctrl display-mode=OMX_DC_MODE_1080P_30 ! omx_videosink enable-last-buffer=false
  • IP Camera TEST (1080P Resize)
$ gst-launch rtspsrc location=rtsp://192.168.1.168:8556/PSIA/Streaming/channels/2?videoCodecType=H.264  ! rtph264depay ! queue ! h264parse access-unit=true ! queue ! omx_h264dec ! omx_mdeiscaler name=d d.src_00 ! 'video/x-raw-yuv, width=(int)1920, height=(int)1080' ! queue ! omx_ctrl \
display-mode=OMX_DC_MODE_1080P_30 ! gstperf print-fps=true print-arm-load=true ! omx_videosink sync=false enable-last-buffer=false

  • Gstreamer Examples
  https://developer.ridgerun.com/wiki/index.php/Gstreamer_pipelines_for_DM816x_and_DM814x
  https://developer.ridgerun.com/wiki/index.php/Gstreamer_pipelines_for_DM816x_and_DM814x#RTSP_-_Video_H264_1080.4030fps_2

  • DM8168 Firmware Debug
  https://developer.ridgerun.com/wiki/index.php?title=How_to_build_DM8168_M3_Firmware_and_debug_messages

3. KERNEL Config & Build 

위의 CROSS_COMPILE과 ARCH 환경변수가 설정이 되지 않을 경우 매번 설정하면서 실행.
미리 설정된 File은 아래 존재하며 이곳에서 보자.

$ cd ~/dm8148/
$ source setPATH.sh 
$ cd ti-ezsdk_dm814x-evm_5_05_02_00/board-support/linux-2.6.37-psp04.04.00.01
$ ls ./arch/arm/configs/       // 지원되는 Configs 확인    


$ make ti8148_evm_defconfig   // Kernel Config 설정 
$ make menuconfig             // 상위 setPATH.sh를 설정을 안했다면, ARCH=arm 선언하자.
$ make uImage                 // 상위 setPATH.sh를 설정을 안했다면  setARCH=arm 와 CROSS_COMPILE=arm-none-linux-gnueabi- 

$ cp /arch/arm/boot/uImage  /tftpboot/uImage

3.1 Kernel 분석 및 수정 

  • CTAGS와 CSCOPE 생성
vi 에서 소스분석을 더 용이하게 하기 위해서 아래와 같이 설치 및 사용하자.
  http://ahyuo.blogspot.kr/search?q=sudo+apt-get+install+ctags

  http://processors.wiki.ti.com/index.php/TI81xx_PSP_Porting_Guide


$ vi ./arch/arm/mach-omap2/board-ti8148evm.c
....
MACHINE_START(TI8148EVM, "ti8148evm")
        /* Maintainer: Texas Instruments */
        .boot_params    = 0x80000100,
        .map_io         = ti8148_evm_map_io,    // 변경된 device memory map check 
        .reserve         = ti81xx_reserve,
        .init_irq       = ti8148_evm_init_irq,   // 점검 
        .init_machine   = ti8148_evm_init,       // 변경된 device check , EVM과 현재보드와 사용하는 Device가 다름 (HDMI 변경 및 기타 IO및 사용안함)
        .timer          = &omap_timer,       
MACHINE_END


$ make uImage
  CHK     include/linux/version.h
  CHK     include/generated/utsrelease.h
make[1]: `include/generated/mach-types.h'는 이미 갱신되었습니다.
  CALL    scripts/checksyscalls.sh
  CHK     include/generated/compile.h
  LD      vmlinux.o

drivers/built-in.o: In function `pcf8575_ths7375_enable':
notify_shm_drv.c:(.text+0x15f14): multiple definition of `pcf8575_ths7375_enable'
arch/arm/mach-omap2/built-in.o:gpmc-nand.c:(.text+0x9ce8): first defined here
drivers/built-in.o: In function `vps_ti816x_set_tvp7002_filter':
notify_shm_drv.c:(.text+0x15f8c): multiple definition of `vps_ti816x_set_tvp7002_filter'
arch/arm/mach-omap2/built-in.o:gpmc-nand.c:(.text+0x9d60): first defined here
drivers/built-in.o: In function `vps_ti816x_select_video_decoder':
notify_shm_drv.c:(.text+0x15f78): multiple definition of `vps_ti816x_select_video_decoder'
arch/arm/mach-omap2/built-in.o:gpmc-nand.c:(.text+0x9d4c): first defined here
drivers/built-in.o: In function `ti816x_pcf8575_init':
notify_shm_drv.c:(.text+0x15f50): multiple definition of `ti816x_pcf8575_init'
arch/arm/mach-omap2/built-in.o:gpmc-nand.c:(.text+0x9d24): first defined here
drivers/built-in.o: In function `pcf8575_ths7360_sd_enable':
notify_shm_drv.c:(.text+0x15f28): multiple definition of `pcf8575_ths7360_sd_enable'
arch/arm/mach-omap2/built-in.o:gpmc-nand.c:(.text+0x9cfc): first defined here
drivers/built-in.o: In function `pcf8575_ths7360_hd_enable':
notify_shm_drv.c:(.text+0x15f3c): multiple definition of `pcf8575_ths7360_hd_enable'
arch/arm/mach-omap2/built-in.o:gpmc-nand.c:(.text+0x9d10): first defined here
drivers/built-in.o: In function `ti816x_pcf8575_exit':
notify_shm_drv.c:(.text+0x15f64): multiple definition of `ti816x_pcf8575_exit'
arch/arm/mach-omap2/built-in.o:gpmc-nand.c:(.text+0x9d38): first defined here
make: *** [vmlinux.o] 오류 1

$ arm-none-linux-gnueabi-readelf -s arch/arm/mach-omap2/built-in.o | grep -r pcf8575_ths7375_enable
  2521: 00009ce8    20 FUNC    GLOBAL DEFAULT    1 pcf8575_ths7375_enable

$ arm-none-linux-gnueabi-readelf -s drivers/built-in.o | grep -r pcf8575_ths7375_enable
 21182: 00015f14    20 FUNC    GLOBAL DEFAULT    1 pcf8575_ths7375_enable

$ find . -name '*.o' | sed -e 's/o$/c/g' | xargs grep -rs pcf8575_ths7375_enable
./drivers/video/ti81xx/vpss/dctrl.c:  r = pcf8575_ths7375_enable(TI816X_THSFILTER_ENABLE_MODULE);

$ grep -r pcf8575_ths7375_enable .
이진파일 ./drivers/built-in.o 와(과) 일치
이진파일 ./drivers/video/built-in.o 와(과) 일치
이진파일 ./drivers/video/ti81xx/built-in.o 와(과) 일치
./drivers/video/ti81xx/vpss/dctrl.c:  r = pcf8575_ths7375_enable(TI816X_THSFILTER_ENABLE_MODULE);
이진파일 ./drivers/video/ti81xx/vpss/dctrl.o 와(과) 일치
이진파일 ./drivers/video/ti81xx/vpss/built-in.o 와(과) 일치
이진파일 ./drivers/video/ti81xx/vpss/vpss.o 와(과) 일치
./tags:pcf8575_ths7375_enable arch/arm/mach-omap2/board-ti8168evm.c /^EXPORT_SYMBOL(pcf8575_ths7375_enable);$/;" v
./tags:pcf8575_ths7375_enable arch/arm/mach-omap2/board-ti8168evm.c /^int pcf8575_ths7375_enable(enum ti816x_ths_filter_ctrl ctrl)$/;" f
./tags:pcf8575_ths7375_enable arch/arm/mach-omap2/include/mach/board-ti816x.h /^int pcf8575_ths7375_enable(enum ti816x_ths_filter_ctrl ctrl)$/;" f
./arch/arm/mach-omap2/include/mach/board-ti816x.h:int pcf8575_ths7375_enable(enum ti816x_ths_filter_ctrl ctrl);
./arch/arm/mach-omap2/include/mach/board-ti816x.h:int pcf8575_ths7375_enable(enum ti816x_ths_filter_ctrl ctrl)
이진파일 ./arch/arm/mach-omap2/built-in.o 와(과) 일치
./arch/arm/mach-omap2/board-ti8168evm.c:int pcf8575_ths7375_enable(enum ti816x_ths_filter_ctrl ctrl)
./arch/arm/mach-omap2/board-ti8168evm.c:EXPORT_SYMBOL(pcf8575_ths7375_enable);
이진파일 ./arch/arm/mach-omap2/ti81xx_vpss.o 와(과) 일치


$ make menuconfig   // 필요 module을 yes로 변경 및 필요 없은 것들을 제거. 

$ make uImage
  CHK     include/linux/version.h
  CHK     include/generated/utsrelease.h
make[1]: `include/generated/mach-types.h'는 이미 갱신되었습니다.
  CALL    scripts/checksyscalls.sh
  CHK     include/generated/compile.h
  LD      drivers/built-in.o
drivers/media/built-in.o: In function `vps_ti816x_set_tvp7002_filter':        // 이곳에서 에러가 나서 현재 complier가 혼동하는 것 같음 
ti81xxvin_lib.c:(.text+0x30eac): multiple definition of `vps_ti816x_set_tvp7002_filter'
drivers/video/built-in.o:sii9022a_drv.c:(.text+0x72d0): first defined here
drivers/media/built-in.o: In function `pcf8575_ths7375_enable':
ti81xxvin_lib.c:(.text+0x30e34): multiple definition of `pcf8575_ths7375_enable'
drivers/video/built-in.o:sii9022a_drv.c:(.text+0x7258): first defined here
drivers/media/built-in.o: In function `ti816x_pcf8575_init':
ti81xxvin_lib.c:(.text+0x30e70): multiple definition of `ti816x_pcf8575_init'
drivers/video/built-in.o:sii9022a_drv.c:(.text+0x7294): first defined here
drivers/media/built-in.o: In function `ti816x_pcf8575_exit':
ti81xxvin_lib.c:(.text+0x30e84): multiple definition of `ti816x_pcf8575_exit'
drivers/video/built-in.o:sii9022a_drv.c:(.text+0x72a8): first defined here
drivers/media/built-in.o: In function `pcf8575_ths7360_sd_enable':
ti81xxvin_lib.c:(.text+0x30e48): multiple definition of `pcf8575_ths7360_sd_enable'
drivers/video/built-in.o:sii9022a_drv.c:(.text+0x726c): first defined here
drivers/media/built-in.o: In function `vps_ti816x_select_video_decoder':
ti81xxvin_lib.c:(.text+0x30e98): multiple definition of `vps_ti816x_select_video_decoder'
drivers/video/built-in.o:sii9022a_drv.c:(.text+0x72bc): first defined here
drivers/media/built-in.o: In function `pcf8575_ths7360_hd_enable':
ti81xxvin_lib.c:(.text+0x30e5c): multiple definition of `pcf8575_ths7360_hd_enable'
drivers/video/built-in.o:sii9022a_drv.c:(.text+0x7280): first defined here
make[1]: *** [drivers/built-in.o] 오류 1
make: *** [drivers] 오류 2

$ vi drivers/media/.built-in.o.cmd  // compile되어 만들어지는 build-in.o를 다시 분석  (video 가 dm8168로 인식)

$ find . -name plat   //             plat/cpu.h 찾아 설정이 제대로 있는지 확인 
./drivers/dsp/syslink/omap_notify/plat
./arch/arm/plat-pxa/include/plat
./arch/arm/plat-s5p/include/plat
./arch/arm/plat-versatile/include/plat
./arch/arm/plat-samsung/include/plat
./arch/arm/plat-omap/include/plat
./arch/arm/plat-nomadik/include/plat
./arch/arm/plat-spear/include/plat
./arch/arm/plat-s3c24xx/include/plat
./arch/arm/plat-orion/include/plat


$ vi ./arch/arm/mach-omap2/ti81xx_vpss.c 

$ vi ./arch/arm/mach-omap2/devices.c

$ vi arch/arm/mach-omap2/board-flash.c

  • 문제점 분석 및 해결
아래와 같이 빌드된 된 source만 찾아 grep으로 이를 검색

$ find . -name '*.o' | sed -e 's/o$/c/g' | xargs grep -rs omap_mux_init

  http://ahyuo.blogspot.kr/search?q=xargs

상위문제 Linux Kernel 사용이 되는 필요없는 Config를 제거하여 문제해결

현재 나의 Board가 EVM이 아니기 때문에 Kernel config를 점검해가면서 수정해서
필요 없는 부분을 제거하고 변경하고 TEST 하자.

3.2 NAND 변경시 관련설정

Device Drivers -> Memory Technology Devices

  http://processors.wiki.ti.com/index.php/Flash_configuration_in_the_Kernel#Enabling_NAND_Support

  http://e2e.ti.com/support/dsp/davinci_digital_media_processors/f/716/p/177166/641847#641847

댓글 없음 :