meta data for this page


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://​​|zephyr RTOS]] to build a zephyr example for the [[https://​​latest/​boards/​arm/​olimexino_stm32/​doc/​olimexino_stm32.html|OLIMEXINO STM32]] board without the [[https://​​latest/​getting_started/​index.html#​clone-the-zephyr-repositories|west]] tool.
 +Information here is based on the documentation of the [[https://​​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:
 +~# apt-get install python3-yaml
 +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.
 +guest:~$ vi .zephyrrc
 +export GNUARMEMB_TOOLCHAIN_PATH="​~/​opt/​xPacks/​@gnu-mcu-eclipse/​arm-none-eabi-gcc/​8.2.1-1.1.1/​.content"​
 +=== Get zephyr ===
 +First get sources of zephyr kernel into directory ''​./​zephyr'':​
 +guest:~$ git clone https://​​zephyrproject-rtos/​zephyr
 +=== Build ===
 +Open a shell as user and source environment files:
 +guest:~$ source .zephyrrc
 +guest:~$ cd zephyr
 +guest:​~/​zephyr$ source
 +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:
 +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: ​
 +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
 +=== 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:\\
 +After finishing the dialog the project is assigned as new project in the project explorer view of Eclipse.\\
 +== Debugging ==
 +Select the binary in the Project Explorer to create a debug configuration for:\\
 +  * 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"​.