README.md

EOOS Safe Zephyr OS


EOOS copyrights reserved in Rospatent Federal Service for Intellectual Property, Russian Federation

EOOS Safe for Zephyr operating system is a C++ library for cross-platform development of safety-critical software. The library is developed in C++98 programming language and supports features of C++11 programming language depending on compiler options that allows to consider wide criteria when selecting a suitable programming language on initiation step of product development.

EOOS Safe Zephyr is developed within ISO C++ standards, complied with MISRA C++:2008 and AUTOSAR C++14 Coding Guidelines, and relies on ISO 26262 that means applications based on EOOS can be used in critical and safety-related systems.


1. About the project

The Zephyr operating system has wide number of ports for wide number of boards. This project can be built for all of the boards as it has no hardware dependencies, and represents a sample EOOS Zephyr application built for Zephyr OS.

But also as an example of embedded development, this project represents how to build and debug the sample EOOS Zephyr application for:

  • Architecture: ARMv7E-M
  • Processor: Cortex-M4
  • Vendor: ST STM32F429ZIT6
  • Board: NUCLEO-F429ZI MB1137-F429ZI-B01

2. Prerequisites

Please read and follow the official documentation Getting Started Guide on the Zephyr project website till the Build the Blinky Sample, because the steps below will show how to build the sample EOOS Zephyr application.

The EOOS system can be built either on Linux, or on Windows host operating system using ARM cross-compiler. There are several projects we can provide to developers to build the system, which are:

  • CMake;
  • Visual Studio Code.

To build the project the next tools descibed below have to be installed on your host operating system.

2.1. On Ubuntu 22.04

The process described below is passed on

  • Ubuntu 22.04.5 LTS (jammy x86_64)
2.1.1. Download and install Git for Linux and Unix

Get Git for Ubuntu following the commands below.

$ sudo apt-get update
$ sudo apt-get install git

$ git --version
git version 2.34.1
2.1.2. Download and install CMake 3.20 or higher

Download and install CMake and check its version.

$ sudo apt-get install cmake

$ cmake --version
cmake version 3.31.6
2.1.3. Download and install Python 3.7 or higher for automation

Check your version

$ python3 --version
Python 3.10.12
2.1.4. Install ARM GCC arm-none-eabi cross-compiler v10.3.1 or higher

Install cross-compiler and check its version.

$ sudo apt install gcc-arm-none-eabi

$ /usr/bin/arm-none-eabi-gcc --version
arm-none-eabi-gcc (15:10.3-2021.07-4) 10.3.1 20210621 (release)

$ /usr/bin/arm-none-eabi-g++ --version
arm-none-eabi-g++ (15:10.3-2021.07-4) 10.3.1 20210621 (release)
2.1.5. Install debug probe

For debug and programming, you can install either ST-Link, or SEGGER J-Link software so that you are able to use the embedded ST-LINK/V2-1 debug probe or an external SEGGER J-Link probe.

2.1.5.1. Download and install STM32CubeIDE v1.19.0 or higher

Download STM32CubeIDE Debian Linux Installer and install STM32CubeIDE all-in-one development tool.

$ sudo sh ./st-stm32cubeide_1.19.0_25607_20250703_0907_amd64.deb_bundle.sh
2.1.5.2. Download and install STM32CubeProgrammer v2.20.0 or higher

Download STM32CubeProgrammer software for Linux and install STM32CubeProg all-in-one software tool and check its command-line interface.

$ ./SetupSTM32CubeProgrammer-2.20.0.linux

$ cd ~/STMicroelectronics/STM32Cube/STM32CubeProgrammer/Drivers/rules

$ sudo cp *.* /etc/udev/rules.d

$ cd ~/STMicroelectronics/STM32Cube/STM32CubeProgrammer/bin

$ ./STM32_Programmer_CLI
STM32CubeProgrammer v2.20.0
2.1.5.3. Download and install Segger J-Link/J-Trace V8.12a or higher

Download debian package and install it with checking GDB server version.

$ sudo apt install ./JLink_Linux_V812a_x86_64.deb

