Developing a large-scale program on an Edge device can take a considerable amount of time. To avoid this, in this document, we introduce a method for cross compiling C/C++ for a device on which Ubuntu is installed.
This enables you to develop a program using the Windows Subsystem for Linux (WSL) and deploy the program on Edge devices.
Supported device (OS)
e-RT3 Plus F3RP70-2L (Ubuntu 18.04 32-bit): An Edge controller from Yokogawa.
armhf architecture package runs on this device.
Windows 10 64-bit version 1909
Visual Studio Professional 2019 version 16.9.6
Before you start building a cross-compile platform, you must install the
libc6 package on e-RT3 Plus.
Run the following commands to install the package:
sudo apt update sudo apt install libc6-dbg
- Install WSL by following the steps described in the Microsoft official procedure.
- Download Ubuntu 18.04 LTS from Microsoft Store.
- Start WSL and login.
Run the following commands to install the required packages.
sudo apt update # Install the build environment for armhf sudo apt install crossbuild-essential-armhf # Install other required packages sudo apt install make rsync zip
You can verify that the installation is successful by running the following commands.
$ arm-linux-gnueabihf-gcc --version arm-linux-gnueabihf-gcc (Ubuntu/Linaro 7.5.0-3ubuntu1~18.04) 7.5.0 Copyright (C) 2017 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. $ arm-linux-gnueabihf-g++ --version arm-linux-gnueabihf-g++ (Ubuntu/Linaro 7.5.0-3ubuntu1~18.04) 7.5.0 Copyright (C) 2017 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Note: If the computer is in an environment that requires proxies to connect to the internet, you must configure the proxy settings.
The steps to install Visual Studio are described in the previous article.
Note: You need not download IntelliSense to execute the steps that are described in this article.
Creating and debugging a project involves the following steps:
Follow these steps to create a project:
Start Visual Studio and create a new project.
Specify the project type as C++ and Linux, select Console Application, and create a project by specifying the project name.
From the menu bar, click Project > Properties.
For more information about configuring the project settings for a Linux WSL subsystem, refer to the official documentation.
From the Configuration drop-down list, select Debug.
From the Platform drop-down list, select x64.
On the left pane, select General.
On the right pane, under the Platform Toolset section, from the Platform Toolset drop-down list, select GCC for Windows Subsystem for Linux.
On the left pane, click Debugging.
From the Remote Debug Machine drop-down list, select the added device.
On the left pane, select C/C++.
On the right pane, under the General section, in the C Compiler and C++ Compiler boxes, type
On the left pane, select Linker.
On the right pane, under the General section, in the Linker box, type
The project settings are configured.
Follow these steps to build and debug the project:
From the Debug drop-down list, select x64.
Place a break point anywhere in the source code.
Build and run the program.
If the program stops at the break point, it indicates that the project is created successfully.
WSL files are saved in the current Linux directory. To navigate to the directory, type
\\wsl$ in the address bar of Windows Explorer.
You can build only the project without debugging it.
The output file is saved in the following location:
<Solution directory>\<Project directory>\bin\<Platform>\<Configuration>\
When you build a program using device-specific libraries, you must include the library and header files in the project.
libfolders in the project directory to store the header and library files respectively.
Open the project properties in Visual Studio.
On the left pane, select C/C++ > General.
On the right pane, in the Additional Include Directories box, specify the
On the left pane, select Linker > General.
In the Additional Library Directories box, specify the
In the Library Dependent File, specify the name of the library. For example, in case of