Basic example for Zephyr OS including Github Actions and flashing the build project on Windows and Linux
The compiled binaries are currently available at the Github Actions center. These files will also become available in the releases menu when there is a official release. The artifacts can be downloaded by clicking on a succesful workflow run. Download the build artifact.
Before you can flash the files you have to follow the installation steps as explained in flashing-compiled-binaries.md.
The artifact includes a script for Windows and Linux. This script should automatically flash the script to the connected ESP32 board. The correct port should automatically be picked up, however you can specify a port by adding the argument -p. For example -p COM2
on Windows and -p /dev/ttyUSB1
on Linux.
Because operating systems protect you from running scripts you have to run a command to allow the execution of the script.
Allow the current logged in user to execute scripts. more info
Set-ExecutionPolicy -ExecutionPolicy Bypass -Scope CurrentUser
Allow the selected file to be executed
chmod +x flash.sh
Now the script can be executed.
./flash.sh -p /dev/ttyUSB1
Making local changes and compiling the source code can be done by editing the files in the app directory. You need to use CMake (CMakeLists.txt) to include new files. After you have made your modifications you can compile Zephyr OS by following the tutorial in building-zephyr-os.md.
This section may not be 100% accurate and still needs some work.
cmake_minimum_required(VERSION 3.20.0)
set(APP_TARGET zephyr-os)
find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
project(${APP_TARGET})
target_sources(app PRIVATE src/main.c)
add_subdirectory(driver)
target_link_libraries(${APP_TARGET}
driver
)
add_library(driver INTERFACE)
target_include_directories(driver
INTERFACE
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}
)
target_sources(driver
INTERFACE
src/driver.cpp
)