diff --git a/constraints/cpu/BUILD b/constraints/cpu/BUILD index bfbb6de..225d51a 100644 --- a/constraints/cpu/BUILD +++ b/constraints/cpu/BUILD @@ -15,3 +15,4 @@ constraint_value( constraint_setting = "@platforms//cpu:cpu", visibility = ["//visibility:public"], ) + diff --git a/devices/arm/cortex_m.bzl b/devices/arm/cortex_m.bzl index 6ae2ff5..9bdbdfc 100644 --- a/devices/arm/cortex_m.bzl +++ b/devices/arm/cortex_m.bzl @@ -61,4 +61,18 @@ CORTEX_M7_FPU_DEVICE_CONFIG = device_config( fpu = "fpv5-d16", ) -CORTEX_M_DEVICE_CONFIGS = [CORTEX_M0_DEVICE_CONFIG, CORTEX_M3_DEVICE_CONFIG, CORTEX_M4_FPU_DEVICE_CONFIG, CORTEX_M4_DEVICE_CONFIG, CORTEX_M7_FPU_DEVICE_CONFIG] +CORTEX_M33_DEVICE_CONFIG = device_config( + cpu = "armv8-m", + endian = "little", + float_abi = "soft", + fpu = "none", +) + +CORTEX_M33_FPU_DEVICE_CONFIG = device_config( + cpu = "armv8-m", + endian = "little", + float_abi = "hard", + fpu = "fpv5-d16", +) + +CORTEX_M_DEVICE_CONFIGS = [CORTEX_M0_DEVICE_CONFIG, CORTEX_M3_DEVICE_CONFIG, CORTEX_M4_FPU_DEVICE_CONFIG, CORTEX_M4_DEVICE_CONFIG, CORTEX_M7_FPU_DEVICE_CONFIG, CORTEX_M33_DEVICE_CONFIG, CORTEX_M33_FPU_DEVICE_CONFIG] diff --git a/platforms/BUILD b/platforms/BUILD index b043bea..559a67d 100644 --- a/platforms/BUILD +++ b/platforms/BUILD @@ -77,6 +77,29 @@ platform( parents = [":cortex_m"], ) +platform( + name = "cortex_m33", + constraint_values = [ + "@platforms//cpu:armv8-m", + ], + exec_properties = { + "EXECUTOR": "cortex_m33" + }, + parents = [":cortex_m3"] +) + +platform( + name = "cortex_m33_fpu", + constraint_values = [ + "@platforms//cpu:armv8-m", + "@bazel_embedded//constraints/fpu:fpv5-d16", + ], + exec_properties = { + "EXECUTOR": "cortex_m33_fpu" + }, + parents = [":cortex_m3"] +) + platform( name = "stm32f2xx", parents = [":cortex_m3"], diff --git a/toolchains/features/common/impl/gcc.bzl b/toolchains/features/common/impl/gcc.bzl index de8b7f0..8d1a4e2 100644 --- a/toolchains/features/common/impl/gcc.bzl +++ b/toolchains/features/common/impl/gcc.bzl @@ -49,6 +49,12 @@ def GccIncludeFeature(include_paths): def GccAchitectureFeature(architecture, float_abi, endian, fpu): if fpu == "none": fpu = "auto" + + # @platforms//cpu has armv8-m entry intended to match cortex m23, m33, m35p + # processors which all have the main instruction set. GCC needs this + # explicitly set when using cpu flag. + if architecture == "armv8-m": + architecture = "armv8-m.main" _ARCHITECTURE_FEATURE = feature( name = "architecture", enabled = True, diff --git a/toolchains/gcc_arm_none_eabi/gcc_arm_none_toolchain.bzl b/toolchains/gcc_arm_none_eabi/gcc_arm_none_toolchain.bzl index 1ae8880..e33fa14 100644 --- a/toolchains/gcc_arm_none_eabi/gcc_arm_none_toolchain.bzl +++ b/toolchains/gcc_arm_none_eabi/gcc_arm_none_toolchain.bzl @@ -200,6 +200,7 @@ gcc_arm_none_toolchain_config = rule( "armv6s-m", "armv7-m", "armv7e-m", + "armv8-m", "armv8-m.base", "armv8-m.main", "iwmmxt",