First Firmware

This document will guide you through a blank firmware creation, explains the structure of the created project and the typical development cycle.

Warning

This document assumes that you have necessary tools installed according to the chapter PlatformIO installation.

Hello World

If you did follow the Firmware quick start you should have twr-skeleton cloned from the GitHub.

This repository serves as a blank project with some of our structures.

Note

It is a good idea to clone this repository every time you are starting a new project. It has a correct file structure and all files needed to start from scratch.

Project Structure

This is the file structure of your hello-world project. It is a Git-initialized repository ready to be used with the PlatformIO.

 1.
 2├── .git
 3│   └── ...skipped
 4├── .pio
 5│   └── ...skipped
 6├── src
 7│   └── application.c
 8├── include
 9|   └── application.h
10├── LICENSE
11├── Makefile
12├── platformio.ini
13└── README.md

This project can be immediately compiled and flashed to the Core Module, Radio Dongle or Cloony.

The place where you should edit your code is in the src directory or if you need to edit something in the header file you can do it in the include directory.

Usually you will not need to modify other files than those in there.

Therefore your first step most likely will be to open the src/application.c file in your favorite editor - for instance Atom, Visual Studio Code, Sublime Text, etc.

Note

The Visual Studio Code is advised because of the PlatformIO extension that is available for it, but you can always use the CLI version.

Tip

If you want to see some firmware examples, you can visit our GitHub repository or some of the How to: chapters in the Firmware group.

Development Cycle

Normally, the development cycle is the repetition of the following 4 steps:

  • Edit the file src/application.c.

  • Build the project to check for the errors.

  • Upload the code into the Core Module or Radio Dongle.

  • Test your firmware

    Tip

    If you need to debug your application, please follow the chapter Debugging.

Programming Language

Firmware is implemented in pure C language, which is an industrially accepted language for embedded and low-power devices. There are the main reasons for choosing this technology:

  • Effecient use of hardware resources

  • Stability and long time available development environment

  • Simple and understandable syntax

Note

Effective use of hardware resources is important for developing of low-power devices. This is primary goal of HARDWARIO ecosystem.

You can use all known C language structures and also our SDK that is implemented so you can quickly and easily, without any problems with compatibility, create your custom firmware.

Next steps

From now you should be able to create firmware and update existing ones.

To know more about our modules and see some examples, there are a lot of chapters after this one that goes over our modules and examples for them.

If you are interested in more information about SDK and firmware development you can visit Advanced firmware information.