You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by xi...@apache.org on 2022/06/22 04:15:04 UTC

[incubator-nuttx] branch master updated: tools: ci : add cibuild rule for arm64

This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git


The following commit(s) were added to refs/heads/master by this push:
     new 881c896c06 tools: ci : add cibuild rule for arm64
881c896c06 is described below

commit 881c896c06763debb4e766ed4df533f18417a620
Author: qinwei <qi...@xiaomi.com>
AuthorDate: Wed Jun 22 10:24:54 2022 +0800

    tools: ci : add cibuild rule for arm64
    
    Summary:
    
    1. add aarch64-none-elf toolchain for cibuild rule
    
    Signed-off-by: qinwei <qi...@xiaomi.com>
---
 tools/ci/cibuild.sh              | 29 +++++++++++++++++++++++++++--
 tools/ci/docker/linux/Dockerfile | 15 +++++++++++++++
 2 files changed, 42 insertions(+), 2 deletions(-)

diff --git a/tools/ci/cibuild.sh b/tools/ci/cibuild.sh
index 5058dfbf8b..829cd26412 100755
--- a/tools/ci/cibuild.sh
+++ b/tools/ci/cibuild.sh
@@ -37,7 +37,7 @@ EXTRA_PATH=
 
 case ${os} in
   Darwin)
-    install="python-tools u-boot-tools elf-toolchain gen-romfs kconfig-frontends rust arm-gcc-toolchain riscv-gcc-toolchain xtensa-esp32-gcc-toolchain avr-gcc-toolchain c-cache binutils"
+    install="python-tools u-boot-tools elf-toolchain gen-romfs kconfig-frontends rust arm-gcc-toolchain arm64-gcc-toolchain riscv-gcc-toolchain xtensa-esp32-gcc-toolchain avr-gcc-toolchain c-cache binutils"
     mkdir -p "${prebuilt}"/homebrew
     export HOMEBREW_CACHE=${prebuilt}/homebrew
     # https://github.com/actions/virtual-environments/issues/2322#issuecomment-749211076
@@ -46,7 +46,7 @@ case ${os} in
     brew update --quiet
     ;;
   Linux)
-    install="python-tools gen-romfs gperf kconfig-frontends rust arm-gcc-toolchain mips-gcc-toolchain riscv-gcc-toolchain xtensa-esp32-gcc-toolchain rx-gcc-toolchain sparc-gcc-toolchain c-cache"
+    install="python-tools gen-romfs gperf kconfig-frontends rust arm-gcc-toolchain arm64-gcc-toolchain mips-gcc-toolchain riscv-gcc-toolchain xtensa-esp32-gcc-toolchain rx-gcc-toolchain sparc-gcc-toolchain c-cache"
     ;;
 esac
 
@@ -172,6 +172,29 @@ function arm-gcc-toolchain {
   arm-none-eabi-gcc --version
 }
 
+function arm64-gcc-toolchain {
+  add_path "${prebuilt}"/gcc-aarch64-none-elf/bin
+
+  if [ ! -f "${prebuilt}/gcc-aarch64-none-elf/bin/aarch64-none-elf-gcc" ]; then
+    local flavor
+    case ${os} in
+      Darwin)
+        flavor=darwin-x86_64
+        ;;
+      Linux)
+        flavor=x86_64
+        ;;
+    esac
+    cd "${prebuilt}"
+    wget --quiet https://developer.arm.com/-/media/Files/downloads/gnu/11.2-2022.02/binrel/gcc-arm-11.2-2022.02-${flavor}-aarch64-none-elf.tar.xz
+    xz -d gcc-arm-11.2-2022.02-${flavor}-aarch64-none-elf.tar.xz
+    tar xf gcc-arm-11.2-2022.02-${flavor}-aarch64-none-elf.tar
+    mv gcc-arm-11.2-2022.02-${flavor}-aarch64-none-elf gcc-aarch64-none-elf
+    rm gcc-arm-11.2-2022.02-${flavor}-aarch64-none-elf.tar
+  fi
+  aarch64-none-elf-gcc --version
+}
+
 function mips-gcc-toolchain {
   add_path "${prebuilt}"/pinguino-compilers/linux64/p32/bin
 
@@ -336,6 +359,8 @@ function c-cache {
   ln -sf "$(which ccache)" "${prebuilt}"/ccache/bin/g++
   ln -sf "$(which ccache)" "${prebuilt}"/ccache/bin/arm-none-eabi-gcc
   ln -sf "$(which ccache)" "${prebuilt}"/ccache/bin/arm-none-eabi-g++
+  ln -sf "$(which ccache)" "${prebuilt}"/ccache/bin/aarch64-none-elf-gcc
+  ln -sf "$(which ccache)" "${prebuilt}"/ccache/bin/aarch64-none-elf-g++
   ln -sf "$(which ccache)" "${prebuilt}"/ccache/bin/p32-gcc
   ln -sf "$(which ccache)" "${prebuilt}"/ccache/bin/riscv64-unknown-elf-gcc
   ln -sf "$(which ccache)" "${prebuilt}"/ccache/bin/riscv64-unknown-elf-g++
diff --git a/tools/ci/docker/linux/Dockerfile b/tools/ci/docker/linux/Dockerfile
index 7e26869875..8d89c385c2 100644
--- a/tools/ci/docker/linux/Dockerfile
+++ b/tools/ci/docker/linux/Dockerfile
@@ -87,6 +87,15 @@ RUN mkdir gcc-arm-none-eabi && \
   curl -s -L  "https://developer.arm.com/-/media/Files/downloads/gnu-rm/10.3-2021.10/gcc-arm-none-eabi-10.3-2021.10-x86_64-linux.tar.bz2" \
   | tar -C gcc-arm-none-eabi --strip-components 1 -xj
 
+###############################################################################
+# Build image for tool required by ARM64 builds
+###############################################################################
+FROM nuttx-toolchain-base AS nuttx-toolchain-arm64
+# Download the latest ARM64 GCC toolchain prebuilt by ARM
+RUN mkdir gcc-aarch64-none-elf && \
+  curl -s -L  "https://developer.arm.com/-/media/Files/downloads/gnu/11.2-2022.02/binrel/gcc-arm-11.2-2022.02-x86_64-aarch64-none-elf.tar.xz" \
+  | tar -C gcc-aarch64-none-elf --strip-components 1 -xJ
+
 ###############################################################################
 # Build image for tool required by Pinguino builds
 ###############################################################################
@@ -273,6 +282,10 @@ ENV PATH="/tools/rust/cargo/bin:$PATH"
 COPY --from=nuttx-toolchain-arm /tools/gcc-arm-none-eabi/ gcc-arm-none-eabi/
 ENV PATH="/tools/gcc-arm-none-eabi/bin:$PATH"
 
+# ARM64 toolchain
+COPY --from=nuttx-toolchain-arm64 /tools/gcc-aarch64-none-elf/ gcc-aarch64-none-elf/
+ENV PATH="/tools/gcc-aarch64-none-elf/bin:$PATH"
+
 # MIPS toolchain
 COPY --from=nuttx-toolchain-pinguino /tools/pinguino-compilers/p32/ pinguino-compilers/p32/
 ENV PATH="/tools/pinguino-compilers/p32/bin:$PATH"
@@ -318,6 +331,8 @@ RUN mkdir -p /tools/ccache/bin && \
   ln -sf `which ccache` /tools/ccache/bin/g++ && \
   ln -sf `which ccache` /tools/ccache/bin/arm-none-eabi-gcc && \
   ln -sf `which ccache` /tools/ccache/bin/arm-none-eabi-g++ && \
+  ln -sf `which ccache` /tools/ccache/bin/aarch64-none-elf-gcc && \
+  ln -sf `which ccache` /tools/ccache/bin/aarch64-none-elf-g++ && \
   ln -sf `which ccache` /tools/ccache/bin/p32-gcc && \
   ln -sf `which ccache` /tools/ccache/bin/riscv64-unknown-elf-gcc && \
   ln -sf `which ccache` /tools/ccache/bin/riscv64-unknown-elf-g++ && \