Skip to content

Commit

Permalink
pw_toolchain: Add Cortex M3 support
Browse files Browse the repository at this point in the history
Change-Id: I41ec2fd136c722baa9a0cde0ff003c28bf5d977e
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/254474
Reviewed-by: Armando Montanez <amontanez@google.com>
Docs-Not-Needed: Erik Gilling <konkers@google.com>
Commit-Queue: Auto-Submit <auto-submit@pigweed-service-accounts.iam.gserviceaccount.com>
Pigweed-Auto-Submit: Erik Gilling <konkers@google.com>
Lint: Lint 🤖 <android-build-ayeaye@system.gserviceaccount.com>
Presubmit-Verified: CQ Bot Account <pigweed-scoped@luci-project-accounts.iam.gserviceaccount.com>
  • Loading branch information
konkers authored and CQ Bot Account committed Dec 16, 2024
1 parent f3fb838 commit 13446e5
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 0 deletions.
9 changes: 9 additions & 0 deletions pw_toolchain/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,15 @@ toolchain(
toolchain_type = "@bazel_tools//tools/cpp:toolchain_type",
)

toolchain(
name = "cc_toolchain_cortex-m3",
target_compatible_with = [
"@pw_toolchain//constraints/arm_mcpu:cortex-m3",
],
toolchain = ":cortex-m_cc_toolchain",
toolchain_type = "@bazel_tools//tools/cpp:toolchain_type",
)

cc_library(
name = "no_destructor",
hdrs = ["public/pw_toolchain/no_destructor.h"],
Expand Down
32 changes: 32 additions & 0 deletions pw_toolchain/arm_clang/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,19 @@ cc_args(
],
)

cc_args(
name = "armv7m-none-eabi",
actions = [
"@rules_cc//cc/toolchains/actions:assembly_actions",
"@rules_cc//cc/toolchains/actions:c_compile_actions",
"@rules_cc//cc/toolchains/actions:cpp_compile_actions",
"@rules_cc//cc/toolchains/actions:link_actions",
],
args = [
"--target=armv7m-none-eabi",
],
)

cc_args(
name = "armv8m.main-none-eabi",
actions = [
Expand Down Expand Up @@ -151,6 +164,20 @@ cc_args(
],
)

cc_args(
name = "cortex-m3",
actions = [
"@rules_cc//cc/toolchains/actions:assembly_actions",
"@rules_cc//cc/toolchains/actions:c_compile_actions",
"@rules_cc//cc/toolchains/actions:cpp_compile_actions",
"@rules_cc//cc/toolchains/actions:link_actions",
],
args = [
"-mcpu=cortex-m3",
"-mfloat-abi=soft",
],
)

cc_toolchain(
name = "arm_clang_toolchain_cortex-m",
args = [
Expand Down Expand Up @@ -178,6 +205,10 @@ cc_toolchain(
":cortex-m0plus",
":armv6m-none-eabi",
],
"@pw_toolchain//constraints/arm_mcpu:cortex-m3": [
":cortex-m3",
":armv7m-none-eabi",
],
"@pw_toolchain//constraints/arm_mcpu:cortex-m33": [
":cortex-m33",
":armv8m.main-none-eabi",
Expand All @@ -199,6 +230,7 @@ cc_toolchain(
target_compatible_with = select({
"@pw_toolchain//constraints/arm_mcpu:cortex-m0": [],
"@pw_toolchain//constraints/arm_mcpu:cortex-m0plus": [],
"@pw_toolchain//constraints/arm_mcpu:cortex-m3": [],
"@pw_toolchain//constraints/arm_mcpu:cortex-m33": [],
"@pw_toolchain//constraints/arm_mcpu:none": ["@platforms//:incompatible"],
}),
Expand Down

0 comments on commit 13446e5

Please sign in to comment.