$ /opt/SEGGER/JLink/JLinkGDBServerCLExe --version
SEGGER J-Link GDB Server V8.12a Command Line Version
2.1.6. Install GNU GDB client v12.1 or higher

Install the GDB client, create the arm-none-eabi-gdb symbolic link on the client to use it in some IDEs, and check its version.

$ sudo apt install gdb-arm-none-eabi
$ sudo ln -s /usr/bin/gdb-multiarch /usr/bin/arm-none-eabi-gdb

$ /usr/bin/arm-none-eabi-gdb --version
GNU gdb (Ubuntu 12.1-0ubuntu1~22.04.2) 12.1
2.1.7. Install terminal Minicom v2.8 or higher

To use terminal on serial UART interface through USB port for debugging, install Minicom, delete brltty for accessing to /dev/ttyUSB0 and check version.

$ sudo apt install minicom
$ sudo apt remove -y brltty

$ minicom --version
minicom version 2.8
2.2.6. Download and install Visual Studio Code IDE

Visual Studio Code v1.96.3 or higher

Download debian package and install it with checking VSCode version.

$ sudo apt install ./code_1.96.3-1736454372_amd64.deb
$ code --version
1.96.3

2.2. On Windows

The process described below is passed on

  • Windows 11 (64-bit)
2.2.1. Download and install Git for Windows

The installer automatically sets the Path system environment variable. But you have to set manually C:\Program Files\Git\binpath to the Path user environment variable to execute Bash. After the installation, check in CMD that tool is executed properly by executing the following commands.

C:\> git --version
git version 2.51.0.windows.2
2.2.2. Download and install ARM GNU Toolchain Version 14.2.Rel1 arm-none-eabi or higher

EOOS is developed within ISO C++ standards and can be compiled with any ARM cross-compilers, which support ISO/IEC 14882:1998 standard and ISO/IEC 14882:2011 standard for new features of C++ programming language.

For now, the project is developed in assembly directives and linker script of GCC GNU Toolchain. Therefore, we recommend to use the toolchain target like arm-gnu-toolchain-14.2.rel1-mingw-w64-i686-arm-none-eabi which shall to be installed to its default directory C:\Program Files (x86)\Arm GNU Toolchain arm-none-eabi\14.2 rel1

C:\Program Files (x86)\Arm GNU Toolchain arm-none-eabi\14.2 rel1\bin>arm-none-eabi-gcc.exe --version
arm-none-eabi-gcc.exe (Arm GNU Toolchain 14.2.Rel1 (Build arm-14.52)) 14.2.1 20241119

C:\Program Files (x86)\Arm GNU Toolchain arm-none-eabi\14.2 rel1\bin>arm-none-eabi-g++.exe --version
arm-none-eabi-g++.exe (Arm GNU Toolchain 14.2.Rel1 (Build arm-14.52)) 14.2.1 20241119
2.2.3. Install debug probe

For debug and programming, you can install either ST-Link, or SEGGER J-Link software so that you are able to use the embedded ST-LINK/V2-1 debug probe or an external SEGGER J-Link probe.

2.2.3.1. Download and install STM32CubeIDE v1.19.0 or higher

Install STM32CubeIDE all-in-one development tool.

2.2.3.2. Download and install STM32CubeProgrammer v2.20.0 or higher

Install STM32CubeProg all-in-one software tool and check its command-line interface.

C:\Program Files (x86)\STMicroelectronics\STM32Cube\STM32CubeProgrammer\bin> STM32_Programmer_CLI.exe
STM32CubeProgrammer v2.20.0
2.2.3.3. Download and install SEGGER J-Link/J-Trace V7.88e or higher

Install the J-Link all-in-one debugging solution and check version of GDB server.

C:\Program Files\SEGGER\JLink> JLinkGDBServerCL.exe --version
SEGGER J-Link GDB Server V7.88e Command Line Version
2.2.4. Download and install PuTTY Client

To use terminal on serial UART interface through USB port for debugging, install PuTTY Client.

2.2.5. Download and install MSYS2

Run MSYS2 MINGW64 console and install the next tools:

$ pacman -S mingw-w64-x86_64-python
$ pacman -S mingw-w64-x86_64-cmake
$ pacman -S mingw-w64-x86_64-make
2.2.6. Download and install Visual Studio Code IDE

