# Compiling Applications with nRF Connect Extension for VS Code

{% hint style="warning" %}
Compiling Conexio Stratus applications using nRF Connect for VSCode is the recommended method.
{% endhint %}

To make zephyr-based application development a breeze, the Stratus board is also compatible with the newly released nRF Connect SDK extension for VS Code.&#x20;

## **1. Adding an existing application to nRF Connect for VS Code**

Once you are all set with the [<mark style="color:red;">nRF Connect Visual Studio Code Extension Pack</mark>](https://marketplace.visualstudio.com/items?itemName=nordic-semiconductor.nrf-connect-extension-pack) installation, start the extension in the VS Code.

{% hint style="success" %}
Installing the nRF Connect Visual Studio Code Extension Pack will also install all the required dependencies.
{% endhint %}

First, Open Existing Application:

<figure><img src="https://3229153654-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MXjGw-Z8_tCuNQB93OW%2Fuploads%2FnscmzecJVhl9fsjf9mkp%2Fopen-apps.png?alt=media&#x26;token=b7f6ed37-3395-4f59-b664-b421f0de2cc1" alt=""><figcaption></figcaption></figure>

This will open the file browser on your machine. Navigate to the location where the `conexio-firmware-sdk` directory resides (`ncs/v2.x.0/conexio-firmware-sdk/samples/conexio_stratus`). Select a sample application and click **Open**.

<figure><img src="https://3229153654-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MXjGw-Z8_tCuNQB93OW%2Fuploads%2FkPXfy7QiR5VgKN1Y52vl%2F2.png?alt=media&#x26;token=d26c15c5-9c74-40b6-8856-a00f52d6f3a7" alt=""><figcaption><p>Browse the sampe application</p></figcaption></figure>

You should now see the ported application under **APPLICATIONS** on the left pane.

## **2. Point the build system to the custom board root directory of Conexio boards**

By default, the build system in nRF Connect goes to specific folders to look for board definitions. Namely,`<SDK Installation Path>/zephyr/boards/arm/`and `<SDK Installation Path>/nrf/boards/arm/`.

We need to tell the build system to look at the directory for the custom Conexio Stratus boards. This is easy to do within the VS Code environment.

Navigate to the Settings of nRF Connect Extension. This can be done by navigating to File -> Preferences -> Settings -> Extensions -> nRF Connect -> Board Roots, then add the `conexio-firmware-sdk`directory path as shown below.

**For NCS v2.7.0**

> `/opt/nordic/ncs/v2.7.0/conexio-firmware-sdk`

<figure><img src="https://3229153654-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MXjGw-Z8_tCuNQB93OW%2Fuploads%2FGRvk2AGNQrhTxtJstgkB%2Fboard-root-vscode.png?alt=media&#x26;token=684eedc4-6856-46e5-b2f1-e37ca627f331" alt=""><figcaption><p>Board Roots for NCS v2.7.0</p></figcaption></figure>

**For NCS v2.9.0**

> `/opt/nordic/ncs/v2.9.0/conexio-firmware-sdk`

<figure><img src="https://3229153654-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MXjGw-Z8_tCuNQB93OW%2Fuploads%2FXVibKXTGEDR5s8EfqI3Y%2FScreenshot%202025-03-02%20at%201.40.00%E2%80%AFPM.png?alt=media&#x26;token=0ef43084-783b-40d9-9b48-e89a3f283652" alt=""><figcaption><p>Board Root for NCS v2.9.0</p></figcaption></figure>

{% hint style="info" %}
The above directory path will be different on the Windows and Ubuntu machines.
{% endhint %}

## **3. Compiling an application using nRF Connect Extension**

Prior to compiling our sample application, we first need to generate the device build configuration for our project by clicking on the **Add Build Configuration (1)** option as shown below.

This opens a new tab, asking the user to select the board for which the build configurations will be generated. In our case, we will&#x20;

* (2) check the **Custom boards**
* (ii) then from the drop-down menu select the desired Conexio Stratus board
  * &#x20;`conexio_stratus_pro/nrf9161/ns`for Stratus Pro nRF9161
  * `conexio_stratus_pro/nrf9151/ns`for Stratus Pro nRF9151
  * `conexio_stratus/nrf9160/ns`for  Stratus nRF9160
* (3) click **Build Configuration** to start the Zephyr application build process.

<figure><img src="https://3229153654-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MXjGw-Z8_tCuNQB93OW%2Fuploads%2Fl48IMwM7u5WeNFZyBxKh%2Fbuild-config.png?alt=media&#x26;token=168f1844-5020-4aeb-aaa8-b57664c92a26" alt=""><figcaption><p>Adding build configuration for NCS v2.7.0</p></figcaption></figure>

<figure><img src="https://3229153654-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MXjGw-Z8_tCuNQB93OW%2Fuploads%2FuyAAtnZ4dqu9jOSpRNFN%2FConexio%20Board%20Targets.png?alt=media&#x26;token=7a1d5856-3f40-4c4f-b059-9dcc6ee2d8fe" alt=""><figcaption><p>Conexio Board Targets</p></figcaption></figure>

Note for **NCS v2.9.0**: to generate the **app\_update.bin**, select **No sysbuild** under System build (sysbuild) option as shown below.

<figure><img src="https://3229153654-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MXjGw-Z8_tCuNQB93OW%2Fuploads%2Ff6zgXrKarjitWTnvuTK4%2FScreenshot%202025-03-02%20at%201.45.17%E2%80%AFPM.png?alt=media&#x26;token=5ce9474d-8888-419a-8cf5-dfa1d076eb62" alt=""><figcaption><p>No sysbuild config for NCS v2.9.0</p></figcaption></figure>

Now, you should see the build process kicking in the background and generating the required files and binaries for the `led_blink` sample application.

<figure><img src="https://3229153654-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MXjGw-Z8_tCuNQB93OW%2Fuploads%2F62N3Hhn0qGblZ9sL39f8%2Fcompiling.png?alt=media&#x26;token=75ff8699-3745-4a5d-85b8-db7e57de5ff9" alt=""><figcaption><p>Application Build In Progress</p></figcaption></figure>

Once the project is compiled successfully, in the project navigation panel, you will see all the generated files. The main program binary that will be flashed to the Stratus device is **app\_update.bin**, located in your app directory -> build/zephyr/app\_update.bin.

![Application Compiled Successfully](https://3229153654-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MXjGw-Z8_tCuNQB93OW%2Fuploads%2FvsJA00lgPTTLcwZ2M0yD%2Ffig_10.png?alt=media\&token=1acc802a-30a9-4b63-a80b-069f83b76d58)

Well done! You have successfully managed to compile the sample application using the nRF Connect extension.

## 4. Setting DFU Mode (Device Firmware Upgrade)

To program the Stratus device via USB, you will need to put the device into DFU mode first. This mode triggers the onboard bootloader that accepts firmware binary files. To enter DFU mode:

* Hold down BOTH buttons (BUTTON/MODE + RESET)
* Release only the RESET button, while holding down the MODE/USER button
* Wait for the white LED to turn on (steady-state)
* Release the MODE button

The device is now in DFU mode. 🚨

## **5. Flashing an application via USB**

To upload the Conexio Stratus Pro firmware, we now have to:

* Open the terminal within the nRF Connect extension and invoke the `newtmgr -c serial image upload build/zephyr/app_update.bin` as shown, making sure the device is in DFU mode.

![Uploading the Firmware to the Device](https://3229153654-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MXjGw-Z8_tCuNQB93OW%2Fuploads%2FZxs6hANiHei9Afow4aHj%2Ffig_11.png?alt=media\&token=8e19b85d-e5f6-40ae-943d-a9a79f54bade)
