From 221919ec6a72aba0ea50290f512e81ed7dc8eb61 Mon Sep 17 00:00:00 2001 From: Yang Hongbo Date: Wed, 6 Mar 2024 22:19:11 +0800 Subject: [PATCH] added support for Cortex-M33 (nRF5340 app core) --- CMakeLists.txt | 8 +++++++ rust/targets/thumbv8m.main-zephyr-eabi.json | 20 ++++++++++++++++++ rust/targets/thumbv8m.main-zephyr-eabihf.json | 21 +++++++++++++++++++ rust/targets/update-targets.sh | 2 ++ 4 files changed, 51 insertions(+) create mode 100644 rust/targets/thumbv8m.main-zephyr-eabi.json create mode 100644 rust/targets/thumbv8m.main-zephyr-eabihf.json diff --git a/CMakeLists.txt b/CMakeLists.txt index 1d343c5..a12171f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -26,6 +26,14 @@ elseif(${ARCH} STREQUAL "arm") set(rust_target thumbv7em-zephyr-eabi) set(clang_target thumbv7em-unknown-none-eabi) endif() + elseif(CONFIG_ARMV8_M_MAINLINE) + if(CONFIG_FPU) + set(rust_target thumbv8m.main-zephyr-eabihf) + set(clang_target thumbv8m.main-unknown-none-eabihf) + else() + set(rust_target thumbv8m.main-zephyr-eabi) + set(clang_target thumbv8m.main-unknown-none-eabi) + endif() else() set(rust_target thumbv7m-zephyr-eabi) set(clang_target thumbv7m-none-eabi) diff --git a/rust/targets/thumbv8m.main-zephyr-eabi.json b/rust/targets/thumbv8m.main-zephyr-eabi.json new file mode 100644 index 0000000..8d14497 --- /dev/null +++ b/rust/targets/thumbv8m.main-zephyr-eabi.json @@ -0,0 +1,20 @@ +{ + "abi": "eabi", + "arch": "arm", + "c-enum-min-bits": 8, + "data-layout": "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64", + "emit-debug-gdb-scripts": false, + "frame-pointer": "always", + "linker": "rust-lld", + "linker-flavor": "ld.lld", + "llvm-target": "thumbv8m.main-none-eabi", + "max-atomic-width": 32, + "panic-strategy": "abort", + "relocation-model": "static", + "target-pointer-width": "32", + "target-family": "zephyr", + "os": "zephyr", + "position-independent-executables": "false", + "dynamic-linking": "false", + "has-thread-local": "false" +} diff --git a/rust/targets/thumbv8m.main-zephyr-eabihf.json b/rust/targets/thumbv8m.main-zephyr-eabihf.json new file mode 100644 index 0000000..9b74983 --- /dev/null +++ b/rust/targets/thumbv8m.main-zephyr-eabihf.json @@ -0,0 +1,21 @@ +{ + "abi": "eabihf", + "arch": "arm", + "c-enum-min-bits": 8, + "data-layout": "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64", + "emit-debug-gdb-scripts": false, + "features": "+fp-armv8,-fp64,-d32", + "frame-pointer": "always", + "linker": "rust-lld", + "linker-flavor": "ld.lld", + "llvm-target": "thumbv8m.main-none-eabihf", + "max-atomic-width": 32, + "panic-strategy": "abort", + "relocation-model": "static", + "target-pointer-width": "32", + "target-family": "zephyr", + "os": "zephyr", + "position-independent-executables": "false", + "dynamic-linking": "false", + "has-thread-local": "false" +} diff --git a/rust/targets/update-targets.sh b/rust/targets/update-targets.sh index 29740f9..eefbd59 100755 --- a/rust/targets/update-targets.sh +++ b/rust/targets/update-targets.sh @@ -11,6 +11,8 @@ thumbv7em-zephyr-eabi thumbv7m-zephyr-eabi thumbv7r-zephyr-eabihf thumbv7r-zephyr-eabi +thumbv8m.main-zephyr-eabi +thumbv8m.main-zephyr-eabihf ) for target in "${targets[@]}"; do