Skip to content

Instantly share code, notes, and snippets.

@gzigzigzeo
Created December 24, 2020 19:09
Show Gist options
  • Save gzigzigzeo/62c57efaad24060206907c17172f7666 to your computer and use it in GitHub Desktop.
Save gzigzigzeo/62c57efaad24060206907c17172f7666 to your computer and use it in GitHub Desktop.
Docker image which builds stm32-rs and modm-devices
#!/bin/bash
# Clone, generate and copy SVDs for STM32 family
git clone --depth 1 --branch $STM32RS_BRANCH $STM32RS_REPO
cd /root/stm32-rs/svd; ./extract.sh; cd ..; make patch -j; cd /root
mkdir -p /root/target/stm32-rs
cp /root/stm32-rs/svd/*svd* /root/target/stm32-rs
# Clone, generate and copy hardware description files for STM32 family
git clone --depth 1 --branch $MODM_BRANCH $MODM_REPO
cd modm-devices/tools/generator
make generate-stm32
mkdir -p /root/target/stm32-modm-devices
cp /root/modm-devices/devices/stm32/* /root/target/stm32-modm-devices
FROM python:alpine
# STM32-RS repository, may be overriden at runtime
ENV STM32RS_REPO https://github.com/stm32-rs/stm32-rs
ENV STM32RS_BRANCH master
# modm-devices repo & branch, may be overriden at runtime
ENV MODM_REPO https://github.com/modm-io/modm-devices.git
ENV MODM_BRANCH develop
# javac is required for stm32cube
ENV JAVA_HOME=/usr/lib/jvm/java-1.8-openjdk
ENV PATH="$JAVA_HOME/bin:${PATH}"
WORKDIR /root
ADD build.sh /root
RUN chmod +x build.sh
RUN apk update && apk add git bash make unzip build-base libxml2-dev libxslt-dev openjdk8
RUN pip install svdtools lxml jinja2 deepdiff CppHeaderParser
RUN mkdir /root/target
CMD /root/build.sh
#!/bin/sh
# Put all files to the same folder
# chmod +x run.sh && ./run.sh
# resulting files will reside at /tmp/output
mkdir -p /tmp/output && docker build . -t svd && docker run -v /tmp/output:/root/target -t svd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment