Transplanting OpenCV2.2.0 to ARM cortex-A9 Platform

移植 OpenCV 2.2.0 到 ARM Cortex-A9 平台


Keyword: OpenCV2.2.0ARMCortex-A9OMAP4430PandaBoard,cross-compile



这篇文章我也上传到了google doc ,方便大家一起参与编辑与完善。

link: https://docs.google.com/document/d/1Yk2Fv5kC1V8kZuDDpuMUqUqNaYj9MULrfGVubhyt22g/edit?pli=1



Develop environment

Host: ubuntu 10.10

OpenCV version: 2.2.0

Cross-Compiler version: 4.5.1

Target-Platform:PandaBoard (Omap 4430)

Kernel version: 2.6.35

Recently I got anproject want to use OpenCV in ARM platform . Though we got lot ofguides and manuals from Internet. But because of the board I have isomap4430 which contains dual-core Crotex-A9. I have to usehigh-version cross-compiler and high-version OpenCV source code .

I spend nearly twoweeks to finish this work. Not only the processing I record but alsothe problems I got and the solution I found in this guide . I reallyhope this guide will help you transplant smoothly. You are also verywelcomed to commit problem or advice you got to help me completethis guide.

As we know , OpenCVusing cmake to configure and generate Makefile from version2.1.0(including 2.1.0). That has a lot of different with“./configure+arguments”mode. cmake-curses-gui is a tool of cmake,which can help us configure and modify arguments with a simple GUIinstead of complex command arguments. Before transplantation we haveto prepare tools, cross-compiler and sources.

1.Install cmake

sudo apt-get install cmake


2.Install cmake-curses-gui

sudo apt-get installcmake-curses-gui

NOTE:


Problem you may encounter:cmake-curses-gui depends =2.8.0-5ubuntu1But cmake was installed depends 2.8.2-2ubuntu0.1library.

Solution: UseSynaptic package Manager remove high-version cmake youhad. Then force install cmake in version 2.8.0-5ubuntu1 . Afterthat cmake-curses-gui will install successful. Don't forget to“Apply” them.


3.DownloadCross-Compiler and Source Code we need

    1. Download and installCodesourcery 2010.12 .

DownloadURL:http://www.codesourcery.com/sgpp/lite/arm/portal/release1600 This arm-linux-gcc version is 4.5.1.


    1. Unzip and export it toyour path.


tar -xvjf./arm-2010.09-50-arm-none-linux-gnueabi-i686-pc-linux-gnu.tar.bz2

-C /opt

exportPATH=$PATH:/opt/arm-2010.12/bin


To check you haveinstalled and configure it correct.

arm-none-linux-gnueabi-g++-v


If you installed andconfigure it successful, you will see following information :


Configured with:/scratch/nathan/arm-lite/src/gcc-4.5-2010.09/configure--build=i686-pc-linux-gnu --host=i686-pc-linux-gnu--target=arm-none-linux-gnueabi --enable-threads --disable-libmudflap--disable-libssp --disable-libstdcxx-pch--enable-extra-sgxxlite-multilibs --with-arch=armv5te --with-gnu-as--with-gnu-ld --with-specs='%{save-temps: -fverbose-asm}%{funwind-tables|fno-unwind-tables|mabi=*|ffreestanding|nostdlib:;:-funwind-tables}-D__CS_SOURCERYGXX_MAJ__=2010 -D__CS_SOURCERYGXX_MIN__=9-D__CS_SOURCERYGXX_REV__=50 %{O2:%{!fno-remove-local-statics:-fremove-local-statics}}%{O*:%{O|O0|O1|O2|Os:;:%{!fno-remove-local-statics:-fremove-local-statics}}}' --enable-languages=c,c++ --enable-shared--enable-lto --enable-symvers=gnu --enable-__cxa_atexit--with-pkgversion='Sourcery G++ Lite 2010.09-50'--with-bugurl=https://support.codesourcery.com/GNUToolchain/--disable-nls --prefix=/opt/codesourcery--with-sysroot=/opt/codesourcery/arm-none-linux-gnueabi/libc--with-build-sysroot=/scratch/nathan/arm-lite/install/arm-none-linux-gnueabi/libc--with-gmp=/scratch/nathan/arm-lite/obj/host-libs-2010.09-50-arm-none-linux-gnueabi-i686-pc-linux-gnu/usr--with-mpfr=/scratch/nathan/arm-lite/obj/host-libs-2010.09-50-arm-none-linux-gnueabi-i686-pc-linux-gnu/usr--with-mpc=/scratch/nathan/arm-lite/obj/host-libs-2010.09-50-arm-none-linux-gnueabi-i686-pc-linux-gnu/usr--with-ppl=/scratch/nathan/arm-lite/obj/host-libs-2010.09-50-arm-none-linux-gnueabi-i686-pc-linux-gnu/usr--with-host-libstdcxx='-static-libgcc -Wl,-Bstatic,-lstdc++,-Bdynamic-lm'--with-cloog=/scratch/nathan/arm-lite/obj/host-libs-2010.09-50-arm-none-linux-gnueabi-i686-pc-linux-gnu/usr--with-libelf=/scratch/nathan/arm-lite/obj/host-libs-2010.09-50-arm-none-linux-gnueabi-i686-pc-linux-gnu/usr--disable-libgomp --enable-poison-system-directories--with-build-time-tools=/scratch/nathan/arm-lite/install/arm-none-linux-gnueabi/bin--with-build-time-tools=/scratch/nathan/arm-lite/install/arm-none-linux-gnueabi/bin


Thread model: posix


gcc version 4.5.1(Sourcery G++ Lite 2010.09-50)


  1. Then download and unzipOpenCV sources.

DownloadURL:http://sourceforge.net/projects/opencvlibrary/files/opencv-unix/2.2/


tar -xvjfOpenCV-2.2.0.tar.bz2 -C /YOURDIR

NOTE: you'd better choosea directory which have permission to compile.


4.Create a builddirectory to avoid mixing install files with source code.

mkdir/YOURDIR/build && cd /YOURDIR build


5.Create atoolchain.cmake file .This file is used to tell cmake how tocross-compile,and some other infromation

gedit./toolchain.cmake


6.Paste following totoolchain.cmake and save it . Last /DIR means the path you want toinstall.

set( CMAKE_SYSTEM_NAMELinux )

set(CMAKE_SYSTEM_PROCESSOR arm )

set( CMAKE_C_COMPILER arm-none-linux-gnueabi-gcc ) set(CMAKE_CXX_COMPILER arm-none-linux-gnueabi-g++)

set( CMAKE_FIND_ROOT_PATH /DIR )


NOTE: If you not sure to your PATH. I suggest using an absolute pathlike this: /opt/toolschain/4.5.1/bin

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值