summaryrefslogtreecommitdiff
path: root/ports/arm9/gnu/example_build/build_threadx_sample.sh
diff options
context:
space:
mode:
authorFrédéric Desbiens <[email protected]>2026-10-02 10:42:44 -0400
committerGitHub <[email protected]>2026-10-02 10:42:44 -0400
commit93387b0a60382a29579bbad5045c68328e3751df (patch)
tree42be790d602cb76f55090e5a7c418df7ea2b3428 /ports/arm9/gnu/example_build/build_threadx_sample.sh
parent44d7c95c582d415c4ad84527180b29c93c3bf664 (diff)
parent28281cd5647d4671236ca08d19bd18ed15b2265a (diff)
Merge pull request #783 from eclipse-threadx/devv6.5.2.202603_rel
Merged changes ahead of the v6.5.2.202603 release
Diffstat (limited to 'ports/arm9/gnu/example_build/build_threadx_sample.sh')
-rwxr-xr-xports/arm9/gnu/example_build/build_threadx_sample.sh47
1 files changed, 42 insertions, 5 deletions
diff --git a/ports/arm9/gnu/example_build/build_threadx_sample.sh b/ports/arm9/gnu/example_build/build_threadx_sample.sh
index 33ea6649..d9339bc0 100755
--- a/ports/arm9/gnu/example_build/build_threadx_sample.sh
+++ b/ports/arm9/gnu/example_build/build_threadx_sample.sh
@@ -10,6 +10,7 @@
# SPDX-License-Identifier: MIT
#
# AI Disclosure: This file was largely AI-generated by Copilot (Claude Sonnet 4.6).
+# Portions of this file were generated with AI assistance.
# The AI-generated portions may be considered public domain (CC0-1.0)
# and not subject to the project's licence. The human contributor has
# reviewed and verified that the code is correct.
@@ -20,9 +21,45 @@
set -e
cd "$(dirname "$0")"
-arm-none-eabi-gcc -c -g -mcpu=arm9 reset.S
-arm-none-eabi-gcc -c -g -mcpu=arm9 crt0.S
-arm-none-eabi-gcc -c -g -mcpu=arm9 tx_initialize_low_level.S
-arm-none-eabi-gcc -c -g -mcpu=arm9 -I../../../../common/inc -I../inc sample_threadx.c
-arm-none-eabi-ld -A arm9 -T sample_threadx.ld reset.o crt0.o tx_initialize_low_level.o sample_threadx.o tx.a libc.a libgcc.a -o sample_threadx.out -M > sample_threadx.map
+# Toolchain selection. The default is the GNU toolchain, so an existing
+# invocation of this script behaves exactly as before. Set TOOLCHAIN=atfe to
+# build with Arm Toolchain for Embedded, which is LLVM based and is the
+# successor to Arm Compiler 6:
+#
+# TOOLCHAIN=atfe ATFE_CLANG=/path/to/clang ./build_threadx_sample.sh
+#
+: "${TOOLCHAIN:=gnu}"
+case "${TOOLCHAIN}" in
+ gnu)
+ CC="arm-none-eabi-gcc"
+ AR="arm-none-eabi-ar"
+ TARGET_FLAGS=""
+ ENTRY_FLAG="-ereset_handler"
+ SYSCALL_LIB="--specs=nosys.specs"
+ ;;
+ atfe)
+ CC="${ATFE_CLANG:-clang}"
+ # llvm-ar ships beside clang in the toolchain.
+ case "${CC}" in
+ */*) AR="$(dirname "${CC}")/llvm-ar" ;;
+ *) AR="llvm-ar" ;;
+ esac
+ TARGET_FLAGS="--target=arm-none-eabi"
+ ENTRY_FLAG="-Wl,--entry=reset_handler"
+ # picolibc leaves _exit to the application; the toolchain's own
+ # semihosting library supplies it, which suits an example that runs on
+ # a model.
+ SYSCALL_LIB="-lsemihost"
+ ;;
+ *)
+ echo "Unknown TOOLCHAIN '${TOOLCHAIN}'; expected gnu or atfe" >&2
+ exit 1
+ ;;
+esac
+
+"${CC}" ${TARGET_FLAGS} -c -g -mcpu=arm9 reset.S
+"${CC}" ${TARGET_FLAGS} -c -g -mcpu=arm9 crt0.S
+"${CC}" ${TARGET_FLAGS} -c -g -mcpu=arm9 tx_initialize_low_level.S
+"${CC}" ${TARGET_FLAGS} -c -g -mcpu=arm9 -I../../../../common/inc -I../inc sample_threadx.c
+"${CC}" ${TARGET_FLAGS} -g -nostartfiles -mcpu=arm9 -T sample_threadx.ld ${SYSCALL_LIB} -o sample_threadx.out -Wl,-Map=sample_threadx.map reset.o crt0.o tx_initialize_low_level.o sample_threadx.o tx.a