# 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

![](/files/-Md89D13StxuQ1YuCFgF)

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**

![](/files/06bSTJQU3GkBi0QwADkS)

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

Under the PlatformIO extension tab, expand Head*Tracker-Zephyr-Nano33\_BLE and click build*

![](/files/-Md871l5ii0cqAk_r2XC)

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

![](/files/-Md8IH3R1DwlRF7uDhLu)

With any luck you should get...

![](/files/-Md8Ph7y_TYGOv3O2hnJ)

{% 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


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://headtracker.gitbook.io/head-tracker/support/development/firmware.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
