NOTE: This is only for advanced developers who wants to develop & debug Animula VM on ZephyrRTOS. You should have a GNU/Linux environment.
Again, if you're new to Animula, or you just want to enjoy functional programming on embedded system, please stop here. We always welcome you back here when you are ready to be a hardcore hacker.
We provide a Docker image for working with the Animula firmware for ZephyrRTOS. However, it's limited to the version of zephyrRTOS we are currently testing. If you want to use higher version of zephyrRTOS, please jump to the next section.
If you're new to Docker, please read the official installation of Docker.
First, clone the repository:
git clone --recursive https://github.com/hardenedlinux/animula-zephyr.gitYou need to pull the docker environment for animula-zephyr:
docker build -t hardenedlinux/animula-zephyr:latest .Please be patient since the image is huge.
cd animula-zephyr
docker run -it --rm \
-v $PWD:/workspace \
-w /workspace \
-u "animula:animula" \
hardenedlinux/animula-zephyr:latest \
bashYou should see something similar like this:
animula@75c89755d8cc:/workspace$Now just run make:
makeWe assume you have a working Debian/Ubuntu GNU/Linux environment.
mkdir zephyrRTOS
cd zephyrRTOS
# prepare the virtual environment
sudo apt install python3-venv
python3 -m venv .venv
source .venv/bin/activateYou need SDK for cross-compiling toolchains.
wget -c https://github.com/zephyrproject-rtos/sdk-ng/releases/download/v0.17.0/zephyr-sdk-0.17.0_linux-x86_64.tar.xz
tar xvf zephyr-sdk-0.17.0_linux-x86_64.tar.xz
mv zephyr-sdk-0.17.0 sdkwest tool will start to download the zephyrRTOS source code. This may take a while depending on your internet connection.
pip install west
west init zephyr
west update
# export a Zephyr CMake package. This allows CMake to automatically load boilerplate code required for building Zephyr applications.
west zephyr-export
# export a Zephyr CMake package. This allows CMake to automatically load boilerplate code required for building Zephyr applications.
west packages pip --installPut the following lines in your ~/.bashrc or ~/.profile file:
export ZEPHYR_TOOLCHAIN_VARIANT=zephyr
export ZEPHYR_BASE=/your_project_dir/zephyrRTOS/zephyr
export ZEPHYR_SDK_INSTALL_DIR=/your_project_dir/zephyrRTOS/sdk
#export ZEPHYR_TOOLCHAIN_VARIANT=gnuarmemb
export GNUARMEMB_TOOLCHAIN_PATH=/your_project_dir/zephyrRTOS/sdk/arm-zephyr-eabi/
export Zephyr_DIR=$ZEPHYR_BASEDon't forget to source the file:
source ~/.bashrc
## NOTE: you need to activate the virtual environment again
source .venv/bin/activatemakePlease rename the firmware to firmware.bin:
cp build/zephyr/zephyr.bin firmware.binNOTE: Now you should press ctrl+d to exit the docker environment!
Please read bootloader & firmware upgrade guide to learn how to flash the firmware.