@@ -37,6 +37,43 @@ set -e -x
37
37
# of its own build process:
38
38
type rustup || (echo " rustup is not installed, aborting." ; exit 1)
39
39
40
+ # Function to setup Tock-specific Rust toolchain with all required components
41
+ setup_tock_toolchain () {
42
+ # Define the specific toolchain needed
43
+ local TOOLCHAIN=" nightly-2024-11-16-aarch64-unknown-linux-gnu"
44
+
45
+ echo " Setting up Rust toolchain for Tock: $TOOLCHAIN "
46
+
47
+ # Install the specific toolchain if not already installed
48
+ rustup toolchain install " $TOOLCHAIN "
49
+
50
+ # Add required components for Tock build
51
+ rustup component add rust-src --toolchain " $TOOLCHAIN "
52
+ rustup component add llvm-tools-preview --toolchain " $TOOLCHAIN "
53
+
54
+ # Add the target needed for Tock boards
55
+ rustup target add thumbv7em-none-eabi --toolchain " $TOOLCHAIN "
56
+
57
+ # Verify installation
58
+ echo " Verifying toolchain components..."
59
+ rustup component list --toolchain " $TOOLCHAIN " | grep installed
60
+
61
+ # Set the PATH to include the LLVM tools from this toolchain
62
+ RUSTC_SYSROOT=$( rustc +$TOOLCHAIN --print sysroot)
63
+ LLVM_TOOLS_PATH=$( find " $RUSTC_SYSROOT " -path ' */llvm-tools*/bin' | head -n 1)
64
+
65
+ if [ -n " $LLVM_TOOLS_PATH " ]; then
66
+ echo " Adding LLVM tools to PATH: $LLVM_TOOLS_PATH "
67
+ export PATH=" $LLVM_TOOLS_PATH :$PATH "
68
+ echo " LLVM tools location: $( which llvm-size 2> /dev/null || echo ' Not found' ) "
69
+ else
70
+ echo " Warning: LLVM tools path not found in Rust installation"
71
+ fi
72
+ }
73
+
74
+ setup_tock_toolchain
75
+
76
+
40
77
# Ensure that `elf2tab` is installed:
41
78
if ! type elf2tab; then
42
79
# We may not have a rustup default toolchain selected. In this case,
0 commit comments