---
description: How to compile the firmware for yourself
---

# Firmware

{% embed url="https://youtu.be/d87vueVeX0Q" %}
How to Video
{% endembed %}

### Install Visual Studio Code&#x20;

{% embed url="https://code.visualstudio.com/download" %}

{% hint style="info" %}
Defaults install options are fine
{% endhint %}

Note this Guide is for Windows. Linux and Mac should be similar

### Add PlatformIO Extension

![](https://3767854731-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Md5nSb70RWQSfl1nJPs%2F-Md84G38gaM0UB_fMYKu%2F-Md89D13StxuQ1YuCFgF%2Fimage.png?alt=media\&token=2aad7c75-e64b-4b97-b166-25013f813e02)

Choose install. **Wait for all the installation popup messages at the bottom to complete**. It can take a while to install, don't close or do anything else in the meantime.

The final message is please restart VSCode. Go ahead and Restart VSCode by clicking the **Reload Now** button.&#x20;

After it reboots you should see the PlatformIO icon on the bottom of the left tool bar (Alien Head)

### Clone the Git Repository or download + extract the .zip file from GitHub

{% embed url="https://github.com/dlktdr/HeadTracker" %}

{% hint style="info" %}
I would suggest using an app like GitHub desktop to clone and keep up to date with changes if your not a command line GIT expert. Use https://www.gihub.com/dlktdr/Headtracker for the URL Clone source.
{% endhint %}

{% hint style="warning" %}
There are a lot of sub folders in the GitHub Tree and can overwhelm Windows max path length. Keep it close to the root or it may not compile. e.g. C:\HeadTracker

If your trying this on Linux, it should be fine anywhere, supports a much longer path length 4096 vs 255 on Windows.
{% endhint %}

{% hint style="danger" %}
The folder cannot contain any spaces.
{% endhint %}

### Choose File->Open Workspace from File

The workspace file to open is **firmware/src/headtracker.code-workspace**

![](https://3767854731-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Md5nSb70RWQSfl1nJPs%2Fuploads%2FY8d2T45D1IEcRkRxZy55%2Fimage.png?alt=media\&token=8c21374c-ba46-4bb7-9f10-b2105a386920)

### **Choo**se the Build Task in VSCode

Under the PlatformIO extension tab, expand Hea&#x64;_&#x54;racker-Zephyr-Nano33\_BLE and click build_

![](https://3767854731-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Md5nSb70RWQSfl1nJPs%2F-Md84G38gaM0UB_fMYKu%2F-Md871l5ii0cqAk_r2XC%2Fimage.png?alt=media\&token=357d098a-abed-45a3-8842-36408fd8ce69)

{% hint style="info" %}
It will install all the necessary packages, and try to compile. **This takes a while!**
{% endhint %}

![](https://3767854731-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Md5nSb70RWQSfl1nJPs%2F-Md8GwFXV3Q9R31rAhCG%2F-Md8IH3R1DwlRF7uDhLu%2Fimage.png?alt=media\&token=8b25253d-1045-41cc-a201-78345fe1352a)

With any luck you should get...

![](https://3767854731-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Md5nSb70RWQSfl1nJPs%2F-Md8NNbSP77_RgWl4hAm%2F-Md8Ph7y_TYGOv3O2hnJ%2Fimage.png?alt=media\&token=295a16cc-d222-4aa1-9279-163d813117a6)

{% hint style="success" %}
SUCCESS
{% endhint %}

### A few things about Zephyr

*   The device tree file .dts is located in the folder&#x20;

    &#x20;%USERPROFILES%\\.platformio\packages\framework-zephyr\boards\arm\\\
    &#xNAN;**\*** I have left this file as shipped and have used an device tree overlay file in zephyr/arduino\_nano\_33\_ble.overlay which defines the hardware used \
    &#x20;Changed in master on 7/25/21
* The prj.conf file located in src/zephyr contains all the KConfig options included in the code

### How to add your changes and make a Pull Request

If you want to add your changes to the main project, follow these steps. You should always work in a branch not in Master. There are many tutorials online. Git is a very powerful tool and can be overwhelming, start with a GUI and learn the command line after.

1. Be sure your Master branch is up to date.
2. Create a new local branch
3. Make your changes
4. Publish your new branch to your github account
5. Create a pull request on GitHub.com

### Happy coding. Visit Discord for Support
