# Getting started with SOMANET SDK¶

This article describes the basics for using SOMANET Libraries. By the end of this article you will know how to import SOMANET SDK Libraries into the XMOS development environment, build an application for your SOMANET device and run it.

Note

First make sure that you have set up your XMOS development environment installed and you SOMANET hardware at hand. In case you are assembling your SOMANET device from individual modules see this assembly tutorial.

## Importing a SOMANET SDK Libraries into xTIMEcomposer¶

In order to import any SOMANET Library, first of all, you need to download or clone the source files. Once done, go to your xTIMEcomposer and follow the next steps:

1. Click on File > Import...

2. A window will pop up. Choose General > Existing Projects into Workspace and click Next.

3. At Select root directory option, click on Browse... to search for your project file

4. Choose the location containing your library and click OK.

5. Finally click on Finish.

6. Your imported modules and apps must appear on the Project Explorer panel, where it is possible to explore the content.

You will find the Project Explorer at Window > View > Project Explorer.

As you will notice, each application is presented as a different project. The same applies for the software modules.

## Building an application on xTIMEcomposer (recomended)¶

Once we have imported the libraries required by an application, we can compile it.

1. We will go to the main bar at the top and look for the build button . If we click over the small arrow we could choose the kind of build that we want, either normal (Release) or for debugging (Debug). By clicking the button the building of the selected project will start.

2. The building will output different messages through the Console showing information related to the building. If any error occurs, you will be notified at this Console as well as in the nearby Problems tab.

## Building an application from linux terminal (optional alternative)¶

Building an application from a terminal is also possible, you should first download all the required libraries for such an application in a common folder. Then follow the next steps:

1. Navigate to the folder containing your application and type:

make

2. Your executable binary files should be at bin/Release and the terminal should output:

Build complete
Done


## Generating binary files from xTIMEcomposer (recomended)¶

Normally, we will get our hardware programmed directly from the xTIMEcomposer, but in some cases we might just need to deploy a binary file with your application. To do this from your xTIMEcomposer, follow the next steps:

1. We will have a look at the current configuration for flashing XCore applications. Go to Run > Flash configurations...
1. A pop up window will show the different kind of applications to configure. Double click on XCore Application.
1. A new dialogue will open up the current configuration for flashing XCore applications. At this Main tab we could select the software component where our application is located (Project box), and the application to flash (C/C++ Application box).
1. Now change to the XFlash Options tab.
1. There, we should tick the option Output to file and insert the file name for our binary. Also we must tick the option Boot partition size and fill in the value 0, which lets the environment automatically select the proper size. We also have to include the additional option –noinq, which makes the binary building independent from any connected device.
1. Once the configuration is set, just click on Apply and then on Flash. The desired binary file will be deployed at your specified output file.

## Generating binary files from a terminal (optional alternative)¶

Normally, we will get our hardware programmed directly from the xTIMEcomposer, but in some cases we might just need to deploy a binary file with your application. To do this from the terminal, follow the next steps:

1. At first, we should build the application we want to convert into binaries in order to obtain an executable.

2. Once we have an executable binary file (*.xe) of our application, we must navigate to the containing folder and execute the next code. Remember that if you are using Linux, you might need to set the XMOS environment variables.

xflash --upgrade 1 your_application/bin/Release/your_application_Release.xe -o path/to/the/output/image/of/your_application.bin