Build and Run Linux Applications
With the ARTIK IDE program set up and running, you're ready to begin a development session.
You'll need to install API libraries and some software tools on your ARTIK board.
Install Software (ARTIK 5/7)
For this section, you'll be using your terminal emulator screen (ARTIK IDE console or PuTTY) to load programs on your ARTIK development board. You'll only need to perform the initial steps once, but you may want to add or update libraries later.
Here are the steps for both Ubuntu and Fedora. If you are using ARTIK 520, you will need to upgrade to the Fedora 24 image (Q6) before proceeding.
Pull up the ARTIK SDK Installation article, and follow the instructions to:
Install the debug software associated with the toolchain.
apt install gdbserver
dnf install gdb-gdbserver
Additions and Updates
At any time, you can install specific ARTIK SDK libraries you decide to use. For example, for the Sensor Demo, you will need:
apt install libartik-sdk-sensor
apt install libartik-sdk-systemio
dnf install libartik-sdk-sensor
dnf install libartik-sdk-systemio
If anything is missing, you should get a build error message that will tell you what package to add.
You can also upgrade to the latest SDK files.
Building Linux Applications
Select File » New » C Project to create a new project.
Specify the Project Name. Select the correct Project Type for your module and OS. Click Next.
Select from any example projects listed, or select Empty ARTIK Project for a blank one. Choose Sensor if you want to build the demo program for the ARTIK Sensor Board attachment.
Click Finish to create the application. If you selected one of the example projects, then the application project will include the source file of the example.
Certain applications are module-specific. For example, the Sensor application targets ARTIK 710/530 modules with the plug-on Sensor Board option. The application would need to be modified to target similar components attached to an ARTIK 520 board.
To build the application, right-click on the application project and select Build Project. This will cross-compile the application to be run on ARTIK modules.
Any build errors (usually due to coding mistakes or missing libraries) will be indicated in the build console window.
Running Linux Applications
You'll need serial communication to the board. Use your ARTIK IDE console or PuTTY as always. Reset the ARTIK board and log in through the console.
Step 1. Use the same network
Connect devices to Wi-Fi through the same router
You'll need a connection to either Wi-Fi or Ethernet. Our instructions use Wi-Fi, since the IoT applications you develop will likely need it for testing. The ARTIK module must be on the same Wi-Fi network as your Windows PC host system for them to communicate.
Follow this Wi-Fi article checklist for putting both your ARTIK board and your development PC on the same Wi-Fi network. While you're there, make a note of the IP address – you'll need it shortly.
The ARTIK IDE communicates with the ARTIK board via Wi-Fi or Ethernet to load, run, or debug the Linux application, so make sure your Wi-Fi connections are valid (e.g. that Windows has not switched unexpectedly to a different Wi-Fi access point).
Step 2. Set up a "run configuration"
Set up a "run configuration" to target the ARTIK board
The ARTIK IDE runs programs on the ARTIK board by exchanging commands and data with the board over either Wi-Fi or Ethernet. This is considered Remote Application operation. You need to set up a remote "run configuration" for each board.
Click Run, then Run Configurations…
Add a C/C++ Remote Application and configure it as follows.
Click on "C/C++ Remote Application" and click the New button (upper left icon) to create a new remote connection; enter information like that shown.
On the "Connection:" line, select New, then select SSH as the connection type. Configure the SSH connection by adding a name, the ARTIK board IP address you retrieved earlier, and username/password (root/root by default).
Apply the new settings.
A "run configuration" has to be specified once for each project and board. Thereafter, you'll be able to just select the configuration you created.
Step 3. Run the application from the IDE
By selecting Run, you are telling the IDE to
- build the project and create a binary image
- transfer the image to your ARTIK board over SSH as set up in Step 2.
If needed, select Run » Run Configurations… to select the target board for the project (under "Connections:").
Right-click on the application project and select Run As » ARTIK 5/7/10 Program
Observe the output of the application program in the build console window.
|"Launching…" message in the lower right corner of the console for several seconds, and then an "Error during file upload" message box||Wi-Fi connection is not working – make sure you started it after reset (
|"-bash: < package_name >: command not found" message||Missing SDK package – install it as noted here|
Run the application on your ARTIK board
Once the image has been transferred by the IDE, you can run it directly on the board. For example, typing
in the terminal emulator window would execute the named application from the current directory. The IDE automatically sets the file mode to 'executable' upon transfer.
Debug the application from the IDE
After some quick configuration, you'll be able to call on the installed debugger tools to access the
gdbserver debug tool installed on your ARTIK board from your PC.
Step 1. Configure the debug tool
Set up the debug tool configuration
To debug your application using a hardware debugger tool, you'll need to tell the IDE the tool name and also where to find its remote mate (the
gdbserver tool, which you installed here).
Click Run, then Debug Configurations.
Add a C/C++ Remote Application and configure it as follows.
- Click on "C/C++ Remote Application" and click the New button (upper left corner) to create a new remote connection.
Select the same SSH connection you set up above.
- Click on the Debugger tab. <
Verify that the correct tool name has auto-populated where indicated.
64-bit (A7): aarch64-linux-gnu-gdb
32-bit (A5): arm-linux-gnueabihf-gdb
- Apply the new settings.
You've completed the setup procedure. You should not have to revisit these settings unless you change the Wi-Fi network.
Setting up the communication between the IDE and the board requires steps like a "run configuration" but is a separate procedure for the debugger tool.
Step 2. Debug the application from the IDE
Right-click on the application project and select Debug As » ARTIK 5/7/10 Program.
Doing so launches the debug session and opens the Debug Perspective. The application is stopped in the main function so that you can set breakpoints, step, continue, stop, observe variables and perform other debug operations.
|"-bash: gdbserver: command not found" message||Missing debug server package – install it as noted here|