Skip to content

Commit

Permalink
Merge #220
Browse files Browse the repository at this point in the history
220: Revert "Merge #116" r=aabadie a=kaspar030

It pains me a lot but the bad debian newlib package won't be fixed in time for the hard freeze, and neither will we sort out the issues with picolibc as default, in the week before x-mas. :(

This reverts commit 20529a8 (#116), reversing changes made to 604bc23.

Co-authored-by: Kaspar Schleiser <[email protected]>
  • Loading branch information
bors[bot] and kaspar030 authored Dec 19, 2022
2 parents 1539b4d + 6ad96fc commit 5efc102
Show file tree
Hide file tree
Showing 2 changed files with 68 additions and 19 deletions.
70 changes: 51 additions & 19 deletions riotbuild/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -66,20 +66,14 @@ RUN \
curl \
cython3 \
gcc-multilib \
gcc-arm-none-eabi \
libnewlib-arm-none-eabi \
libstdc++-arm-none-eabi-dev \
libstdc++-arm-none-eabi-newlib \
libstdc++-arm-none-eabi-picolibc \
gcc-riscv64-unknown-elf \
gcc-xtensa-lx106 \
gdb \
g++-multilib \
libffi-dev \
libpcre3 \
libtool \
libsdl2-dev:i386 \
m4 \
ninja-build \
parallel \
protobuf-compiler \
python2 \
Expand Down Expand Up @@ -135,6 +129,24 @@ RUN \
&& echo 'Cleaning up installation files' >&2 && \
apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* /pkgs

# Install ARM GNU embedded toolchain
# For updates, see https://developer.arm.com/open-source/gnu-toolchain/gnu-rm/downloads
ARG ARM_URLBASE=https://developer.arm.com/-/media/Files/downloads/gnu-rm
ARG ARM_URL=${ARM_URLBASE}/10.3-2021.10/gcc-arm-none-eabi-10.3-2021.10-x86_64-linux.tar.bz2
ARG ARM_MD5=2383e4eb4ea23f248d33adc70dc3227e
ARG ARM_FOLDER=gcc-arm-none-eabi-10.3-2021.10
RUN echo 'Installing arm-none-eabi toolchain from arm.com' >&2 && \
mkdir -p /opt && \
curl -L -o /opt/gcc-arm-none-eabi.tar.bz2 ${ARM_URL} && \
echo "${ARM_MD5} /opt/gcc-arm-none-eabi.tar.bz2" | md5sum -c && \
tar -C /opt -jxf /opt/gcc-arm-none-eabi.tar.bz2 && \
rm -f /opt/gcc-arm-none-eabi.tar.bz2 && \
echo 'Removing documentation' >&2 && \
rm -rf /opt/gcc-arm-none-eabi-*/share/doc
# No need to dedup, the ARM toolchain is already using hard links for the duplicated files

ENV PATH ${PATH}:/opt/${ARM_FOLDER}/bin

# Install MIPS binary toolchain
# For updates: https://www.mips.com/develop/tools/codescape-mips-sdk/ (select "Codescape GNU Toolchain")
ARG MIPS_VERSION=2020.06-01
Expand Down Expand Up @@ -168,18 +180,6 @@ RUN mkdir -p /opt && \

ENV PATH $PATH:/opt/xpack-riscv-none-embed-gcc-${RISCV_VERSION}/bin

# Install picolibc Debian package
ARG PICOLIBC_VERSION=1.7.9-1
RUN wget -P /tmp http://ftp.de.debian.org/debian/pool/main/p/picolibc/picolibc-riscv64-unknown-elf_${PICOLIBC_VERSION}_all.deb && \
dpkg -i /tmp/picolibc-riscv64-unknown-elf_${PICOLIBC_VERSION}_all.deb && \
rm /tmp/picolibc-riscv64-unknown-elf_${PICOLIBC_VERSION}_all.deb && \
wget -P /tmp http://ftp.de.debian.org/debian/pool/main/p/picolibc/picolibc-arm-none-eabi_${PICOLIBC_VERSION}_all.deb && \
dpkg -i /tmp/picolibc-arm-none-eabi_${PICOLIBC_VERSION}_all.deb && \
rm /tmp/picolibc-arm-none-eabi_${PICOLIBC_VERSION}_all.deb && \
wget -P /tmp http://ftp.de.debian.org/debian/pool/main/p/picolibc/picolibc-xtensa-lx106-elf_${PICOLIBC_VERSION}_all.deb && \
dpkg -i /tmp/picolibc-xtensa-lx106-elf_${PICOLIBC_VERSION}_all.deb && \
rm /tmp/picolibc-xtensa-lx106-elf_${PICOLIBC_VERSION}_all.deb

# Install complete ESP8266 toolchain in /opt/esp (139 MB after cleanup)
# remember https://github.com/RIOT-OS/RIOT/pull/10801 when updating
RUN echo 'Installing ESP8266 toolchain' >&2 && \
Expand Down Expand Up @@ -253,6 +253,38 @@ RUN echo 'Installing ESP32-S3 toolchain' >&2 && \
pip install --no-cache-dir pyserial
ENV PATH $PATH:/opt/esp/xtensa-esp32s3-elf/bin

ARG PICOLIBC_REPO=https://github.com/keith-packard/picolibc
ARG PICOLIBC_TAG=1.4.6
ARG PICOLIBC_URL=${PICOLIBC_REPO}/archive/${PICOLIBC_TAG}.tar.gz
ARG PICOLIBC_ARCHIVE=${PICOLIBC_TAG}.tar.gz

RUN echo 'Building and Installing PicoLIBC' >&2 && \
pip3 install --no-cache-dir meson && \
mkdir -p /usr/src/picolibc && \
cd /usr/src/picolibc/ &&\
curl -L -o ${PICOLIBC_ARCHIVE} ${PICOLIBC_URL} && \
tar -xf ${PICOLIBC_ARCHIVE} && \
cd picolibc-${PICOLIBC_TAG}

COPY cross-riscv-none-embed.txt /usr/src/picolibc/picolibc-${PICOLIBC_TAG}/

RUN cd /usr/src/picolibc/picolibc-${PICOLIBC_TAG} && \
which riscv-none-embed-gcc && \
ls -al /opt/xpack-riscv-none-embed-gcc-${RISCV_VERSION}/bin && \
mkdir build-arm build-riscv build-esp32 && \
cd build-riscv && \
meson .. -Dtests=true -Dmultilib=false -Dincludedir=picolibc/riscv-none-embed/include -Dlibdir=picolibc/riscv-none-embed/lib --cross-file ../cross-riscv-none-embed.txt && \
ninja && ninja install && \
cd ../build-esp32 && \
sh ../do-esp32-configure && \
ninja && ninja install && \
cd ../build-arm && \
sh ../do-arm-configure && \
ninja && ninja install

# No need to keep the sources around
RUN rm -rf /usr/src/picolibc

# RIOT toolchains
ARG RIOT_TOOLCHAIN_GCC_VERSION=10.1.0
ARG RIOT_TOOLCHAIN_PACKAGE_VERSION=18
Expand Down
17 changes: 17 additions & 0 deletions riotbuild/cross-riscv-none-embed.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
[binaries]
c = 'riscv-none-embed-gcc'
ar = 'riscv-none-embed-ar'
as = 'riscv-none-embed-as'
strip = 'riscv-none-embed-strip'
exe_wrapper = ['sh', '-c', 'test -z "$MESON_SOURCE_ROOT" || "$MESON_SOURCE_ROOT"/run-riscv "$@"', 'run-riscv']

[host_machine]
system = 'none'
cpu_family = 'riscv'
cpu = 'riscv'
endian = 'little'

[properties]
c_args = [ '-nostdlib', '-msave-restore', '-fno-common' ]
needs_exe_wrapper = true
skip_sanity_check = true

0 comments on commit 5efc102

Please sign in to comment.