meta data for this page
Setup a example zephyr project with make
This shows howto install zephyr RTOS to build a zephyr example for the OLIMEXINO STM32 board without the west tool. Information here is based on the documentation of the zephyr project. Instead of the arm cross toolchain provided by the zephyr SDK we use xPacks installed toolchain directly from ARM development.
Install python3-yaml as root:
~# apt-get install python3-yaml
The needed ARM cross toolchain must be installed in
~/opt/xPacks as described here.
insert the toolchain path in environment, which is from ARM development and not from the zephyr SDK.
guest:~$ vi .zephyrrc export GNUARMEMB_TOOLCHAIN_PATH="~/opt/xPacks/@gnu-mcu-eclipse/arm-none-eabi-gcc/8.2.1-1.1.1/.content" export ZEPHYR_TOOLCHAIN_VARIANT=gnuarmemb
First get sources of zephyr kernel into directory
guest:~$ git clone https://github.com/zephyrproject-rtos/zephyr
Open a shell as user and source environment files:
guest:~$ source .zephyrrc guest:~$ cd zephyr guest:~/zephyr$ source zephyr-env.sh
Create a build directory in parallel to the zephyr sources (because of Eclipse) and call cmake with parameters for Unix makefile generation and the Olimexino board:
guest:~/zephyr$ cd guest:~/$ mkdir -p ./zephyr_build/samples/hello_world/ && cd ./zephyr_build/samples/hello_world guest:~/zephyr_build/samples/hello_world$ cmake -G"Eclipse CDT4 - Unix Makefiles" -DBOARD=olimexino_stm32 ../../../zephyr/samples/hello_world
Now it's time to build:
The build process should generate Olimexino executables in the directory
Flashing and running
A USB to UART cable is needed on
/dev/ttyUSB0 which is connected to the Olimexino UEXT UART pins. Be careful to select proper voltage of 3.3V.
stm32flash-tool the build binary could be flashed via UART to the STM32 while pressing the BUT and reset button on Olimexino:
guest:~/zephyr_build/samples/hello_world$ stm32flash -w zephyr/zephyr.bin -v -g 0x0 /dev/ttyUSB0
After resetting Olimexino the program should output some sample text on
/dev/ttyUSB0. Check by a terminal emulation program:
guest:~/$ picocom /dev/ttyUSB0 -b115200 Whats up! olimexino_stm32 Whats up! olimexino_stm32 Whats up! olimexino_stm32 . .
Open Eclipse equipped with needed plugins, toolchains and debugging facility. Open the File → Open Projects from File System … dialog. In the import source field select the build directory containing the cmake generated Eclipse makefile project:
After finishing the dialog the project is assigned as new project in the project explorer view of Eclipse.
- Open Run → Debug Configuration and create a new one from the GDB SEGGER J-Link Debugging template.
- Check if GDB Client is a arm-none-eabi-gdb from the arm toolchain
- Check device name to be “STM32F103RB”
- Set a valid SVD for this MCU in tab SVD from the Packages directory like “/home/guest/Packages/Keil/STM32F1xx_DFP/2.3.0/SVD/STM32F103xx.svd”.