README.md

EOOS Safe FreeRTOS


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

EOOS Safe for FreeRTOS 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 FreeRTOS 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 FreeRTOS operating system has wide number of ports for wide number of MCUs. This project provides exactly one MCU port for exactly one PCB board, which is the EOOS deep elaborated approach.

  • Architecture: ARMv7-M
  • Processor: Cortex-M3
  • Vendor: Hangshun Chip HK32F103VET6 (STM32F103xx compatible)
  • Board: Hangshun Chip HK32F103VET6 Development Board v1.00 2022.01.20

2. Prerequisites

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

  • CMake;
  • Keil;
  • Eclipse;
  • 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)

Note: We recommend to build, develop and debug EOOS on the Ubuntu host operating system.

2.1.1. 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. 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. 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. Download and install Segger J-Link/J-Trace v8.12a

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 by 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. Install one of the IDES

Eclipse IDE for Embedded C/C++ Developers 2024-12 or higher

You need to unpack the archive and run the eclipse file from the root.

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. 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.26.0.windows.1

C:\> bash --version
GNU bash, version 4.4.23(1)-release (x86_64-pc-msys)
2.2.2. 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 Segger J-Link/J-Trace driver

The board can be debugged through the JTAG debugging interface on port CN1. You can use any suitable JTAG debugger, but we have used the most popular one - J-Link.

Install the Segger drivers 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. Install PuTTY Client

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

2.2.5. 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. Install one of the IDEs

NOTE: IDE Keil uVision must be licensed for the MDK-ARM Plus product. Check it in the program menu File -> License Management.

3. How-to Get Source Code

This git repository contains repositories as git submodules with source code to build a binary exacutable file for the one board. 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. Create an empty directory somewhere on your disk

For instance we will create ~/REPOSITORY.

~$ mkdir REPOSITORY
~$ cd REPOSITORY
3.1.2. Clone this repository

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

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

4. How-to Build Project

EOOS is a static library for linkage with other applications. This build can be done with several projects you prefer mentioned above. The result of the build is the EOOS static library and the test executable linked with the library that can be burnt on the target MCU flash.

4.1. Build with CMake project

EOOS can be built on various host operating systems. To standardize the building process, we put most common steps under the hood of the Make.py cross-platform script that is located in scripts/python directory. On Linux you can build it in the console, and on Windows in MSYS2 MINGW64 console. We will give instructions below for the Linux console.

4.1.1. Go to the script directory
~/REPOSITORY/EOOS$ cd scripts/python
4.1.1. Run the script
~/REPOSITORY/EOOS/scripts/python$ python3 Make.py --eoos FreeRTOS --clean --build ALL --config RelWithDebInfo

None that the –config parameter can be one of Release, Debug, RelWithDebInfo, MinSizeRel, but for developing purpose we recommend to pass RelWithDebInfo.

Having done all the steps, the EOOS test exacutable will located in build/codebase/tests/EoosTests.elf

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 with JTAG

Connect JTAG debugger to CN1 port and to USB port of your host PC.

5.1.1. Connect the board to your host PC with UART

Connect USB cable to CN3 port and to USB port of the host PC for UART interface connection.

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/ttyUSB0
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 USB-SERIAL CH340 device.

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 jtag \
-device STM32F103VE \
-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 ~/REPOSITORY/EOOS/build/codebase/tests/EoosTests.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.

[EOOS ] ~~~ eoos start ~~~~~~~~~~~~~~~~~
[EOOS ] WELCOME TO EOOS FreeRTOS TESTS
[EOOS ] LANGUAGE: C++11
[EOOS ] DATA MODEL: C++ Standard Library types
[EOOS ] MEMORY STACK: Stack size of a task is 2048 Bytes
[EOOS ] DISABLE: Dynamic heap memory allocation
[EOOS ] MEMORY MODE: Mutex in heap memory
[EOOS ] MEMORY MODE: Semaphore in heap memory
[EOOS ] MEMORY MODE: Thread in heap memory
[EOOS ] MEMORY MODE: Interrupts in pool memory of 2
[EOOS ] MEMORY MODE: System timer in pool memory of 1
[EOOS ] MEMORY MODE: USART driver in heap memory
[EOOS ] MEMORY MODE: GPIO driver in heap memory
[EOOS ] MEMORY MODE: CAN driver in heap memory
[EOOS ] MEMORY MODE: NULL driver in heap memory
[EOOS ] SYSTEM: Size of system is 1120 Bytes

And check that LED1 is blinking.

7. How-to Debug Program

Building EOOS with other project rather than CMake mostly is needed for developing and debugging purposes.

7.1. Debug with Keil Project

Note that Keil can be run only on Windows.

7.1.1. Run and setup the project

Go to C:\REPOSITORY\EOOS\ide\eoos-exe-tests-keil and run the eoos-tests-if-freertos.uvprojx project.

Go to Project -> Options for target ‘eoos-tests’…, go to Debug and chose your JTAG debugger. For our example, we select J-Link / J-Trace Cortex Press OK.

7.1.2. Build and run the project

Go to Project -> Build Target, and after that do Debug -> Start/Stop Debug Session, so that the built program will be upload on the board and execution of it stopped on the main funtion.

Go to Debug -> Run so that you can run the program.

Описание

EOOS Project for FreeRTOS on Cortex-M3 HK32F103VET6 EVK

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