Cross Compile Zephyr™ OS

GNU Arm Embedded Toolchain

$ mkdir -p “${HOME}”/opt
$ cd “${HOME}”/opt
$ tar xjf ~/Downloads/gcc-arm-none-eabi-7-2017-q4-major-mac.tar.bz2
$ chmod -R -w “${HOME}”/opt/gcc-arm-none-eabi-7–2017-q4-major
$ "${HOME}"/opt/gcc-arm-none-eabi-7-2017-q4-major/bin/arm-none-eabi-gcc --versionarm-none-eabi-gcc (GNU Tools for Arm Embedded Processors 7–2017-q4-major) 7.2.1 20170904 (release) [ARM/embedded-7-branch revision 255204]

Getting and compiling Zephyr™ OS

Dependencies

$ brew install cmake ninja dfu-util doxygen qemu dtc python3 gperf

Zephyr™

$ git clone https://github.com/zephyrproject-rtos/zephyr.git
$ cd ~/zephyr
$ pip3 install — user -r scripts/requirements.txt
$ source zephyr-env.sh

Configuration toolchain

$ export GCCARMEMB_TOOLCHAIN_PATH="~/opt/gcc-arm-none-eabi-7-2017-q4-major/"
$ export ZEPHYR_TOOLCHAIN_VARIANT=gccarmemb

Building the hello world sample

$ cd $ZEPHYR_BASE/samples/hello_world
$ mkdir build && cd build
# compiling for arduino_due using the third part ARM compiler
$ cmake -GNinja -DBOARD=arduino_due ..
# generating the build system with Ninja:
$ ninja

Bonus : run your application in qemu

$ cd $ZEPHYR_BASE/samples/hello_world/build# compiling for qemu_cortex_m3 using the third part ARM compiler
$ cmake -GNinja -DBOARD=qemu_cortex_m3 ..
# generating the build system with Ninja:
$ ninja
# running into qemu:
$ ninja run

Going further

http://docs.zephyrproject.org/getting_started/getting_started.html
https://github.com/01org/zephyr/blob/master/doc/getting_started/getting_started.rst

--

--

--

Love podcasts or audiobooks? Learn on the go with our new app.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Turhan Oz

Turhan Oz

More from Medium

How to Install jq(JSON processor) on RHEL/CentOS

Systemtap — find who access the file

6 Tips on —  How to Get Started with NixOS and Nix Packages are your next Docker Desktop Alternative

Reduce CVEs in your containerized Node.js app using a Distroless base image

Remove package managers, shells, and other unnecessary programs