User Tools

Site Tools


hacks:boards:rtos:zephyr

This is an old revision of the document!


General Zephyr Code

  • cd zephyr
  • git tag #find the latest tag, that is the latest stable
  • git tag -l
  • git checkout v1.8.0-rc1
  • git checkout master #use this if need more network or other features, such as bluetooth

Installing Zephyr SDK

  • Down load the Zephyr SDK under Tools https://www.zephyrproject.org/downloads
    • export ZEPHYR_GCC_VARIANT=zephyr
    • export ZEPHYR_SDK_INSTALL_DIR=<sdk installation directory> #directory where the Zephyr SDK was installed.

hacks:boards:rtos:zephyr:config

Installing gcc cross compiler

  • install openocd
  • which arm-none-eabi-gcc
    • export GCCARMEMB_TOOLCHAIN_PATH=“/usr/bin” #the path will depend on where arm-none-eabi-gcc is installed
    • export ZEPHYR_GCC_VARIANT=gccarmemb

source zephyr-env.sh

Step-by-Step Instructions

Installing gcc, gdb and other Toolchains specifically for STM32 Discovery kit IOT Board for STM32L475 MCU and executing "hello_world" program on the Board

Author

RK (Rebel_without_Clause)

Build Environment
General Instructions

(1) Please follow the install instructions exactly as per https://github.com/erwango/openocd-stm32.

(2) Don’t follow the steps on either https://www.zephyrproject.org/doc/getting_started/installation_linux.html2 OR http://zephyr-docs.s3-website-us-east-1.amazonaws.com/online/dev/boards/arm/disco_l475_iot1/doc/disco_l475_iot1.html1.

(3) Use a KNOWN good USB to USB micro cable! When connected to the micro USB terminal “USB STLINK”, the LED besides the “USB STLINK” terminal should be SOLID RED before it is programmed.

(4) To debug package dependency issues, let Debian’s “Synaptics Package Manager” and Fedora’s “Yum Package manager” point the correct dependencies.

Nuts and Bolts Instructions

Do not connect the ST MICRO Board unless instructed. These were executed on a Debian Linux machine, specifically Ubuntu 16.04 LTS. (1) Download the source code (in a directory) in your home directory, that is, Git clone (command “git clone”) from location “https://github.com/erwango/openocd-stm32”.

(2) Once the source code is downloaded, change the working directory to “~/openocd-stm32”.

(3) Open a Bash Shell (command line window/terminal) on your Linux machine and enter the following commands in succession (wait for each command to execute or create a shell script file with the following: $ ./bootstrap $ ./configure –enable-maintainer-mode –enable-stlink $ make

(4) Enter “sudo apt-get install gdb-arm-none-eabi” if gdb-arm (arm debugger) is not installed.

(5) If you have a different arm-gcc installed, enter “sudo apt-get remove gcc-arm-embedded”.

(6) To install arm-gcc, enter “sudo apt-get install gdb-arm-none-eabi”.

(7) Edit the “setlocal.sh” script file in an editor (atom, gedit, nano, vi, vim, etc.).

(8) Find the path for arm-gdb by entering “sudo find /usr/bin -iname *gdb*”.

(9) Copy the path from the search results in (8) and replace the second line by “gdb_path=/usr/bin/arm-none-eabi-gdb” (note: “/usr/bin/arm-none-eabi-gdb” is just an example, it is the path where your arm-gdb points to) and save the “setlocal.sh” file.

(10) Enter “source setlocal.sh” after modifying “setlocal.sh” file.

(11) Install screen by entering “sudo apt-get install screen”.

(12) Download examples by creating a download folder in your home directory, change the working directory to that created directory and enter the command “git clone https://github.com/bitbangr/zephyr.git”.

(13) A directory named “zephyr” and its subdirectories will be created.

(14) Change the working directory by entering “cd ~openocd-stm32”.

(15) Before connecting the board, enter the command “lsusb”, you should see a list of USB ports on your computer.

(16) CONNECT THE ST MICRO Board; as soon as it is connected, the computer should autodetect the board and display it as “DIS_L4IOT” or similar in the Folders window. If not the re-enter the command “lsusb”,the board name “STMicroelectronics ST-LINK/V2.1 (Nucleo-F103RB)” should appear at the shell prompt. the LED besides the “USB STLINK” terminal should be SOLID RED before it is programmed.

(17) Enter the command “stm32_flsh l4 ~zephyr/samples/hello_world/outdir/disco_l475_iot1/zephyr.bin”, if it fails, enter “sudo stm32_flsh l4 ~zephyr/samples/hello_world/outdir/disco_l475_iot1/zephyr.bin”. (See the Flash writing screenshots “Flash_writing_screenshot_1.png” and “Flash_writing_screenshot_2.png”), the LED besides the “USB STLINK” terminal should be FLASHING GREEN as it is programmed. Wait for ST Micro flash to be written, you may get a message such as “Unable to match requested speed 500 kHz, using 480 kHz” (this is not an error).

(18) Press the “RESET” button on the ST Micro board to execute the “hello_world” program on the ST MICRO board. The LED besides the “USB STLINK” terminal should be SOLID GREEN.

(19) Enter the command “screen /dev/ttyACM0 115200” (this command sets the communication speed, else you may see garbage outputted by ST Micro board); you should see the output as shown in “hello_world_screenshot.png” screenshot. Mark has reported success using the Arduino IDE to view this output.

hacks/boards/rtos/zephyr.1508355995.txt.gz · Last modified: 2017/10/18 19:46 by jdmc

Except where otherwise noted, content on this wiki is licensed under the following license: Public Domain
Public Domain Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki