-
-
Notifications
You must be signed in to change notification settings - Fork 176
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
Showing
1,191 changed files
with
30,120 additions
and
22,879 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,113 @@ | ||
FROM debian:10.4-slim AS downloader | ||
RUN apt-get update \ | ||
&& apt-get -y install --no-install-recommends apt-utils \ | ||
&& apt-get install -y \ | ||
curl \ | ||
bzip2 \ | ||
unzip | ||
|
||
ARG GCC_URI=https://armkeil.blob.core.windows.net/developer/Files/downloads/gnu-rm/10-2020q4/gcc-arm-none-eabi-10-2020-q4-major-x86_64-linux.tar.bz2 | ||
RUN mkdir -p /tmp/dc-downloads /tmp/dc-extracted/gcc /tmp/dc-extracted/cmake \ | ||
&& curl -o /tmp/dc-downloads/gcc-arm.tar.bz2 $GCC_URI \ | ||
&& bunzip2 -d /tmp/dc-downloads/gcc-arm.tar.bz2 \ | ||
&& tar -xvf /tmp/dc-downloads/gcc-arm.tar -C /tmp/dc-extracted/gcc --strip-components 1 | ||
|
||
ARG CMAKE_SCRIPT=https://cmake.org/files/v3.19/cmake-3.19.0-Linux-x86_64.sh | ||
RUN curl -o /tmp/dc-downloads/cmake.sh $CMAKE_SCRIPT \ | ||
&& chmod +x /tmp/dc-downloads/cmake.sh \ | ||
&& bash /tmp/dc-downloads/cmake.sh --skip-license --prefix=/tmp/dc-extracted/cmake | ||
|
||
ARG IDF_URI=https://dl.espressif.com/dl/esp-idf/releases/esp-idf-v3.3.1.zip | ||
RUN curl -o /tmp/dc-downloads/esp-idf.zip $IDF_URI \ | ||
&& unzip -d /tmp/dc-extracted/esp-idf /tmp/dc-downloads/esp-idf.zip | ||
|
||
ARG IDF_LIBS_URI=https://dl.cloudsmith.io/public/net-nanoframework/internal-build-tools/raw/names/IDF_libs/versions/v3.3.1/IDF_libs-v3.3.1.zip | ||
RUN curl -o /tmp/dc-downloads/esp-idf-libs.zip $IDF_LIBS_URI -L \ | ||
&& unzip -d /tmp/dc-extracted/esp-idf-libs /tmp/dc-downloads/esp-idf-libs.zip | ||
|
||
ARG XTENSA_URI=https://dl.espressif.com/dl/xtensa-esp32-elf-linux64-1.22.0-80-g6c4433a-5.2.0.tar.gz | ||
RUN mkdir -p /tmp/dc-extracted/xtensa \ | ||
&& curl -o /tmp/dc-downloads/xtensa.tar.gz $XTENSA_URI \ | ||
&& tar -xzf /tmp/dc-downloads/xtensa.tar.gz -C /tmp/dc-extracted/xtensa --strip-components 1 | ||
|
||
ARG TI_TOOL_URL=http://software-dl.ti.com/dsps/dsps_public_sw/sdo_sb/targetcontent/rtsc/3_61_00_16/exports/xdccore/xdctools_3_61_00_16_core_linux.zip | ||
RUN mkdir -p /tmp/dc-extracted/titools \ | ||
&& curl -o /tmp/dc-downloads/titools.zip $TI_TOOL_URL -L \ | ||
&& unzip -d /tmp/dc-extracted/titools /tmp/dc-downloads/titools.zip | ||
|
||
FROM debian:10.4-slim AS devcontainer | ||
|
||
# Avoid warnings by switching to noninteractive | ||
ENV DEBIAN_FRONTEND=noninteractive | ||
|
||
# You can set up non-root user | ||
# ARG USERNAME=vscode | ||
# ARG USER_UID=1000 | ||
# ARG USER_GID=$USER_UID | ||
|
||
# Configure apt and install packages | ||
RUN apt-get update \ | ||
&& apt-get -y install --no-install-recommends apt-utils dialog icu-devtools 2>&1 \ | ||
&& apt-get install -y \ | ||
git \ | ||
curl \ | ||
ninja-build \ | ||
srecord \ | ||
python3 \ | ||
python3-pip \ | ||
nodejs | ||
|
||
# Create needed directories | ||
RUN mkdir -p /usr/local/bin/gcc \ | ||
&& mkdir -p /usr/local/bin/xtensa \ | ||
&& mkdir -p /usr/local/bin/titools | ||
|
||
# Clone repos for STM32 including AzureRTOS | ||
RUN git clone --branch nf-build https://github.com/nanoframework/STM32CubeL4.git ./sources/STM32CubeL4 \ | ||
&& git clone --branch nf-build https://github.com/nanoframework/STM32CubeF7.git ./sources/STM32CubeF7 \ | ||
&& git clone --branch nf-build https://github.com/nanoframework/STM32CubeF4.git ./sources/STM32CubeF4 \ | ||
&& git clone --branch nf-build https://github.com/nanoframework/STM32CubeH7.git ./sources/STM32CubeH7 \ | ||
&& git clone --recursive https://github.com/azure-rtos/threadx.git ./sources/AzureRTOS \ | ||
&& git clone --branch stable_20.3.x https://github.com/nanoframework/chibios.git ./sources/ChibiOs \ | ||
&& git clone --branch nanoframework https://github.com/nanoframework/ChibiOS-Contrib.git ./sources/ChibiOs-Contrib | ||
# Clone mbedtls and fatfs | ||
RUN git clone --branch mbedtls-2.23.0 https://github.com/nanoframework/mbedtls.git ./sources/mbedtls \ | ||
&& git clone --branch R0.14 https://github.com/abbrev/fatfs.git ./sources/fatfs | ||
# Clone FreeRTOS and what is needed for ESP32 | ||
RUN git clone --branch V10.4.1-kernel-only https://github.com/FreeRTOS/FreeRTOS-Kernel.git ./sources/FreeRTOS \ | ||
&& git clone --branch 5.5.1 https://github.com/ARM-software/CMSIS_5.git ./sources/CMSIS_5 \ | ||
&& git clone --branch STABLE-2_0_3_RELEASE https://git.savannah.nongnu.org/git/lwip.git ./sources/lwip \ | ||
&& git clone --branch nf-build https://github.com/nanoframework/spiffs.git ./sources/spiffs | ||
# Clone what is needed for TI | ||
RUN git clone --branch 4.10.00.07 https://github.com/nanoframework/SimpleLink_CC32xx_SDK.git ./sources/SimpleLinkCC32 \ | ||
# && git clone --branch 3.61.00.16 https://github.com/nanoframework/TI_XDCTools.git ./sources/TI_XDCTools \ | ||
&& git clone --branch 4.20.01.04 https://github.com/nanoframework/SimpleLink_CC13x2_26x2_SDK.git ./sources/SimpleLinkCC13 \ | ||
&& git clone --branch 1.5.0 https://github.com/nanoframework/TI_SysConfig.git ./sources/TI_SysConfig \ | ||
&& chmod +x ./sources/TI_SysConfig/sysconfig_cli.sh | ||
|
||
# Copy from our other container | ||
COPY --from=downloader /tmp/dc-extracted/gcc /usr/local/bin/gcc | ||
COPY --from=downloader /tmp/dc-extracted/cmake /usr | ||
COPY --from=downloader /tmp/dc-extracted/esp-idf /sources/esp-idf | ||
COPY --from=downloader /tmp/dc-extracted/esp-idf-libs /sources/esp-idf-libs | ||
COPY --from=downloader /tmp/dc-extracted/xtensa /usr/local/bin/xtensa | ||
COPY --from=downloader /tmp/dc-extracted/titools/xdctools_3_61_00_16_core /usr/local/bin/titools | ||
COPY ./scripts/git-pull-repos.sh /usr/local/git-pull-repos.sh | ||
|
||
# Putting hex2dfu in the container | ||
ARG HEX2DFU=https://github.com/nanoframework/hex2dfu/releases/download/v2.0.9/hex2dfu | ||
RUN mkdir -p /usr/local/bin/hex2dfu \ | ||
&& curl -o /usr/local/bin/hex2dfu/hex2dfu $HEX2DFU -L \ | ||
&& chmod +x /usr/local/bin/hex2dfu/hex2dfu | ||
|
||
# Creating static link python for pyhton3 | ||
RUN ln -fs /usr/bin/python3 /usr/bin/python \ | ||
&& pip3 install pyserial | ||
|
||
# Clean up downloaded files | ||
RUN apt-get autoremove -y \ | ||
&& apt-get clean -y \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
# Switch back to dialog for any ad-hoc use of apt-get | ||
ENV DEBIAN_FRONTEND=dialog |
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,40 @@ | ||
{ | ||
"name": "nanoFramework", | ||
"dockerFile": "Dockerfile", | ||
"context": ".", | ||
"mounts": [ | ||
"source=/var/run/docker.sock,target=/var/run/docker.sock,type=bind", | ||
// Mount .azure folder for seamless az cli auth | ||
"source=${env:HOME}${env:USERPROFILE}/.azure,target=/home/vscode/.azure,type=bind", | ||
// Keep command history | ||
"source=nano-bashhistory,target=/home/vscode/commandhistory,type=volume", | ||
], | ||
// Set *default* container specific settings.json values on container create. | ||
"settings": { | ||
"cmake.preferredGenerators": [ | ||
"Ninja" | ||
], | ||
"cmake.generator": "Ninja", | ||
"cmake.autoRestartBuild" : true, | ||
"cmake.configureSettings": { | ||
"CMAKE_MAKE_PROGRAM":"/usr/bin/ninja" | ||
}, | ||
"cmake.cmakePath": "/usr/bin/cmake", | ||
"cmake.configureOnOpen": false | ||
}, | ||
// Add the IDs of extensions you want installed when the container is created. | ||
"extensions": [ | ||
"ms-vsliveshare.vsliveshare-pack", | ||
"streetsidesoftware.code-spell-checker", | ||
"twxs.cmake", | ||
"ms-vscode.cmake-tools" | ||
], | ||
// Make sure we pull all the repos with the latest changes | ||
"postAttachCommand": "/usr/local/git-pull-repos.sh" | ||
// Use 'forwardPorts' to make a list of ports inside the container available locally. | ||
// "forwardPorts": [], | ||
// Use 'postCreateCommand' to run commands after the container is created. | ||
// "postCreateCommand": "terraform --version", | ||
// Uncomment to connect as a non-root user. See https: //aka.ms/vscode-remote/containers/non-root. | ||
// ,"remoteUser": "vscode" | ||
} |
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,34 @@ | ||
echo "Pulling all the repos" | ||
cd /sources/STM32CubeL4 | ||
git pull origin nf-build | ||
cd /sources/STM32CubeF7 | ||
git pull origin nf-build | ||
cd /sources/STM32CubeF4 | ||
git pull origin nf-build | ||
cd /sources/STM32CubeH7 | ||
git pull origin nf-build | ||
cd /sources/AzureRTOS | ||
git pull | ||
cd /sources/ChibiOs | ||
git pull origin stable_20.3.x | ||
cd /sources/ChibiOs-Contrib | ||
git pull origin nanoframework | ||
cd /sources/mbedtls | ||
git pull origin mbedtls-2.23.0 | ||
cd /sources/fatfs | ||
git pull origin R0.14 | ||
cd /sources/FreeRTOS | ||
git pull origin V10.4.1-kernel-only | ||
cd /sources/CMSIS_5 | ||
git pull origin 5.5.1 | ||
cd /sources/lwip | ||
git pull origin STABLE-2_0_3_RELEASE | ||
cd /sources/spiffs | ||
git pull origin nf-build | ||
cd /sources/SimpleLinkCC32 | ||
git pull origin 4.10.00.07 | ||
cd /sources/SimpleLinkCC13 | ||
git pull origin 4.20.01.04 | ||
cd /sources/TI_SysConfig | ||
git pull origin 1.5.0 | ||
echo "All repos pulled and up to date" |
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,67 @@ | ||
# usage: non-root-user.sh [username] [user UID] [user GID] | ||
|
||
USERNAME=${1:-"automatic"} | ||
USER_UID=${2:-"automatic"} | ||
USER_GID=${3:-"automatic"} | ||
|
||
set -e | ||
|
||
if [ "$(id -u)" -ne 0 ]; then | ||
echo -e 'Script must be run as root. Use sudo, su, or add "USER root" to your Dockerfile before running this script.' | ||
exit 1 | ||
fi | ||
|
||
|
||
# If in automatic mode, determine if a user already exists, if not use vscode | ||
if [ "${USERNAME}" = "auto" ] || [ "${USERNAME}" = "automatic" ]; then | ||
USERNAME="" | ||
POSSIBLE_USERS=("vscode" "node" "codespace" "$(awk -v val=1000 -F ":" '$3==val{print $1}' /etc/passwd)") | ||
for CURRENT_USER in ${POSSIBLE_USERS[@]}; do | ||
if id -u ${CURRENT_USER} > /dev/null 2>&1; then | ||
USERNAME=${CURRENT_USER} | ||
break | ||
fi | ||
done | ||
if [ "${USERNAME}" = "" ]; then | ||
USERNAME=vscode | ||
fi | ||
elif [ "${USERNAME}" = "none" ]; then | ||
USERNAME=root | ||
USER_UID=0 | ||
USER_GID=0 | ||
fi | ||
|
||
|
||
|
||
|
||
# Create or update a non-root user to match UID/GID. | ||
if id -u ${USERNAME} > /dev/null 2>&1; then | ||
# User exists, update if needed | ||
if [ "${USER_GID}" != "automatic" ] && [ "$USER_GID" != "$(id -G $USERNAME)" ]; then | ||
groupmod --gid $USER_GID $USERNAME | ||
usermod --gid $USER_GID $USERNAME | ||
fi | ||
if [ "${USER_UID}" != "automatic" ] && [ "$USER_UID" != "$(id -u $USERNAME)" ]; then | ||
usermod --uid $USER_UID $USERNAME | ||
fi | ||
else | ||
# Create user | ||
if [ "${USER_GID}" = "automatic" ]; then | ||
groupadd $USERNAME | ||
else | ||
groupadd --gid $USER_GID $USERNAME | ||
fi | ||
if [ "${USER_UID}" = "automatic" ]; then | ||
useradd -s /bin/bash --gid $USERNAME -m $USERNAME | ||
else | ||
useradd -s /bin/bash --uid $USER_UID --gid $USERNAME -m $USERNAME | ||
fi | ||
fi | ||
|
||
# Add add sudo support for non-root user | ||
if [ "${USERNAME}" != "root" ] && [ "${EXISTING_NON_ROOT_USER}" != "${USERNAME}" ]; then | ||
mkdir -p /etc/sudoers.d | ||
echo $USERNAME ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME | ||
chmod 0440 /etc/sudoers.d/$USERNAME | ||
EXISTING_NON_ROOT_USER="${USERNAME}" | ||
fi |
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
Oops, something went wrong.