Even though openHASP is available in several pre-compiled firmware variants, sometimes the ready-to-flash binaries aren't enough.
If you need to customize some features, or simply change some parameters, then you need to compile a firmware binary yourself.
The guide below will describe how to make your own build from source on your local PC.
Install Visual Studio Code~
Additional packages on Linux:
sudo apt update sudo apt install git python3-venv
Make sure to add the
--recursive parameter when cloning the project from GitHub. Otherwise git will not download the required submodules in the
/lib subdirectory. To clone the current development version (main branch):
If you already cloned openHASP without the
--recursive parameter, you can fetch the submodules separately using:
To switch to a different branch (for example 0.6.3 release) use:
1 2 3 4
Open in PlatformIO~
Open the project folder in Visual Studio Code. You will receive a popup to install PlatformIO IDE if it is not already installed. This will automatically install all PlatformIO dependencies and the MCU compiler frameworks needed.
Restart Visual Studio Code when the PIO installation completes.
Create a configuration~
platformio_override.ini and uncomment the platforms for
[platformio] extra_configs = ; Uncomment or edit the lines to show more User Setups in the PIO sidebar ; user_setups/darwin_sdl/*.ini user_setups/esp32/*.ini user_setups/esp32s2/*.ini ; user_setups/linux_sdl/*.ini ; user_setups/stm32f4xx/*.ini ; user_setups/win32/*.ini
If you use customization, remove the comment from the line
[override] ; -- Hasp config options -------------------------------------- build_flags = ; -- Uncomment the next line to use the file include/user_config_override.h settings -DUSE_CONFIG_OVERRIDE
Then Click on the "Refresh Project tasks" icon in PlatformIO to list all the configured environments.
You can now run "Build" or "Build All" in PlatformIO to compile (all) the firmware.
Native Linux build~
For native linux_sdl builds, you also need:
sudo apt update sudo apt install build-essential libsdl2-dev
Native MacOS build~
For native darwin_sdl builds, you also need Homebrew:
Native Windows build~
For native windows_sdl builds, you also need MingW:
Add the path to your Mingw-w64
bin folder to the Windows PATH environment
C:\msys64\mingw64\bin). See instruction, 4.