Skip to main content

Development Environment Setup

This document will guide you through setting up the ElenixOS development environment, including necessary tool installations, system requirements, and environment verification methods.

System Requirements

Supported Operating Systems

Operating SystemSupport StatusNotes
macOS (Intel / Apple Silicon)Fully supportedRecommended to use Homebrew for dependency installation
Ubuntu 20.04+ / Debian 11+Fully supportedRecommended to use apt for dependency installation
Windows 10+ (x86_64)Fully supportedRecommended to use MSYS2 or WSL2
Other Linux distributionsBasic supportNeed to install corresponding dependency packages yourself

Hardware Requirements

  • CPU: Dual-core or higher, supporting march=native compilation optimization
  • Memory: At least 4GB RAM (8GB or more recommended)
  • Disk space: At least 2GB available space (including dependencies and build artifacts)
  • Display: Supports OpenGL 2.0 or higher (for simulator GUI display)

Required Tools

Compiler Toolchain

ToolMinimum VersionPurpose
CMake3.10Build system configuration
C compiler (GCC/Clang)C99 standard supportC code compilation
C++ compilerC++17 standard supportSome component compilation
Make / Ninja-Build execution

SDL2

The simulator uses SDL2 for window display and input handling, which is a required dependency for the simulator to run.

Python 3.10

ElenixOS uses Python scripts to assist the development process, including API binding generation and other tasks.

Environment Setup Steps

macOS

Use Homebrew to install required dependencies:

# Install CMake
brew install cmake

# Install SDL2
brew install sdl2

# Install Python 3.10 (if not already installed)
brew install python@3.10

# Verify installation
cmake --version
sdl2-config --version
python3.10 --version

Ubuntu / Debian

Use apt to install required dependencies:

# Update package index
sudo apt update

# Install CMake
sudo apt install cmake

# Install SDL2 development library
sudo apt install libsdl2-dev

# Install Python 3.10
sudo apt install python3.10 python3.10-venv

# Install build tools
sudo apt install build-essential

# Verify installation
cmake --version
sdl2-config --version
python3.10 --version

Windows (MSYS2)

Use MSYS2 to install required dependencies:

# Update package database
pacman -Sy

# Install CMake
pacman -S mingw-w64-x86_64-cmake

# Install SDL2
pacman -S mingw-w64-x86_64-SDL2

# Install GCC toolchain
pacman -S mingw-w64-x86_64-toolchain

# Install Python 3.10
pacman -S mingw-w64-x86_64-python3.10

# Install Make
pacman -S make

Windows (WSL2)

In the WSL2 Ubuntu environment, follow the Ubuntu steps above. If you need to use the native Windows GUI, additional configuration is required:

# Install necessary graphics libraries for WSL2
sudo apt install libx11-dev libxext-dev libxrender-dev libxrandr-dev libxcursor-dev

# Install freetype development library (optional, for font rendering)
sudo apt install libfreetype6-dev

Verify Environment

Check CMake

cmake --version

Output should include version information, such as cmake version 3.10.0 or higher.

Check SDL2

sdl2-config --version

Output should be the SDL2 version number, such as 2.0.20.

Check Compiler

gcc --version
# or
clang --version

Ensure the compiler supports C99 standard.

Check Python

python3.10 --version

Output should be Python 3.10.x.

Get Code

# Clone simulator repository (with submodules)
git clone --recursive https://github.com/ElenixOS/ElenixOS-Simulator.git
cd ElenixOS-Simulator

# If already cloned but submodules not pulled
git submodule update --init --recursive

The repository contains the following main components:

DirectoryDescription
ElenixOS/ElenixOS core source code
lvgl/LVGL graphics library
FreeRTOS/FreeRTOS real-time kernel (optional)
lv_drivers/LVGL display and input drivers
main/Simulator main program
config/FreeRTOS configuration
fs/File system simulation directory

Optional Dependencies

FreeRTOS

To enable FreeRTOS support in the simulator, no additional dependencies are needed as the project already includes FreeRTOS source code.

LVGL Extended Features

Some advanced LVGL features require additional library support:

FeatureDependency LibraryCMake Option
SDL rendering accelerationSDL2LV_USE_DRAW_SDL=ON
PNG decodinglibpngLV_USE_LIBPNG=ON
JPEG decodinglibjpeg-turboLV_USE_LIBJPEG_TURBO=ON
Video playbackFFmpegLV_USE_FFMPEG=ON
Font renderingfreetypeLV_USE_FREETYPE=ON

Common Issues

CMake Cannot Find SDL2

Ensure SDL2 development library is correctly installed and sdl2-config is in PATH. If still not found, manually specify SDL2 path:

cmake -DSDL2_DIR=/path/to/sdl2 ..

Compilation Error with march=native

If the compiler does not support march=native optimization flag, disable it in CMake configuration:

cmake -DCMAKE_C_FLAGS="-march=x86-64" ..

Python Script Execution Failure

ElenixOS-Tools.py requires Python 3.10. If multiple Python versions are installed on the system, ensure 3.10 is the default version or use it in a virtual environment.