Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: docker script to build firmwares for testing #55

Merged
merged 2 commits into from
Jan 29, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 39 additions & 0 deletions firmwares/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
ARG IMAGE=ubuntu:22.04
FROM ${IMAGE} AS builder

# Install dependencies
RUN apt-get update && \
export DEBIAN_FRONTEND=noninteractive && \
apt-get install -y \
build-essential \
gcc-arm-none-eabi \
cmake \
git \
python3 \
python3-pip \
ninja-build && \
apt-get clean && \
rm -rf /var/lib/apt/lists/* && \
update-alternatives --install /usr/bin/python python /usr/bin/python3 1

SHELL [ "/bin/bash", "-o", "pipefail", "-c" ]

WORKDIR /firmware
COPY . /firmware

RUN git clone --depth=1 --recursive https://github.com/IRNAS/pulseox-firmware.git && \
cd pulseox-firmware && \
patch -s -p1 < ../pulseox-firmware-patch.diff && \
cmake -S . -B build -DCMAKE_TOOLCHAIN_FILE=cmake/toolchains/arm-none-eabi.cmake && \
cmake --build build -j$(nproc)

WORKDIR /firmware

RUN git clone --depth=1 --recursive https://github.com/CodethinkLabs/bloodlight-firmware.git && \
cd bloodlight-firmware && \
make -C firmware/libopencm3 && \
make -C firmware -j$(nproc)

FROM ${IMAGE}
COPY --from=builder /firmware/pulseox-firmware/build/src/firmware.elf /output/pulseox-firmware.elf
COPY --from=builder /firmware/bloodlight-firmware/firmware/bloodlight-firmware.elf /output/bloodlight-firmware.elf
10 changes: 10 additions & 0 deletions firmwares/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/bash

set -e

script_dir=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
docker build -t firmware-builder ${script_dir}
docker create --name firmware-builder firmware-builder
docker cp firmware-builder:/output/pulseox-firmware.elf pulseox-firmware.elf
docker cp firmware-builder:/output/bloodlight-firmware.elf bloodlight-firmware.elf
docker rm firmware-builder
26 changes: 26 additions & 0 deletions firmwares/pulseox-firmware-patch.diff
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
diff --git a/ld/stm32f030f4p6.ld b/ld/stm32f030f4p6.ld
index 554697c..d4d1378 100644
--- a/ld/stm32f030f4p6.ld
+++ b/ld/stm32f030f4p6.ld
@@ -1,6 +1,6 @@
MEMORY
{
- rom (rx) : ORIGIN = 0x08000000, LENGTH = 16K
+ rom (rx) : ORIGIN = 0x08000000, LENGTH = 32K
ram (xrw) : ORIGIN = 0x20000000, LENGTH = 4K
}

Submodule libopencm3 contains modified content
diff --git a/libopencm3/Makefile b/libopencm3/Makefile
index ea51f6d9..2cc5b536 100644
--- a/libopencm3/Makefile
+++ b/libopencm3/Makefile
@@ -25,7 +25,7 @@ STYLECHECKFLAGS := --no-tree -f --terse --mailback

space:=
space+=
-SRCLIBDIR:= $(subst $(space),\$(space),$(realpath lib))
+SRCLIBDIR:= $(subst $(space),$(space),$(realpath lib))

TARGETS := stm32/f0 stm32/f1 stm32/f2 stm32/f3 stm32/f4 stm32/f7
TARGETS += stm32/l0 stm32/l1 stm32/l4