Filter results by

Build and Run Linux Applications

With the ARTIK IDE program set up and running, you're ready to begin a development session.

Installing Software

You'll need to install API libraries and some software tools on your ARTIK board. You only need to do this once.

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.

If you are using ARTIK 520, you will need to upgrade to the Fedora 24 image (Q6) before proceeding.

  1. Pull up the ARTIK SDK Installation article, and follow the instructions to:

    1. Set up dnf access to the ARTIK repository and its up-to-date packages

    2. Make sure you enter the last command as indicated:
         dnf makecache --refresh

    3. Install the ARTIK SDK (only if you are using an older build without it).

  2. Update to the latest SDK files by entering
       dnf update

  3. Install the debug software associated with the toolchain.
    dnf install gdb-gdbserver

  4. Install the ARTIK SDK libraries you intend to use. For example, for the Sensor Demo, you will need:
    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.

Building Linux Applications

Create

  1. Select File » New » C Project to create a new project.

  2. Specify the Project Name. Select ARTIK 5/7/10 C Project as Project Type. Click Next.

  3. 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.

Compile

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.

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" 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.

  1. Click Run, then Run Configurations…

  2. Add a C/C++ Remote Application and configure it as follows.

    1. 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.

    2. 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).

    3. 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 the SSH connection you set up here.

To proceed:

  1. If needed, select Run » Run Configurations… to select the target board for the project (under "Connections:").

  2. Right-click on the application project and select Run As » ARTIK 5/7/10 Program

  3. Observe the output of the application program in the build console window.

Troubleshooting

Symptom Possible Solution
"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 (dhclient wlan0).
"-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
./sensor
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.

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).

  1. Click Run, then Debug Configurations.

  2. Add a C/C++ Remote Application and configure it as follows.

    1. Click on "C/C++ Remote Application" and click the New button (upper left corner) to create a new remote connection.
    2. Select the same SSH connection you set up above.

    3. Click on the Debugger tab.

    4. Copy and paste in arm-linux-gnueabihf-gdb where indicated.

    5. 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.

The debugging communication between the IDE and the board requires some setup.

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.

Troubleshooting

Symptom Possible Solution
"-bash: gdbserver: command not found" message Missing debug server package – install it as noted here
Last updated on: