Using HALCON on Arm-based platformsđź”—
The main difference in developing applications on HALCON for Arm®-based platforms compared to other standard platforms is that you usually do not do this on the Arm-based platform itself, but on a separate (Linux) development computer, using a cross-compiler toolchain to generate the executable. You then upload the executable to the Arm-based platform and run it there.
HALCON development tools like HDevelop are not available for Arm-based platforms, so you need two installations of HALCON:
-
On the development computer: development version of HALCON
-
On the Arm-based platform: runtime installation of HALCON
If you have a native toolchain for your Arm-based platform, you can use it directly with HALCON. But also in this case, you need to own a HALCON development license, and the HALCON development tools are not available on your Arm-based platform.
Example programs specific to the Arm-based platform can be found in examples/arm-linux.
Other example programs can only be compiled if the corresponding makefiles or CMakeLists.txt files are adjusted.
In the following we will assume you are using a cross compiler toolchain from an Intel Linux platform as this is the most common way at the time of writing. Further, we assume that you already know how to access the Arm-based platform from your development computer. If requried, see the corresponding documentation from the platform’s vendor for details.
Installing the componentsđź”—
Installing the components on the development computerđź”—
On your development computer, use the MVTec Software Manager (SOM) to install the following components for your HALCON version:
- Development version of HALCON
- Package “Cross Compilation for Arm-based Platforms”, containing the HALCON libraries compiled for aarch64-linux
- Valid HALCON development license
When using a HALCON dongle as host ID, additionally install the package “Hardware support for license dongle”. - Compiler (cross compiler) for aarch64-linux
For information about compiler compatibility, see Supported platforms and minimum system requirements.
After installation, the following directories contain content specific for HALCON on Arm-based platforms:
lib/aarch64-linux- HALCON libraries for platforms based on AArch64
examples/arm-linux- examples for HALCON for Arm-based platforms
Installing the components on the Arm-based platformđź”—
The installation for Arm-based platforms is also provided by SOM. For more information, see Installing and configuring HALCON and the SOM documentation.
As with other platforms, set the following environment variables for HALCON to work:
HALCONROOT=<HALCON installation directory, default: /opt/halcon>HALCONARCH=aarch64-linuxLD_LIBRARY_PATH=$LD_LIBRARY_PATH:${HALCONROOT}/lib/${HALCONARCH}PATHshould include$HALCONROOT/bin/$HALCONARCH
How to use an Evaluation License on an Arm-based platformđź”—
More Info
For information about general licensing topics, see Licensing and its subsection Licensing on Arm-based platforms.
The Standard Evaluation License is not supported on Arm-based platforms. Instead, you need an Embedded Evaluation License.
The platform has to meet the following requirements:
- Supports the installation of at least CodeMeter Runtime Lite.
You can either install the package “CodeMeter Runtime” via SOM or download it separately from wibu.com . - Has a local web browser installed for ticket activation
- Must be connected to the internet during license activation
- Must be connected to the internet every 5 to 7 days, while HALCON Embedded evaluation is running, to synchronize with the real-world time
To use an Embedded Evaluation License on an Arm-based platform:
- Contact your local sales partner for a HALCON Embedded evaluation license for Arm-based platforms.\
⤷ You receive an evaluation license file together with an activation code.
- Copy the license file into the license folder of your HALCON installation or use the license file upload functionality of SOM.
-
To activate the received license:
- Open a local web browser on your Arm-based Platform platform.
- Visit the MVTec License WebDepot page .
- Enter your activation code in the Ticket field.
Compiling applications for Arm-based platformsđź”—
How to cross-compile applicationsđź”—
The following section describes the necessary steps to compile an example on a development computer to be run on Arm-based platforms (“cross compilation”). Here, we use the datacode example, for which the exported C and C++ code is also included in the example directory.
We assume that HALCON is installed on your development computer running a Debian or Ubuntu distribution and that the aarch64-linux libraries have been installed.
On the development computer, do the following:
- Enure you have the cross-compilation toolchain installed. If this is not the case, install it via the package manager:
- Change to the HALCON installation directory.
- Set the HALCON environment variables, e.g., by typing
- Specify the HALCON target architecture (that is, your Arm-based platform).
Do one of the following:
- Re-set
HALCONARCHto the one of your Arm-based platform by typing - Provide
HALCONARCHas the argumentHALCON_ARCHITECTUREto CMake.
- Re-set
- Change to the application directory, in this case
$HALCONROOT/examples/arm-linux. - Create a new build directory for your compiled example and change to it:
sh mkdir build cd build - Specify a toolchain to CMake.
For the HALCON architecture aarch64-linux, you can find example toolchain files in
$HALCONEXAMPLES/cmake/toolchains/. - Compile the application by typing:
- Copy the compiled files to your Arm-based platform. The files are located in
./bin/aarch64-linux. - As the datacode example uses images, the image sequence file
$HALCONROOT/examples/images/datacode/ecc200/ecc200_cpu.seqand all images referenced by it must be readable from the Arm-based platform. The easiest way is to copy the directory$HALCONROOT/examples/images/datacode/ecc200to your Arm-based platform.
On the Arm-based platform, do the following:
- Change to the runtime installation directory.
- If not done already, set the HALCON environment variables
HALCONROOT,LD_LIBRARY_PATH, and, if images are used,HALCONIMAGES. - Execute the program that you have copied from the development computer, for example,
datacode_cpp.
How to compile applications on a native machineđź”—
The following section describes the necessary steps to compile an example using the compiler of your Arm-based platform. Again, we use the datacode example, for which the exported C and C++ code is also included in the example directory.
To install HALCON on your Arm-based platform for native compilation:
-
Use SOM to install HALCON on your Arm-based platform. Select at least the components “Runtime files and Runtime files (general)”.
-
As such an installation does not contain header files, CMake scripts, and example source code, they have to be copied from a full HALCON installation. On the development computer, do the following:
- Create an archive of the required directories:
2. Copy this archive to your Arm-based platform.
- On the Arm-based platform, extract the archive in your HALCON installation:
Now, the Arm-based platform is set up and we can compile the code. On the Arm-based platform, do the following:
- Change to the directory
$HALCONROOT/examples/arm-linux. - Set a required environment variable:
- Create a new build directory for your compiled example and change to it:
-
Compile the application by typing:
Note
- For native compilation, it is not necessary to provide CMake arguments for the HALCON architecture and the toolchain.
- To ensure that
makedoes not attempt to run HDevelop, the date of the filesdatacode.canddatacode_cpp.cppmust be newer than the corresponding HDevelop filedatacode.hdev.
To execute the program, set the environment variable HALCONIMAGES appropriately, and then run datacode_cpp, for example.
Tip
You can also use hrun to run the example.