Skip to content

Cross-Compilation

Once an SDK is installed (see SDK Generation), you can cross-compile software on your host machine to run on the Engicam target.


Set Up the Environment

Source the SDK environment script to configure the cross-compiler variables:

. /opt/<distro>/<version>/environment-setup-<target-arch>-<os>

Example

. /opt/fslc-framebuffer/2.3.1-icoremx6/environment-setup-armv7at2hf-neon-fslc-linux-gnueabi

Verify that CC points to the cross-compiler:

echo $CC
# arm-fslc-linux-gnueabi-gcc -march=armv7-a -mthumb -mfpu=neon -mfloat-abi=hard \
#   --sysroot=/opt/fslc-framebuffer/2.3.1-icoremx6/sysroots/armv7at2hf-neon-fslc-linux-gnueabi

Compile a C Program

Use the $CC variable to invoke the cross-compiler:

${CC} -o my_program my_program.c

The resulting binary is built for the target architecture (ARM) and can be copied to the board and executed directly.


Compile with make

For projects using a Makefile, simply source the environment and run make — the cross-compiler variables are picked up automatically:

. /opt/.../environment-setup-...
make

Transfer and Run on Target

Copy the binary to the board over SSH:

scp my_program root@<board-ip>:/home/root/

Then run it on the target:

ssh root@<board-ip> ./my_program