|  | # Copyright 2025 Google LLC | 
|  | # | 
|  | # Licensed under the Apache License, Version 2.0 (the "License"); | 
|  | # you may not use this file except in compliance with the License. | 
|  | # You may obtain a copy of the License at | 
|  | # | 
|  | #     http://www.apache.org/licenses/LICENSE-2.0 | 
|  | # | 
|  | # Unless required by applicable law or agreed to in writing, software | 
|  | # distributed under the License is distributed on an "AS IS" BASIS, | 
|  | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | 
|  | # See the License for the specific language governing permissions and | 
|  | # limitations under the License. | 
|  |  | 
|  | package(default_visibility = ["//visibility:public"]) | 
|  |  | 
|  | load(":cc_toolchain_config.bzl", "kelvin_v2_cc_toolchain_config") | 
|  |  | 
|  | filegroup( | 
|  | name = "all_files", | 
|  | srcs = [ | 
|  | "//toolchain/wrappers:all", | 
|  | "//toolchain:kelvin_tcm.ld", | 
|  | "@toolchain_kelvin_v2//:all_files", | 
|  | ], | 
|  | ) | 
|  |  | 
|  | kelvin_v2_cc_toolchain_config( | 
|  | name = "kelvin_v2_toolchain_config", | 
|  | semihosting = False, | 
|  | ) | 
|  |  | 
|  | kelvin_v2_cc_toolchain_config( | 
|  | name = "kelvin_v2_semihosting_toolchain_config", | 
|  | semihosting = True, | 
|  | ) | 
|  |  | 
|  | cc_toolchain( | 
|  | name = "kelvin_v2_toolchain", | 
|  | all_files = ":all_files", | 
|  | ar_files = ":all_files", | 
|  | as_files = ":all_files", | 
|  | compiler_files = ":all_files", | 
|  | dwp_files = ":all_files", | 
|  | linker_files = ":all_files", | 
|  | objcopy_files = ":all_files", | 
|  | strip_files = ":all_files", | 
|  | supports_param_files = 0, | 
|  | toolchain_config = ":kelvin_v2_toolchain_config", | 
|  | toolchain_identifier = "kelvin_v2_toolchain", | 
|  | ) | 
|  |  | 
|  | cc_toolchain( | 
|  | name = "kelvin_v2_semihosting_toolchain", | 
|  | all_files = ":all_files", | 
|  | ar_files = ":all_files", | 
|  | as_files = ":all_files", | 
|  | compiler_files = ":all_files", | 
|  | dwp_files = ":all_files", | 
|  | linker_files = ":all_files", | 
|  | objcopy_files = ":all_files", | 
|  | strip_files = ":all_files", | 
|  | supports_param_files = 0, | 
|  | toolchain_config = ":kelvin_v2_semihosting_toolchain_config", | 
|  | toolchain_identifier = "kelvin_v2_semihosting_toolchain", | 
|  | ) | 
|  |  | 
|  | toolchain( | 
|  | name = "cc_kelvin_v2_toolchain", | 
|  | exec_compatible_with = [ | 
|  | "@platforms//cpu:x86_64", | 
|  | "@platforms//os:linux", | 
|  | ], | 
|  | target_compatible_with = [ | 
|  | "//platforms/cpu:kelvin_v2", | 
|  | "@platforms//os:none", | 
|  | ], | 
|  | toolchain = ":kelvin_v2_toolchain", | 
|  | toolchain_type = "@bazel_tools//tools/cpp:toolchain_type", | 
|  | ) | 
|  |  | 
|  | toolchain( | 
|  | name = "cc_kelvin_v2_semihosting_toolchain", | 
|  | exec_compatible_with = [ | 
|  | "@platforms//cpu:x86_64", | 
|  | "@platforms//os:linux", | 
|  | ], | 
|  | target_compatible_with = [ | 
|  | "//platforms/cpu:kelvin_v2", | 
|  | "//platforms/os:semihosting", | 
|  | ], | 
|  | toolchain = ":kelvin_v2_semihosting_toolchain", | 
|  | toolchain_type = "@bazel_tools//tools/cpp:toolchain_type", | 
|  | ) | 
|  |  | 
|  | sh_binary( | 
|  | name = "gdb", | 
|  | srcs = [ | 
|  | "//toolchain/wrappers:gdb", | 
|  | ], | 
|  | data = [ | 
|  | ":kelvin_v2_toolchain", | 
|  | ], | 
|  | ) |