/FreeRTOS_LotteryScheduling

Explored the complexities of embedded systems and developed a FreeRTOS Lottery Scheduler for Arm Cortex-M3 on QEMU, enhancing scheduling capabilities beyond default implementations.

Primary LanguageC

Configuration and Installation

How to build a demo

  1. Install an Eclipse distribution: Eclipse

    • Go to Download > Download x86_64
    • In the Eclipse Installer, you can select the normal Eclipse version for C/C++ or the one specific for Embedded systems.
  2. Install the GCC Toolchain: from the GNU Arm Embedded Toolchain select and install gcc-arm-none-eabi-10.3-2021.10-win32.exe. At the end of the download, remember to check the box "Add path to enviornmental variable".

Install the GCC Toolchain Install the GCC Toolchain

  1. QEMU download: QEMU

    • Go to Download > Windows > 64-bit
    • And select qemu-w64-setup-20231126.exe

    After QEMU's installation, you need to put QEMU in the PATH variables:

    • Advanced System Settings > Environment Variables
    • Add "C:\Program Files\qemu" to the PATH.

    Environmental variables come in two different categories. System and user environment variables (configured for each user) (set for everyone).All users can access system environment variables worldwide. For this reason it is sufficient to set the environmental variables in the system.

QEMU path QEMU path

  1. Install FreeRTOS: From the website (or from GitHub). In this guide, we are using: "FreeRTOS 202212.01".

FreeRTOS download

  1. Install Chocolatey: Chocolatey simplify some of the next necessary installations.

    • Run PowerShell as an administrator
    • Write: Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))
  2. Download and install Make: it is possible to do this via the official GNU Make website or by using Chocolatey. In this project we decide the use Chocolatey software to install make. It is sufficient to write: choco install make.

  3. Eclipse - Import the Demo:

    • Open Eclipse
    • Go to Import > General > Existing Projects into Workspace
    • Click "Next" and in the next Window, select /FreeRTOS/Demo/CORTEX_MPS2_QEMU_IAR_GCC/build/gcc as the root directory. Crucially ensure the "Copy projects into workspace" checkbox is unchecked before clicking the Finish button to bring the project into Eclipse.

Eclipse: Import the Demo

  1. Eclipse - PATH Update:
    • Go to: Window > Preferences > C/C++ > Build > Environment.
    • Add: PATH ${OS}

Eclipse: PATH Update

  1. Install MinGW: to avoid the "Program 'g++' not found in PATH" error it is needed to install MinGW by the MinGW-w64 official page, or by writing in the prompt: choco install mingw

  2. Project > Build All: Now, all is setted. Select 'Build All' from the Eclipse 'Project' menu. A successful build creates the elf file FreeRTOS/Demo/CORTEX_MPS2_QEMU_IAR_GCC/build/gcc/output/RTOSDemo.out.

  3. Run QEMU: To visualize the result write in the shell:

qemu-system-arm -machine mps2-an385 -cpu cortex-m3 -kernel "C:\Users\Christian Coduri\Desktop\FreeRTOSv202212.01\FreeRTOS\Demo\CORTEX_MPS2_QEMU_IAR_GCC\build\gcc\output\RTOSDemo.out" -monitor none -nographic -serial stdio

Demo running

What are this necessary things?

  • Eclipse: an integrated development environment used in computer programming.
  • GCC Toolchain: a cross-compiler toolchain specifically designed for compiling code for ARM architecture-based microcontrollers, microprocessors, and embedded systems.
  • QEMU: a free and open-source emulator. It emulates a computer's processor through dynamic binary translation and provides a set of different hardware and device models for the machine, enabling it to run a variety of guest operating systems.
  • FreeRTOS: a real-time operating system kernel for embedded devices
  • Chocolatey: is a machine-level, command-line package manager and installer for software on Microsoft Windows.
  • MinGW acts as a bridge between Windows and the GNU toolchain, providing the necessary tools for compiling and building software on the Windows platform.

Written by Group 21: Armenante Pietro, Coduri Christian, Lombardi Giovanni, Serafini Luca.