container: build of container and rust moved to esp-rs/rust-build

This commit is contained in:
Juraj Michalek 2021-10-12 15:34:53 +02:00
parent 60e0353c17
commit fc7d7026e9
11 changed files with 0 additions and 252 deletions

View File

@ -1,22 +0,0 @@
name: Publish idf-rust-examples image on DockerHub
on: workflow_dispatch
jobs:
push_to_registry:
name: Push Docker image to Docker Hub
runs-on: ubuntu-latest
steps:
- name: Check out the repo
uses: actions/checkout@v2
- name: Log in to Docker Hub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_TOKEN }}
- name: Push to Docker Hub
uses: docker/build-push-action@v2
with:
context: .
push: true
tags: espressif/idf-rust-examples:latest

View File

@ -1,22 +0,0 @@
name: Publish idf-rust image on DockerHub
on: workflow_dispatch
jobs:
push_to_registry:
name: Push Docker image to Docker Hub
runs-on: ubuntu-latest
steps:
- name: Check out the repo
uses: actions/checkout@v2
- name: Log in to Docker Hub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_TOKEN }}
- name: Push to Docker Hub
uses: docker/build-push-action@v2
with:
context: support/idf-rust
push: true
tags: espressif/idf-rust:latest

View File

@ -1,19 +0,0 @@
# Support files
## Rust
The directory `rust` contains Dockerfile to build custom version of rust compiler with enabled Xtensa support.
### Usage
Building and starting container:
```
cd support/rust
docker build -t rust-xtensa:bionic -f Dockerfile .
docker run --rm --name rust-xtensa -it rust-xtensa:bionic /bin/bash
```
Copy Rust dist file from running container:
```
docker cp rust-xtensa /opt/rust/build/dist/rust-dev-1.50.0-dev-x86_64-unknown-linux-gnu.tar.xz rust-1.50.0-dev-x86_64-unknown-linux-gnu-bionic.tar.xz
```

View File

@ -1,16 +0,0 @@
$Command = "esptool.exe"
if (Test-Path -Path ".\esptool-v3.1-win64\esptool-v3.1-win64\esptool.exe" -PathType Leaf) {
$Command = ".\esptool-v3.1-win64\esptool-v3.1-win64\esptool.exe"
}
$OldPreference = $ErrorActionPreference
$ErrorActionPreference = 'stop'
try {if(Get-Command $Command){"$Command exists"}}
Catch {
"$Command not found. Downloading"
Invoke-WebRequest https://github.com/espressif/esptool/releases/download/v3.1/esptool-v3.1-win64.zip -OutFile esptool-v3.1-win64.zip
Expand-Archive -Path esptool-v3.1-win64.zip
$Command = ".\esptool-v3.1-win64\esptool-v3.1-win64\esptool.exe"
$ErrorActionPreference=$OldPreference
}
&$Command -b 460800 --before default_reset --after hard_reset --chip esp32 write_flash --flash_mode dio --flash_size detect --flash_freq 40m 0x1000 bootloader.bin 0x8000 partition-table.bin 0x10000 esp32-hello-rust.bin

View File

@ -1,7 +0,0 @@
#!/usr/bin/env bash
set -e
. $IDF_PATH/export.sh
cat /etc/motd
exec "$@"

View File

@ -1,20 +0,0 @@
==============================================================================
= Docker image with ESP-IDF, Rust compiler and examples =
= https://github.com/espressif/rust-esp32-example =
==============================================================================
Available examples:
* "cargo-first" approach
```sh
cd /opt/rust-esp32-std-hello
cargo build --release
espflash /dev/ttyUSB0 target/xtensa-esp32-espidf/release/rust-esp32-std-hello
cargo pio espidf monitor -e release /dev/ttyUSB0
```
* "idf.py-first" approach - integration via CMake files
```sh
cd /opt/rust-esp32-example
idf.py build
```

View File

@ -1,33 +0,0 @@
FROM espressif/idf
ENV LC_ALL=C.UTF-8
ENV LANG=C.UTF-8
ENV RUSTUP_HOME=/opt/rust
ENV CARGO_HOME=/opt/cargo
ENV PATH=/opt/cargo/bin:/opt/rust/bin:/opt/xtensa-esp32-elf-clang/bin:$PATH
ARG VERSION="1.54.0-dev"
ARG ARCH="x86_64-unknown-linux-gnu"
ARG RUST_DIST="rust-${VERSION}-${ARCH}"
ARG RUST_SRC_DIST="rust-src-${VERSION}"
ARG TOOLCHAIN_DESTINATION_DIR="/opt/esp"
RUN curl https://sh.rustup.rs -sSf | bash -s -- --profile minimal --default-toolchain nightly -y
WORKDIR /opt
#RUN wget -q https://dl.espressif.com/dl/idf-rust/dist/${ARCH}/${RUST_DIST}.tar.xz \
RUN wget -q https://github.com/georgik/idf-rust-build/releases/download/v${VERSION}/${RUST_DIST}.tar.xz \
&& tar xvf ${RUST_DIST}.tar.xz \
&& ./${RUST_DIST}/install.sh --destdir=${TOOLCHAIN_DESTINATION_DIR} --prefix="" --without=rust-docs \
&& rm -rf ${RUST_DIST} ${RUST_DIST}.tar.xz
RUN wget -q https://dl.espressif.com/dl/idf-rust/dist/noarch/${RUST_SRC_DIST}.tar.xz \
&& tar xvf ${RUST_SRC_DIST}.tar.xz \
&& ./${RUST_SRC_DIST}/install.sh --destdir=${TOOLCHAIN_DESTINATION_DIR} --prefix="" --without=rust-docs \
&& rm -rf ${RUST_SRC_DIST} ${RUST_SRC_DIST}.tar.xz \
&& rustup toolchain link esp /opt/esp \
&& rustup default esp
RUN wget -q https://dl.espressif.com/dl/idf-rust/dist/${ARCH}/xtensa-esp32-elf-llvm11_0_0-llvmorg-11-init-21249-g36dbc8b-linux-amd64.tar.xz \
&& tar xf xtensa-esp32-elf-llvm11_0_0-llvmorg-11-init-21249-g36dbc8b-linux-amd64.tar.xz \
&& rm xtensa-esp32-elf-llvm11_0_0-llvmorg-11-init-21249-g36dbc8b-linux-amd64.tar.xz

View File

@ -1,11 +0,0 @@
FROM ubuntu:bionic
WORKDIR /opt
RUN apt update \
&& apt install -y gcc cmake ccache ninja-build git python3 curl g++ pkg-config libssl-dev
RUN git clone https://github.com/espressif/llvm-project.git
ADD cmake/caches /opt/cmake/caches
RUN mkdir -p llvm-project/build \
&& cd llvm-project/build \
&& cmake -C /opt/cmake/caches/DistributionEspressif.cmake ../llvm -G "Ninja" -DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD="Xtensa" -DCMAKE_BUILD_TYPE=Release \
&& ninja stage2-distribution || echo "Build failed - silencing error to persist current build artifacts"

View File

@ -1,37 +0,0 @@
# This file sets up a CMakeCache for the second stage of a simple distribution
# bootstrap build.
#set(LLVM_ENABLE_PROJECTS "clang" CACHE STRING "")
set(LLVM_ENABLE_PROJECTS "clang;clang-tools-extra;lld" CACHE STRING "")
set(LLVM_ENABLE_RUNTIMES "" CACHE STRING "")
#set(LLVM_ENABLE_PROJECTS "clang;clang-tools-extra;lld" CACHE STRING "")
#set(LLVM_ENABLE_RUNTIMES "compiler-rt;libcxx;libcxxabi" CACHE STRING "")
set(LLVM_TARGETS_TO_BUILD X86;AArch64 CACHE STRING "")
#set(LLVM_TARGETS_TO_BUILD X86;ARM;AArch64 CACHE STRING "")
set(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING "")
set(CMAKE_C_FLAGS_RELWITHDEBINFO "-O3 -gline-tables-only -DNDEBUG" CACHE STRING "")
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O3 -gline-tables-only -DNDEBUG" CACHE STRING "")
# setup toolchain
set(LLVM_INSTALL_TOOLCHAIN_ONLY ON CACHE BOOL "")
set(LLVM_TOOLCHAIN_TOOLS
#dsymutil
#llvm-cov
#llvm-dwarfdump
#llvm-profdata
#llvm-objdump
#llvm-nm
#llvm-size
CACHE STRING "")
set(LLVM_DISTRIBUTION_COMPONENTS
clang
#LTO
#clang-format
#clang-resource-headers
#builtins
#runtimes
${LLVM_TOOLCHAIN_TOOLS}
CACHE STRING "")

View File

@ -1,55 +0,0 @@
# This file sets up a CMakeCache for a simple distribution bootstrap build.
#Enable LLVM projects and runtimes
#set(LLVM_ENABLE_PROJECTS "clang" CACHE STRING "")
set(LLVM_ENABLE_PROJECTS "clang;clang-tools-extra;lld" CACHE STRING "")
set(LLVM_ENABLE_RUNTIMES "compiler-rt" CACHE STRING "")
#set(LLVM_ENABLE_PROJECTS "clang;clang-tools-extra;lld" CACHE STRING "")
#set(LLVM_ENABLE_RUNTIMES "compiler-rt;libcxx;libcxxabi" CACHE STRING "")
# Only build the native target in stage1 since it is a throwaway build.
set(LLVM_TARGETS_TO_BUILD Native CACHE STRING "")
# Optimize the stage1 compiler, but don't LTO it because that wastes time.
set(CMAKE_BUILD_TYPE Release CACHE STRING "")
# Setup vendor-specific settings.
set(PACKAGE_VENDOR LLVM.org CACHE STRING "")
# Setting up the stage2 LTO option needs to be done on the stage1 build so that
# the proper LTO library dependencies can be connected.
set(BOOTSTRAP_LLVM_ENABLE_LTO OFF CACHE BOOL "")
#set(BOOTSTRAP_LLVM_ENABLE_LTO ON CACHE BOOL "")
if (NOT APPLE)
# Since LLVM_ENABLE_LTO is ON we need a LTO capable linker
#set(BOOTSTRAP_LLVM_ENABLE_LLD ON CACHE BOOL "")
set(BOOTSTRAP_LLVM_ENABLE_LLD OFF CACHE BOOL "")
endif()
# Expose stage2 targets through the stage1 build configuration.
set(CLANG_BOOTSTRAP_TARGETS
check-all
check-llvm
check-clang
llvm-config
test-suite
test-depends
llvm-test-depends
clang-test-depends
distribution
install-distribution
clang CACHE STRING "")
# Setup the bootstrap build.
set(CLANG_ENABLE_BOOTSTRAP ON CACHE BOOL "")
if(STAGE2_CACHE_FILE)
set(CLANG_BOOTSTRAP_CMAKE_ARGS
-C ${STAGE2_CACHE_FILE}
CACHE STRING "")
else()
set(CLANG_BOOTSTRAP_CMAKE_ARGS
-C ${CMAKE_CURRENT_LIST_DIR}/DistributionEspressif-stage2.cmake
CACHE STRING "")
endif()

View File

@ -1,10 +0,0 @@
FROM ubuntu:bionic
WORKDIR /opt
RUN apt update \
&& apt install -y gcc cmake ccache ninja-build git python3 curl g++ pkg-config libssl-dev
RUN git clone https://github.com/esp-rs/rust.git \
&& cd rust \
&& ./configure --experimental-targets=Xtensa --enable-extended --tools=rustfmt \
&& python3 x.py dist --stage 2 || echo "Build failed - silencing error to persist current build artifacts"