-
Notifications
You must be signed in to change notification settings - Fork 51
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3703994
commit 2ca13b4
Showing
4 changed files
with
114 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# A minimal dockerfile to provide a build environment to compile the JLed | ||
# raspberry pi pico JLed in a docker container. | ||
FROM ubuntu:20.04 | ||
|
||
LABEL MAINTAINER "Jan Delgado <jdelgado@gmx.net>" | ||
|
||
ARG TZ=Europe/Berlin | ||
ENV DEBIAN_FRONTEND=noninteractive | ||
|
||
RUN echo ${TZ} > /etc/timezone && rm -f /etc/localtime \ | ||
&& cat /etc/timezone\ | ||
&& apt-get update \ | ||
&& apt-get install -y git cmake gcc-arm-none-eabi libnewlib-arm-none-eabi \ | ||
build-essential vim python3 python3-pip | ||
|
||
RUN mkdir /pico | ||
WORKDIR /pico | ||
|
||
# install SDK | ||
RUN git clone --depth=1 -b master https://github.com/raspberrypi/pico-sdk.git \ | ||
&& cd pico-sdk && git submodule update --init | ||
|
||
ENV PICO_SDK_PATH=/pico/pico-sdk | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
#!/bin/bash | ||
# build the raspberry pi pico JLed example using a docker container. | ||
# Run "./build.sh docker-image" first to build the docker-image, | ||
# then run "./build.sh compile" to compile the example. | ||
# | ||
# Jan Delgado 02/2021 | ||
set -eou pipefail | ||
|
||
usage() { | ||
echo "$0: <docker-image|compile|shell|clean>" | ||
} | ||
|
||
build_image() { | ||
docker build \ | ||
--build-arg="TZ=$(timedatectl show -p Timezone --value)" \ | ||
-t picosdk:latest . | ||
} | ||
|
||
run_cmd() { | ||
docker run -ti --rm \ | ||
--user="$(id -u):$(id -g)" \ | ||
-v "$(pwd)/../..:/src:z" \ | ||
picosdk:latest "$@" | ||
} | ||
|
||
main() { | ||
case $action in | ||
docker-image) build_image ;; | ||
compile) | ||
run_cmd sh -c "cd /src/examples/raspi_pico && cmake . && make" | ||
local -r line=$(printf '=%.0s' {1..75}) | ||
echo "$line" | ||
echo "BUILD SUCCESSFUL." | ||
echo "Now upload the file pico_demo.uf2 to your Pico manually." | ||
echo "$line" | ||
;; | ||
shell) run_cmd bash ;; | ||
clean) git clean -d -x -f ;; | ||
*) usage ;; | ||
esac | ||
} | ||
|
||
action=${1:-""} | ||
main action | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters