From efbad18275c52aec1d788d5f25a1986599be0cf7 Mon Sep 17 00:00:00 2001 From: Florian Asche Date: Thu, 5 Mar 2026 23:59:41 +0100 Subject: [PATCH] docs: add documentation for low power device setup and improve setup script (#206) --- docs/install_application.md | 10 ++++++++++ script/setup | 16 +++++++++------- 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/docs/install_application.md b/docs/install_application.md index 0642e8e..e2a3c85 100644 --- a/docs/install_application.md +++ b/docs/install_application.md @@ -170,6 +170,16 @@ Install the application: script/setup ``` +💡 **Note:** For hardware with limited performance (like Raspberry Pi Zero 2W or other SBCs), you may need to adjust compilation parameters to ensure the build process completes successfully. The script supports custom `CXXFLAGS` and `MAKEFLAGS`: + +- `--cxxflags`: Custom C++ compilation flags (default: `-O1 -g0`) +- `--makeflags`: Custom make flags (default: `-j1`) + +For example, to optimize for low-performance hardware: +``` sh +script/setup --cxxflags="-O1 -g0" --makeflags="-j1" +``` + Create a systemd service for the application: ``` sh diff --git a/script/setup b/script/setup index f9c58f1..eb20e85 100755 --- a/script/setup +++ b/script/setup @@ -20,6 +20,13 @@ builder = venv.EnvBuilder(with_pip=True) context = builder.ensure_directories(_VENV_DIR) builder.create(_VENV_DIR) +# Set environment variables +env = {} +if args.cxxflags: + env["CXXFLAGS"] = args.cxxflags +if args.makeflags: + env["MAKEFLAGS"] = args.makeflags + # Upgrade dependencies pip = [context.env_exe, "-m", "pip"] subprocess.check_call(pip + ["install", "--upgrade", "pip"]) @@ -28,14 +35,9 @@ subprocess.check_call(pip + ["install", "--upgrade", "setuptools", "wheel"]) # Install requirements subprocess.check_call(pip + ["install", "-e", str(_PROGRAM_DIR)]) + +# Install dev requirements if args.dev: - # Install dev requirements - env = {} - if args.cxxflags: - env["CXXFLAGS"] = args.cxxflags - if args.makeflags: - env["MAKEFLAGS"] = args.makeflags - subprocess.check_call( pip + ["install", "-e", f"{_PROGRAM_DIR}[dev]"], env={**dict(os.environ), **env}