meta data for this page
  •  

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

start:setup_a_example_zephyr_project_in_for_eclipse [2019/06/01 21:56] (current)
Line 1: Line 1:
 +===== Setup a example zephyr project w/o west =====
 +This shows howto install [[https://​www.zephyrproject.org/​|zephyr RTOS]] to build a zephyr example for the [[https://​docs.zephyrproject.org/​latest/​boards/​arm/​olimexino_stm32/​doc/​olimexino_stm32.html|OLIMEXINO STM32]] board without the [[https://​docs.zephyrproject.org/​latest/​getting_started/​index.html#​clone-the-zephyr-repositories|west]] tool.
 +Information here is based on the documentation of the [[https://​docs.zephyrproject.org/​latest/​getting_started/​installation_linux.html|zephyr project]].
 +Instead of the arm cross toolchain provided by the zephyr SDK we use [[start:​eclipse_for_linux_on_armhf_development#​Installing ARM Cross toolchain|xPacks installed toolchain]] directly from ARM development.
 +=== Environment ===
 +Install python3-yaml as root:
 +<​Code:​bash>​
 +~# apt-get install python3-yaml
 +</​Code>​
 +The needed ARM cross toolchain must be installed in ''​~/​opt/​xPacks''​ as described [[start:​eclipse_for_linux_on_armhf_development#​Installing ARM Cross toolchain|here.]]
 +insert the toolchain path in environment,​ which is from ARM development and not from the zephyr SDK.
 +<​Code:​bash>​
 +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
 +</​Code>​
 +=== Get zephyr ===
 +First get sources of zephyr kernel into directory ''​./​zephyr'':​
 +<​Code:​bash>​
 +guest:~$ git clone https://​github.com/​zephyrproject-rtos/​zephyr
 +</​Code>​
 +
 +=== Build ===
 +Open a shell as user and source environment files:
 +<​Code:​bash>​
 +guest:~$ source .zephyrrc
 +guest:~$ cd zephyr
 +guest:​~/​zephyr$ source zephyr-env.sh
 +</​Code>​
 +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:
 +<​Code:​bash>​
 +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
 +</​Code>​
 +Now it's time to build:
 +<​Code:​bash>​
 +guest:​~/​zephyr_build/​samples/​hello_world$ make
 +</​Code> ​
 +The build process should generate Olimexino executables in the directory ''​~/​zephyr_build/​samples/​hello_world/​zephyr''​.
 +=== 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.
 +With the ''​stm32flash''​-tool the build binary could be flashed via UART to the STM32 while pressing the BUT and reset button on Olimexino: ​
 +<​Code:​bash>​
 +guest:​~/​zephyr_build/​samples/​hello_world$ stm32flash -w zephyr/​zephyr.bin -v -g 0x0 /​dev/​ttyUSB0
 +</​Code>​
 +After resetting Olimexino the program should output some sample text on ''/​dev/​ttyUSB0''​. Check by a terminal emulation program: ​
 +<​Code:​bash>​
 +guest:~/$ picocom /​dev/​ttyUSB0 -b115200
 +Whats up! olimexino_stm32
 +Whats up! olimexino_stm32
 +Whats up! olimexino_stm32
 +.
 +.
 +</​Code>​
 +=== Eclipse ===
 +Open Eclipse equipped with needed [[start:​eclipse_for_linux_on_armhf_development|plugins,​ toolchains]] and [[start:​segger_jlink_for_stm32_on_eclipse_debugging|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:\\
 +{{:​start:​import_dir.png?​400|}}\\
 +After finishing the dialog the project is assigned as new project in the project explorer view of Eclipse.\\
 +{{:​start:​project_expl1.png?​200|}}\\
 +
 +== Debugging ==
 +Select the binary in the Project Explorer to create a debug configuration for:\\
 +{{:​start:​binary.png?​200|}}\\
 +  * 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"​.