3.3. Upgrade ST-LINK/V2-1 firmware

If you aim to program EOOS with the embedded ST-LINK/V2-1 debug probe, it would be strongly recommended to upgrade the ST-LINK/V2-1 firmware to avoid errors like:

Error: No STM32 target found! If your product embeds Debug Authentication, please perform a discovery using Debug Authentication

To do so, dowload and run the STSW-LINK007 firmware upgrade application, which upgrades the debug probe firmware to the latest version. We recomend to run the application on Windows as it is the easiest way to do. For upgrading the firmware on Ubuntu, please read readme.txt file in the application archive.

3. How-to Get Source Code

This git repository contains repositories as git submodules with source code to build a binary exacutable file on Zephyr OS. You can obtain the git repository with similar way either on Linux, or Windows, but we will give instructions in Linux style as we target developing process mostly on it.

3.1. Obtain Git repository

3.1.1. Go to Zephyr repository

Go to Zephyr repository samples of Zephyr workspace.

~$ cd ~/zephyrproject/zephyr/samples
3.1.2. Clone this repository

For instance we will clone it to eoos directory by SSH.

~/zephyrproject/zephyr/samples$ git clone --branch master git@gitflic.ru:eoos-systems/eoos-project-if-zephyr.git eoos
3.1.3. Go the EOOS directory
~/zephyrproject/zephyr/samples$ cd eoos
3.1.4. Initialize and update all submodules of the repository
~/zephyrproject/zephyr/samples/eoos$ git submodule update --init

4. How-to Build Project

EOOS Safe Zephyr is a static library which together with the sample EOOS Zephyr application links to Zephyr elf file that can be burnt on the target MCU flash.

4.1. Build with West build

There are instructions below for the Linux console, but this can be done also in other host OS that Zephyr build system supports.

4.1.1. Activate the virtual environment

See Getting Started Guide -> Get Zephyr and install Python dependencies -> Activate the virtual environment.

4.1.2. Run the build
(.venv) ~/zephyrproject/zephyr$ west build -p always -b nucleo_f429zi samples/eoos

Having done all the steps, the EOOS Zephyr exacutable will be located in ~/zephyrproject/zephyr/build/zephyr/zephyr.elf

4.2 Flash the Sample

Now you can flash the built sample EOOS Zephyr application using west flash, or proceed the instruntion to know how to debug it.

(.venv) ~/zephyrproject/zephyr$ west flash

5. How-to Setup Environment

This EOOS project is developed for fast start developing of target customer boards and is based on the evaluation kit of the target MCU.

5.1. Setup HW environment

5.1.1. Connect the board to your host PC for debug probe

You can debug with the embedded ST-LINK/V2-1 probe or an external SEGGER J-Link probe For the external SEGGER J-Link debug probe, connect the external J-Link probe to SWD connector (CN6) and to USB port of your host PC. For the embedded ST-LINK/V2-1 debug probe, follow the next step.

5.1.2. Connect the board to your host PC with UART

Connect USB cable to ST-LINK USB Micro-B connector (CN1) and to USB port of the host PC for UART interface connection, and possibale usage of the ST-LINK/V2-1 debug probe.

5.2. Setup SW environment

5.2.1. Run a terminal for serial UART connection

On Ubuntu run Minicom

$ sudo minicom --setup

Go to Serial port setup, set the settings:

A -    Serial Device      : /dev/ttyACM0
B - Lockfile Location     : /var/lock
C -   Callin Program      :
D -  Callout Program      :
E -    Bps/Par/Bits       : 115200 8N1
F - Hardware Flow Control : No
G - Software Flow Control : No
H -     RS485 Enable      : No
I -   RS485 Rts On Send   : No
J -  RS485 Rts After Send : No
K -  RS485 Rx During Tx   : No
L -  RS485 Terminate Bus  : No
M - RS485 Delay Rts Before: 0
N - RS485 Delay Rts After : 0

and Exit to the terminal.

On Windows run PyTTY

