Skip to content

Commit

Permalink
test: script to build devices firmwares
Browse files Browse the repository at this point in the history
  • Loading branch information
kumarak committed Jan 27, 2025
1 parent 496874b commit 392d558
Show file tree
Hide file tree
Showing 3 changed files with 80 additions and 0 deletions.
44 changes: 44 additions & 0 deletions firmwares/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
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 https://github.com/IRNAS/pulseox-firmware.git && \
cd /firmware/pulseox-firmware && \
git submodule init && \
git submodule update && \
patch -s -p1 < ../pulseox-firmware-patch.diff && \
mkdir -p build && cd build && \
cmake -DCMAKE_TOOLCHAIN_FILE=../cmake/toolchains/arm-none-eabi.cmake .. && \
make

WORKDIR /firmware

RUN git clone https://github.com/CodethinkLabs/bloodlight-firmware.git && \
cd /firmware/bloodlight-firmware && \
git submodule init && \
git submodule update && \
make -C firmware/libopencm3 && \
make -C firmware

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

0 comments on commit 392d558

Please sign in to comment.