├── install.sh ├── Dockerfile ├── README.md └── LICENSE /install.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | IMAGE_NAME=lpodkalicki/stm32-toolchain 4 | TOOLCHAIN_SCRIPT=stm32-toolchain 5 | 6 | docker pull ${IMAGE_NAME}:latest 7 | 8 | cat < /tmp/${TOOLCHAIN_SCRIPT}.tmp 9 | #!/bin/bash 10 | 11 | docker run --rm --privileged -v \$(pwd):/build ${IMAGE_NAME} "\$@" 12 | EOF 13 | 14 | chmod ugo+x /tmp/${TOOLCHAIN_SCRIPT}.tmp 15 | sudo mv /tmp/${TOOLCHAIN_SCRIPT}.tmp /usr/bin/${TOOLCHAIN_SCRIPT} 16 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM alpine:3.14 2 | 3 | MAINTAINER Lukasz Marcin Podkalicki 4 | 5 | # Prepare directory for tools 6 | ARG TOOLS_PATH=/tools 7 | RUN mkdir ${TOOLS_PATH} 8 | WORKDIR ${TOOLS_PATH} 9 | 10 | # Install basic programs and custom glibc 11 | ARG GLIBC_VERSION=2.33-r0 12 | ARG GLIBC_APK_NAME=glibc-${GLIBC_VERSION}.apk 13 | ARG GLIBC_APK_DOWNLOAD_URL=https://github.com/sgerrand/alpine-pkg-glibc/releases/download/${GLIBC_VERSION}/${GLIBC_APK_NAME} 14 | RUN apk --no-cache add ca-certificates wget make cmake stlink \ 15 | && wget -q -O /etc/apk/keys/sgerrand.rsa.pub https://alpine-pkgs.sgerrand.com/sgerrand.rsa.pub \ 16 | && wget ${GLIBC_APK_DOWNLOAD_URL} \ 17 | && apk add ${GLIBC_APK_NAME} \ 18 | && rm ${GLIBC_APK_NAME} 19 | 20 | # Install STM32 toolchain 21 | # https://developer.arm.com/tools-and-software/open-source-software/developer-tools/gnu-toolchain/gnu-rm/downloads 22 | ARG TOOLCHAIN_TARBALL_URL="https://developer.arm.com/-/media/Files/downloads/gnu-rm/10-2020q4/gcc-arm-none-eabi-10-2020-q4-major-x86_64-linux.tar.bz2" 23 | ARG TOOLCHAIN_PATH=${TOOLS_PATH}/toolchain 24 | RUN wget ${TOOLCHAIN_TARBALL_URL} \ 25 | && export TOOLCHAIN_TARBALL_FILENAME=$(basename "${TOOLCHAIN_TARBALL_URL}") \ 26 | && tar -xvf ${TOOLCHAIN_TARBALL_FILENAME} \ 27 | && mv $(dirname `tar -tf ${TOOLCHAIN_TARBALL_FILENAME} | head -1`) ${TOOLCHAIN_PATH} \ 28 | && rm -rf ${TOOLCHAIN_PATH}/share/doc \ 29 | && rm ${TOOLCHAIN_TARBALL_FILENAME} 30 | 31 | ENV PATH="${TOOLCHAIN_PATH}/bin:${PATH}" 32 | 33 | # Change workdir 34 | WORKDIR /build 35 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Overview 2 | 3 | Lightweight docker image built on top of **alpine** with installed ARM-none-eabi toolchain and few additional tools: 4 | * ARM-none-eabi toolchain 5 | * stlink 6 | * make 7 | * cmake 8 | 9 | DockerHub: https://hub.docker.com/r/lpodkalicki/stm32-toolchain 10 | 11 | ## Building image locally 12 | 13 | ```bash 14 | git clone git@github.com:lpodkalicki/stm32-toolchain-docker.git 15 | cd stm32-toolchain 16 | docker build --rm -t lpodkalicki/stm32-toolchain:latest . 17 | ``` 18 | 19 | ## An example of running toolchain binary 20 | 21 | ```bash 22 | docker run --rm --privileged -v $(pwd):/build lpodkalicki/stm32-toolchain arm-none-eabi-cpp --version 23 | ``` 24 | 25 | # Installing 26 | 27 | Bellow you can find recommended simple one-line installer that pulls the newest docker-image and installs **stm32-toolchain** script into "/usr/bin/" directory. 28 | 29 | ```bash 30 | curl https://raw.githubusercontent.com/lpodkalicki/stm32-toolchain-docker/master/install.sh | bash -s -- 31 | ``` 32 | 33 | ## Getting started 34 | 35 | 1. Install toolchain using recommended simple one-line installer. 36 | 2. Use super command **stm32-toolchain** for all toolchain binaries. 37 | 3. Execute toolchain binaries inside your working/project directory. 38 | 39 | ## Examples 40 | 41 | ```bash 42 | $ cd your-project/ 43 | $ stm32-toolchain arm-none-eabi-cpp --version 44 | $ stm32-toolchain st-flash --version 45 | $ stm32-toolchain make -version 46 | $ stm32-toolchain cmake -version 47 | $ stm32-toolchain cmake -Bbuild . 48 | $ stm32-toolchain make --directory build 49 | ``` 50 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | BSD 3-Clause License 2 | 3 | Copyright (c) 2019, Łukasz Podkalicki 4 | All rights reserved. 5 | 6 | Redistribution and use in source and binary forms, with or without 7 | modification, are permitted provided that the following conditions are met: 8 | 9 | 1. Redistributions of source code must retain the above copyright notice, this 10 | list of conditions and the following disclaimer. 11 | 12 | 2. Redistributions in binary form must reproduce the above copyright notice, 13 | this list of conditions and the following disclaimer in the documentation 14 | and/or other materials provided with the distribution. 15 | 16 | 3. Neither the name of the copyright holder nor the names of its 17 | contributors may be used to endorse or promote products derived from 18 | this software without specific prior written permission. 19 | 20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 21 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 22 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 23 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 24 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 25 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 26 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 27 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 28 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 29 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | --------------------------------------------------------------------------------