Check COM port number for this press Windows + R keyboard shortcut to launch the Windows Run box, type devmgmt.msc and click the OK button. The Device Manager window appears, go to ports (COM and LPT) and check your COM port number for a USB Serial Device (COMx) where COMx is port number you need.

Run PyTTY, go Session and check Serial. Go to Connection -> Serial and enter the configuration:

  • Serial line to connction to: COM port you got in Device Manager
  • Speed (baud): 115200
  • Data bits: 8
  • Stop bits: 1
  • Parity: None
  • Flow control: None

Press Open button to run the PyTTY terminal.

6. How-to Run Program

The EOOS built executable file can be burnt and run either on Ubuntu, or on Windows. We will give instructions how to do this on Ubuntu host operating system, but through the same steps you can pass on Windows as well.

6.1. Run two consoles

6.1.1. Run J-Link GDB Server in separate consol
$ /opt/SEGGER/JLink/JLinkGDBServerCLExe \
-if swd \
-device STM32F429ZI \
-endian little \
-speed 1000 \
-port 2331 \
-swoport 2332 \
-telnetport 2333 \
-vd \
-ir \
-localhostonly 1 \
-singlerun \
-strict \
-timeout 0 \
-nogui
6.1.2. Run GNU GDB Client in separate consol
$ /usr/bin/arm-none-eabi-gdb
(gdb)

6.2. Run the program in GDB consoles

6.2.1. Load ELF file
(gdb) file ~/zephyrproject/zephyr/build/zephyr/zephyr.elf
6.2.2. Connect to the GDB server
(gdb) target remote localhost:2331
6.2.3. Reset MCU
(gdb) monitor reset
6.2.4. Load ELF file
(gdb) load
6.2.5. Set breakpoint on the main() funtion
(gdb) break main
6.2.5. Run the program to the breakpoint
(gdb) continue
6.2.5. Continue the program execution
(gdb) continue

Press Ctrl+C to stop execution

6.3. Check the project run

In the terminal for serial UART connection check the output of the program.

*** Booting Zephyr OS build v4.2.0-6179-g169fd6a4a98e ***
[EOOS] ~~~ eoos start ~~~~~~~~~~~~~~~~~
[EOOS] WELCOME TO APP on EOOS Zephyr OS
[EOOS] LANGUAGE: C++11
[EOOS] DATA MODEL: C++ Standard Library types
[EOOS] DATA MODEL size of char: 1B
[EOOS] DATA MODEL size of short: 2B
[EOOS] DATA MODEL size of int: 4B
[EOOS] DATA MODEL size of long: 4B
[EOOS] DATA MODEL size of long long: 8B
[EOOS] DATA MODEL size of pointer: 4B
[EOOS] DATA MODEL size of size_t: 4B
[EOOS] EOOS EXECUTION END
[EOOS] ~~~ eoos end ~~~~~~~~~~~~~~~~~~~

7. How-to Debug Program

7.1. Debug with Visual Studio Code

VSCode is IDE that allows to debug the built EOOS program. For the reason you need to install the next plugins:

7.1.1. Build the project

Build the project with Debug configuration

(.venv) ~/zephyrproject/zephyr$ west build -p always -b nucleo_f429zi samples/eoos -DCONFIG_NO_OPTIMIZATIONS=y

Having done the step, the EOOS Zephyr exacutable will be located in ~/zephyrproject/zephyr/build/zephyr/zephyr.elf

7.1.2. Debug the project

Run VSCode and do the next steps:

  • Open projetc folder ~/zephyrproject: File > Open Folder…
  • Go to Run and Debug and click Create a launch.json file
  • Select the Cortex Debug debugger in the drop-down list
  • Copy a json file content from ~/zephyrproject/zephyr/samples/eoos/ide/eoos-exe-tests-vscode directory to the created launch.json file

After the steps done, press the ST-Link EOOS Debug, or J-Link EOOS Debug button depending on debugger you use, so that VSCode loads the elf file to MCU flash memory and runs the EOOS to the main function. You can debug the program.

To get more details on it, see official documentation how to setup J-Link Visual Studio Code.

Описание

EOOS System for Zephyr OS

Конвейеры
0 успешных
0 с ошибкой