This repository contains a Dockerfile for building the Zephyr RTOS minimal development environment image.
Based on this article.
The docker image include toolchain for arm-zephyr-eabi, xtensa-espressif_esp32 and xtensa-espressif_esp32s3. Cmsis, hal_stm32 and hal_espressif modules(can be changed by editing west.yml)
A workspace topology looks like this:
┌────────────────────────────────────────┐
│ Docker container │
├────────────────────────────────────────┤
│ ~/zephyrproject/ │
│ │ │
│ ├── .west/ │
│ │ └── config │
│ │ │
│ ├── zephyr/ │
│ │ ├── west.yml │
│ │ └── [... other files ...] │
│ │ │
│ ├── modules/ │
│ │ ├── lib/ │
│ │ └── [... other files ...] │
│ │ │
│ ├── local_repo/ │
│ ├── west.yml │
│ ├── [... other files ...] │
├────────────────────────────────────────┤
│ Host PC │
├────────────────────────────────────────┤
│ │ │
│ └── . │
More info about topology here
To build docker image:
docker build . -t zephyr_image
Optionally, you can change the time zone value in the dockerfile (ENV TZ=...) and/or the necessary loadable modules in the ./share/west.yml file (import:).
docker run --rm -it --name zephyr_container -v .:/root/zephyrproject/local_repo zephyr_image
You can copy west.yml on your host by:
docker cp zephyr_container:root/zephyrproject/local_repo/west.yml .\west.yml
Edit west.ymal...
To push west.yml back in container:
docker cp .\west.yml zephyr_container:root/zephyrproject/local_repo/west.yml
In the shell session, put some commands like these:
cd ~/zephyrproject/
west update
cd ~/zephyrproject/local_repo/share
cp -r ~/zephyrproject/zephyr/samples/basic/blinky ./my_blinky
west build --pristine=auto -b stm32_min_dev@blue my_blinky/ --build-dir my_blinky/artifacts/
If the build is successful, the artifacts will be in:
ls -a my_blinky/artifacts/zephyr
(artifacts can be accessed from the host device)