Reply by allsey87 August 11, 20112011-08-11
As you might of guess, I'm having some issues getting the above to
play nicer together. Before I get to the details of my problem, and
for the benefit of other who may google this post looking for help in
the future, this is my configuration / approach so far.

Building Host: Ubunutu 10.10
Target Host: ARM-Linux (ARM9)
- Processor Freescale i.MX27
- Board: APF27 from Armadeus Systems
OpenCV Version 2.3
CMake version 2.8
Video input device Omnivision OV7670 camera module using SoC driver
(source code attached) (communication over i2c bus, not USB/UVC
interface in this case). My processor provides a nice little CMOS
sensor interface which is able to efficiently get frames from the
camera and DMA the data back to RAM in clean 32-bit packages.

Files which I have marked as (attached) can be downloaded here:
http://tinyurl.com/ocv-arm-ov7670-files

PART 1 : OpenCV Build Approach

To build openCV, I have downloaded the opencv-unix version 2.3 source
code package, this replies on the cmake and pkg-config tools for a
sucessful build.

To enable cross compliation for my ARM target, I am using the
buildroot,arm-linux-g++ etc in the SDK/BSP provided by Armadeus
Systems. I have created a cmake toolchain file (attached), and have
set the environmental variable PKG-CONFIG-SYSROOT equal to the targets
base directory containing my libs, headers, /usr directory etc.

During the buildroot process I added libraries recommended by openCV,
to by targets buildroot configuration. I have also turned off PYTHON,
EIGEN, CUDA, IPP and TBB (using cmake-gui after initial configuration)
as I'm pretty sure non of these will be supported by my target
platform.

CMake seems to like my toolchain file and detects the GNU ARM
compilers as specified, the toolchain file also contains some
important cmake configuration derectives to ensure host libraries are
not linked into the openCV bulid.

I kick off the build process and everything is looking good, until I
try to link one of the example programs.

libopencv_core.so: undefined reference to `pthread_key_create'
libopencv_core.so: undefined reference to `pthread_key_once'
libopencv_core.so: undefined reference to `pthread_key_getspecific'
libopencv_core.so: undefined reference to `pthread_key_setspecific'
libopencv_core.so: undefined reference to `pthread_key_delete'

etc... one would guess that I'm having trouble linking to libpthread,
I checked, and this library is installed. I suspect the problem may be
related to my compiler flags and pkg-config... any ideas?

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

PART 2: Where is my /dev/video0?

So the way I understand the typical (non USB) way of bringing a CMOS
style sensor/camera online happens as follows.

There is two drivers that need to be loaded.

1. Host driver, grabs the RAW frames and creates the V4L interface (in
my case mx27_camera.ko)
2. Client driver, intialises the omnivision camera over the i2c
compatible SCCB bus and adds itself as a device to the host driver (in
my case ov7670_soc.ko) (both kernel modules, and more useful, the
source codes are attached).

So what are the common symptoms for this device node not appearing,
the kernel messages suggest that everything worked perfectly (I have a
message say what speed the clock is set to xx MHz, and a message
indicating that the 'OV7670 driver is sucessfully loaded and at my
service'...

But spite all this, I can't see a /dev/video0 device...

All ideas, knowledge and thoughts are welcome and appreciated :)

Thanks everyone!