Skip to content

Commit

Permalink
Fixing arm-none-eabi alternatives (#52)
Browse files Browse the repository at this point in the history
I flubbed setting up the arm-none-eabi alternatives. this fixes that.
  • Loading branch information
thirtytwobits authored Aug 14, 2024
1 parent a7164e8 commit 7cf6779
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 19 deletions.
6 changes: 1 addition & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,11 @@ like [libcanard](https://github.com/OpenCyphal/libcanard) and

| tag | Python | GCC (native) | GCC (arm-none-eabi) | Clang (native) | Cmake | Host Platforms | Other Utilities |
|----------|--------|--------------|---------------------|----------------|-------|----------------|-----------------|
| [ts22.4.9](https://github.com/OpenCyphal/docker_toolchains/pkgs/container/toolshed) | 3.10 | 12.3.0 | 13.3.1 | 18.1.3 | 3.30.1 | <ul><li>linux/amd64</li><li>linux/arm64</li></ul> | <ul><li>qemu</li><li>can-utils</li><li>doxygen 1.10.0</li><li>nvm</li><li>node 20.x</li><li>nox</li><li>govr</li><li>gcc-multilib (amd64 only)</li></ul> |
| [ts22.4.10](https://github.com/OpenCyphal/docker_toolchains/pkgs/container/toolshed) | 3.10 | 12.3.0 | 13.3.1 | 18.1.3 | 3.30.1 | <ul><li>linux/amd64</li><li>linux/arm64</li></ul> | <ul><li>qemu</li><li>can-utils</li><li>doxygen 1.10.0</li><li>nvm</li><li>node 20.x</li><li>nox</li><li>govr</li><li>gcc-multilib (amd64 only)</li></ul> |
| [ts22.4.8](https://github.com/OpenCyphal/docker_toolchains/pkgs/container/toolshed) | 3.10 | 12.3.0 | (N/A) | 18.1.3 | 3.22.1 | <ul><li>linux/amd64</li><li>linux/arm64</li></ul> | <ul><li>qemu</li><li>can-utils</li><li>doxygen 1.10.0</li><li>nvm</li><li>node 20.x</li><li>nox</li><li>govr</li><li>gcc-multilib (amd64 only)</li></ul> |
| [ts22.4.7](https://github.com/OpenCyphal/docker_toolchains/pkgs/container/toolshed) | 3.10 | 12.3.0 | (N/A) | 18.1.3 | 3.22.1 | <ul><li>linux/amd64</li><li>linux/arm64</li></ul> | <ul><li>qemu</li><li>can-utils</li><li>doxygen 1.10.0</li><li>nvm</li><li>node 20.x</li><li>nox</li><li>govr</li></ul> |
| [ts22.4.6](https://github.com/OpenCyphal/docker_toolchains/pkgs/container/toolshed) | 3.10 | 11.4.0 | (N/A) | 18.0.0 | 3.22.1 | <ul><li>linux/amd64</li><li>linux/arm64</li></ul> | <ul><li>qemu</li><li>can-utils</li><li>doxygen 1.10.0</li><li>nvm</li><li>node 20.x</li><li>nox</li><li>govr</li></ul> |
| [ts22.4.5](https://github.com/OpenCyphal/docker_toolchains/pkgs/container/toolshed) | 3.10 | 11.4.0 | (N/A) | 18.0.0 | 3.22.1 | <ul><li>linux/amd64</li><li>linux/arm64</li></ul> | <ul><li>qemu</li><li>can-utils</li><li>doxygen 1.9.6</li><li>nvm</li><li>node 16.20.0</li><li>nox</li><li>govr</li></ul> |
| [ts22.4.3](https://github.com/OpenCyphal/docker_toolchains/pkgs/container/toolshed) | 3.10 | 11.3.0 | (N/A) | 15.0.7 | 3.22.1 | <ul><li>linux/amd64</li></ul> | <ul><li>qemu</li><li>can-utils</li><li>doxygen 1.9.6</li><li>nvm</li><li>node 16.20.0</li><li>nox</li><li>govr</li></ul> |
| [ts22.4.2](https://github.com/OpenCyphal/docker_toolchains/pkgs/container/toolshed) | 3.10 | 11.3.0 | (N/A) | 15.0.7 | 3.22.1 | <ul><li>linux/amd64</li></ul> | <ul><li>qemu</li><li>can-utils</li><li>~~sonar-scanner~~</li><li>doxygen 1.9.6</li><li>nvm</li><li>node 16.20.0</li></ul> |
| [ts22.4.1](https://github.com/OpenCyphal/docker_toolchains/pkgs/container/toolshed) | 3.10 | 11.3.0 | (N/A) | 15.0.7 | 3.22.1 | <ul><li>linux/amd64</li></ul> | <ul><li>qemu</li><li>can-utils</li><li>sonar-scanner</li><li>doxygen 1.9.6</li></ul> |



You can use this in your workflow yaml like this:
Expand Down
2 changes: 1 addition & 1 deletion toolshed/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ RUN --mount=type=cache,target=/arm-none-eabi-download \
--unpack-dir "/opt"

ADD arm-none-eabi-gcc-select.sh ./arm-none-eabi-gcc-select.sh
RUN ./arm-none-eabi-gcc-select.sh 13.3.1 1 /opt/arm-gnu-toolchain-${ARM_NONE_EABI_VERSION}-${GCC_HOST_VERSION}-arm-none-eabi/bin/
RUN ./arm-none-eabi-gcc-select.sh 1 /opt/arm-gnu-toolchain-${ARM_NONE_EABI_VERSION}-${GCC_HOST_VERSION}-arm-none-eabi/bin/
RUN update-alternatives --display arm-none-eabi-gcc

# LEAVE THE WORKDIR AS /repo
Expand Down
45 changes: 33 additions & 12 deletions toolshed/arm-none-eabi-gcc-select.sh
Original file line number Diff line number Diff line change
@@ -1,34 +1,55 @@
#!/bin/bash

GCC_VERSION=${1}

setup_gcc_alternatives()
{
local version=${1}
local priority=${2}
local group=${3}
local members=${4}
local path=${5}
local priority=${1}
local group=${2}
local members=${3}
local path=${4}
local cmdln

cmdln="--verbose --install /usr/bin/${group} ${group} ${path}${group}-${version} ${priority}"
cmdln="--verbose --install /usr/bin/${group} ${group} ${path}${group} ${priority}"
for member in ${members}; do
cmdln="${cmdln} --slave ${path}${member} ${member} ${path}${member}-${version}"
cmdln="${cmdln} --slave /usr/bin/${member} ${member} ${path}${member}"
done
update-alternatives ${cmdln}
}

GCC_ALTERNATIVES_PRI=${2}
GCC_ALTERNATIVES_PATH=${3}
GCC_ALTERNATIVES_PRI=${1}
GCC_ALTERNATIVES_PATH=${2}

# setup gcc group
GCC_ALTERNATIVES_GROUP_GCC_CONFIG=""
GCC_ALTERNATIVES_GROUP_GCC_CONFIG="${GCC_ALTERNATIVES_GROUP_GCC_CONFIG} arm-none-eabi-addr2line"
GCC_ALTERNATIVES_GROUP_GCC_CONFIG="${GCC_ALTERNATIVES_GROUP_GCC_CONFIG} arm-none-eabi-ar"
GCC_ALTERNATIVES_GROUP_GCC_CONFIG="${GCC_ALTERNATIVES_GROUP_GCC_CONFIG} arm-none-eabi-as"
GCC_ALTERNATIVES_GROUP_GCC_CONFIG="${GCC_ALTERNATIVES_GROUP_GCC_CONFIG} arm-none-eabi-c++"
GCC_ALTERNATIVES_GROUP_GCC_CONFIG="${GCC_ALTERNATIVES_GROUP_GCC_CONFIG} arm-none-eabi-c++filt"
GCC_ALTERNATIVES_GROUP_GCC_CONFIG="${GCC_ALTERNATIVES_GROUP_GCC_CONFIG} arm-none-eabi-cpp"
GCC_ALTERNATIVES_GROUP_GCC_CONFIG="${GCC_ALTERNATIVES_GROUP_GCC_CONFIG} arm-none-eabi-elfedit"
GCC_ALTERNATIVES_GROUP_GCC_CONFIG="${GCC_ALTERNATIVES_GROUP_GCC_CONFIG} arm-none-eabi-g++"
GCC_ALTERNATIVES_GROUP_GCC_CONFIG="${GCC_ALTERNATIVES_GROUP_GCC_CONFIG} arm-none-eabi-gcc-ar"
GCC_ALTERNATIVES_GROUP_GCC_CONFIG="${GCC_ALTERNATIVES_GROUP_GCC_CONFIG} arm-none-eabi-gcc-nm"
GCC_ALTERNATIVES_GROUP_GCC_CONFIG="${GCC_ALTERNATIVES_GROUP_GCC_CONFIG} arm-none-eabi-gcc-ranlib"
GCC_ALTERNATIVES_GROUP_GCC_CONFIG="${GCC_ALTERNATIVES_GROUP_GCC_CONFIG} arm-none-eabi-gcov"
GCC_ALTERNATIVES_GROUP_GCC_CONFIG="${GCC_ALTERNATIVES_GROUP_GCC_CONFIG} arm-none-eabi-gcov-dump"
GCC_ALTERNATIVES_GROUP_GCC_CONFIG="${GCC_ALTERNATIVES_GROUP_GCC_CONFIG} arm-none-eabi-gcov-tool"
GCC_ALTERNATIVES_GROUP_GCC_CONFIG="${GCC_ALTERNATIVES_GROUP_GCC_CONFIG} arm-none-eabi-gdb"
GCC_ALTERNATIVES_GROUP_GCC_CONFIG="${GCC_ALTERNATIVES_GROUP_GCC_CONFIG} arm-none-eabi-gdb-add-index"
GCC_ALTERNATIVES_GROUP_GCC_CONFIG="${GCC_ALTERNATIVES_GROUP_GCC_CONFIG} arm-none-eabi-gdb-add-index-py"
GCC_ALTERNATIVES_GROUP_GCC_CONFIG="${GCC_ALTERNATIVES_GROUP_GCC_CONFIG} arm-none-eabi-gdb-py"
GCC_ALTERNATIVES_GROUP_GCC_CONFIG="${GCC_ALTERNATIVES_GROUP_GCC_CONFIG} arm-none-eabi-gfortran"
GCC_ALTERNATIVES_GROUP_GCC_CONFIG="${GCC_ALTERNATIVES_GROUP_GCC_CONFIG} arm-none-eabi-gprof"
GCC_ALTERNATIVES_GROUP_GCC_CONFIG="${GCC_ALTERNATIVES_GROUP_GCC_CONFIG} arm-none-eabi-ld"
GCC_ALTERNATIVES_GROUP_GCC_CONFIG="${GCC_ALTERNATIVES_GROUP_GCC_CONFIG} arm-none-eabi-ld.bfd"
GCC_ALTERNATIVES_GROUP_GCC_CONFIG="${GCC_ALTERNATIVES_GROUP_GCC_CONFIG} arm-none-eabi-lto-dump"
GCC_ALTERNATIVES_GROUP_GCC_CONFIG="${GCC_ALTERNATIVES_GROUP_GCC_CONFIG} arm-none-eabi-nm"
GCC_ALTERNATIVES_GROUP_GCC_CONFIG="${GCC_ALTERNATIVES_GROUP_GCC_CONFIG} arm-none-eabi-objcopy"
GCC_ALTERNATIVES_GROUP_GCC_CONFIG="${GCC_ALTERNATIVES_GROUP_GCC_CONFIG} arm-none-eabi-objdump"
GCC_ALTERNATIVES_GROUP_GCC_CONFIG="${GCC_ALTERNATIVES_GROUP_GCC_CONFIG} arm-none-eabi-ranlib"
GCC_ALTERNATIVES_GROUP_GCC_CONFIG="${GCC_ALTERNATIVES_GROUP_GCC_CONFIG} arm-none-eabi-readelf"
GCC_ALTERNATIVES_GROUP_GCC_CONFIG="${GCC_ALTERNATIVES_GROUP_GCC_CONFIG} arm-none-eabi-size"
GCC_ALTERNATIVES_GROUP_GCC_CONFIG="${GCC_ALTERNATIVES_GROUP_GCC_CONFIG} arm-none-eabi-strings"
GCC_ALTERNATIVES_GROUP_GCC_CONFIG="${GCC_ALTERNATIVES_GROUP_GCC_CONFIG} arm-none-eabi-strip"

setup_gcc_alternatives "${GCC_VERSION}" "${GCC_ALTERNATIVES_PRI}" "arm-none-eabi-gcc" "${GCC_ALTERNATIVES_GROUP_GCC_CONFIG}" "${GCC_ALTERNATIVES_PATH}"
setup_gcc_alternatives "${GCC_ALTERNATIVES_PRI}" "arm-none-eabi-gcc" "${GCC_ALTERNATIVES_GROUP_GCC_CONFIG}" "${GCC_ALTERNATIVES_PATH}"
2 changes: 1 addition & 1 deletion toolshed/llvm-select.sh
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ LLVM_ALTERNATIVES_GROUP_LLVM_CONFIG="${LLVM_ALTERNATIVES_GROUP_LLVM_CONFIG} llvm

setup_llvm_alternatives "${LLVM_VERSION}" "${LLVM_ALTERNATIVES_PRI}" "llvm-config" "${LLVM_ALTERNATIVES_GROUP_LLVM_CONFIG}" "${LLVM_ALTERNATIVES_PATH}"

# setup clang grioup
# setup clang group
LLVM_ALTERNATIVES_GROUP_CLANG=""
LLVM_ALTERNATIVES_GROUP_CLANG="${LLVM_ALTERNATIVES_GROUP_CLANG} analyze-build"
LLVM_ALTERNATIVES_GROUP_CLANG="${LLVM_ALTERNATIVES_GROUP_CLANG} asan_symbolize"
Expand Down

0 comments on commit 7cf6779

Please sign in to comment.