Austin Schuh | a2503a7 | 2020-12-15 20:57:57 -0800 | [diff] [blame] | 1 | load( |
| 2 | "@bazel_tools//tools/cpp:cc_toolchain_config_lib.bzl", |
Austin Schuh | da9d060 | 2019-09-15 17:29:38 -0700 | [diff] [blame] | 3 | "action_config", |
Austin Schuh | da9d060 | 2019-09-15 17:29:38 -0700 | [diff] [blame] | 4 | "feature", |
Austin Schuh | da9d060 | 2019-09-15 17:29:38 -0700 | [diff] [blame] | 5 | "flag_group", |
| 6 | "flag_set", |
Austin Schuh | da9d060 | 2019-09-15 17:29:38 -0700 | [diff] [blame] | 7 | "tool", |
| 8 | "tool_path", |
Austin Schuh | da9d060 | 2019-09-15 17:29:38 -0700 | [diff] [blame] | 9 | "with_feature_set", |
| 10 | ) |
| 11 | load("@bazel_tools//tools/build_defs/cc:action_names.bzl", "ACTION_NAMES") |
| 12 | |
| 13 | def _impl(ctx): |
Brian Silverman | 4c7235a | 2021-11-17 19:04:37 -0800 | [diff] [blame] | 14 | if ctx.attr.cpu == "rp2040": |
Austin Schuh | 0a96ea3 | 2022-01-01 22:29:30 -0800 | [diff] [blame] | 15 | toolchain_identifier = "rp2040" |
Brian Silverman | 94cab07 | 2022-01-02 23:50:03 -0800 | [diff] [blame] | 16 | elif ctx.attr.cpu == "cortex-m4f": |
Austin Schuh | da9d060 | 2019-09-15 17:29:38 -0700 | [diff] [blame] | 17 | toolchain_identifier = "cortex-m4f" |
Brian Silverman | 94cab07 | 2022-01-02 23:50:03 -0800 | [diff] [blame] | 18 | elif ctx.attr.cpu == "cortex-m4f-k22": |
Austin Schuh | da9d060 | 2019-09-15 17:29:38 -0700 | [diff] [blame] | 19 | toolchain_identifier = "cortex-m4f-k22" |
Brian Silverman | 94cab07 | 2022-01-02 23:50:03 -0800 | [diff] [blame] | 20 | elif ctx.attr.cpu == "roborio": |
Austin Schuh | da9d060 | 2019-09-15 17:29:38 -0700 | [diff] [blame] | 21 | toolchain_identifier = "roborio_linux" |
Austin Schuh | da9d060 | 2019-09-15 17:29:38 -0700 | [diff] [blame] | 22 | else: |
| 23 | fail("Unreachable") |
| 24 | |
Brian Silverman | 33ca369 | 2022-02-06 18:37:17 -0800 | [diff] [blame] | 25 | if (ctx.attr.cpu == "rp2040" or |
| 26 | ctx.attr.cpu == "cortex-m4f" or |
| 27 | ctx.attr.cpu == "cortex-m4f-k22"): |
Austin Schuh | da9d060 | 2019-09-15 17:29:38 -0700 | [diff] [blame] | 28 | host_system_name = "local" |
Brian Silverman | 94cab07 | 2022-01-02 23:50:03 -0800 | [diff] [blame] | 29 | elif ctx.attr.cpu == "roborio": |
Austin Schuh | da9d060 | 2019-09-15 17:29:38 -0700 | [diff] [blame] | 30 | host_system_name = "roborio" |
| 31 | else: |
| 32 | fail("Unreachable") |
| 33 | |
Brian Silverman | 33ca369 | 2022-02-06 18:37:17 -0800 | [diff] [blame] | 34 | if ctx.attr.cpu == "rp2040": |
Austin Schuh | 0a96ea3 | 2022-01-01 22:29:30 -0800 | [diff] [blame] | 35 | target_system_name = "rp2040" |
Brian Silverman | 94cab07 | 2022-01-02 23:50:03 -0800 | [diff] [blame] | 36 | elif ctx.attr.cpu == "cortex-m4f": |
Austin Schuh | da9d060 | 2019-09-15 17:29:38 -0700 | [diff] [blame] | 37 | target_system_name = "cortex-m4f" |
Brian Silverman | 94cab07 | 2022-01-02 23:50:03 -0800 | [diff] [blame] | 38 | elif ctx.attr.cpu == "cortex-m4f-k22": |
Austin Schuh | da9d060 | 2019-09-15 17:29:38 -0700 | [diff] [blame] | 39 | target_system_name = "cortex-m4f-k22" |
Brian Silverman | 94cab07 | 2022-01-02 23:50:03 -0800 | [diff] [blame] | 40 | elif ctx.attr.cpu == "roborio": |
Austin Schuh | da9d060 | 2019-09-15 17:29:38 -0700 | [diff] [blame] | 41 | target_system_name = "roborio" |
| 42 | else: |
| 43 | fail("Unreachable") |
| 44 | |
Brian Silverman | 33ca369 | 2022-02-06 18:37:17 -0800 | [diff] [blame] | 45 | if ctx.attr.cpu == "rp2040": |
Austin Schuh | 0a96ea3 | 2022-01-01 22:29:30 -0800 | [diff] [blame] | 46 | target_cpu = "rp2040" |
Brian Silverman | 94cab07 | 2022-01-02 23:50:03 -0800 | [diff] [blame] | 47 | elif ctx.attr.cpu == "cortex-m4f": |
Austin Schuh | da9d060 | 2019-09-15 17:29:38 -0700 | [diff] [blame] | 48 | target_cpu = "cortex-m4f" |
Brian Silverman | 94cab07 | 2022-01-02 23:50:03 -0800 | [diff] [blame] | 49 | elif ctx.attr.cpu == "cortex-m4f-k22": |
Austin Schuh | da9d060 | 2019-09-15 17:29:38 -0700 | [diff] [blame] | 50 | target_cpu = "cortex-m4f-k22" |
Brian Silverman | 94cab07 | 2022-01-02 23:50:03 -0800 | [diff] [blame] | 51 | elif ctx.attr.cpu == "roborio": |
Austin Schuh | da9d060 | 2019-09-15 17:29:38 -0700 | [diff] [blame] | 52 | target_cpu = "roborio" |
| 53 | else: |
| 54 | fail("Unreachable") |
| 55 | |
Brian Silverman | 33ca369 | 2022-02-06 18:37:17 -0800 | [diff] [blame] | 56 | if ctx.attr.cpu == "rp2040": |
Austin Schuh | 0a96ea3 | 2022-01-01 22:29:30 -0800 | [diff] [blame] | 57 | target_libc = "rp2040" |
Brian Silverman | 94cab07 | 2022-01-02 23:50:03 -0800 | [diff] [blame] | 58 | elif ctx.attr.cpu == "cortex-m4f": |
Austin Schuh | da9d060 | 2019-09-15 17:29:38 -0700 | [diff] [blame] | 59 | target_libc = "cortex-m4f" |
Brian Silverman | 94cab07 | 2022-01-02 23:50:03 -0800 | [diff] [blame] | 60 | elif ctx.attr.cpu == "cortex-m4f-k22": |
Austin Schuh | da9d060 | 2019-09-15 17:29:38 -0700 | [diff] [blame] | 61 | target_libc = "cortex-m4f-k22" |
Brian Silverman | 94cab07 | 2022-01-02 23:50:03 -0800 | [diff] [blame] | 62 | elif ctx.attr.cpu == "roborio": |
Austin Schuh | da9d060 | 2019-09-15 17:29:38 -0700 | [diff] [blame] | 63 | target_libc = "roborio" |
| 64 | else: |
| 65 | fail("Unreachable") |
| 66 | |
Brian Silverman | 33ca369 | 2022-02-06 18:37:17 -0800 | [diff] [blame] | 67 | if (ctx.attr.cpu == "rp2040" or |
| 68 | ctx.attr.cpu == "cortex-m4f" or |
| 69 | ctx.attr.cpu == "cortex-m4f-k22" or |
| 70 | ctx.attr.cpu == "roborio"): |
Austin Schuh | da9d060 | 2019-09-15 17:29:38 -0700 | [diff] [blame] | 71 | compiler = "gcc" |
| 72 | else: |
| 73 | fail("Unreachable") |
| 74 | |
Brian Silverman | 33ca369 | 2022-02-06 18:37:17 -0800 | [diff] [blame] | 75 | if ctx.attr.cpu == "rp2040": |
Austin Schuh | 0a96ea3 | 2022-01-01 22:29:30 -0800 | [diff] [blame] | 76 | abi_version = "rp2040" |
Brian Silverman | 94cab07 | 2022-01-02 23:50:03 -0800 | [diff] [blame] | 77 | elif ctx.attr.cpu == "cortex-m4f": |
Austin Schuh | da9d060 | 2019-09-15 17:29:38 -0700 | [diff] [blame] | 78 | abi_version = "cortex-m4f" |
Brian Silverman | 94cab07 | 2022-01-02 23:50:03 -0800 | [diff] [blame] | 79 | elif ctx.attr.cpu == "cortex-m4f-k22": |
Austin Schuh | da9d060 | 2019-09-15 17:29:38 -0700 | [diff] [blame] | 80 | abi_version = "cortex-m4f-k22" |
Brian Silverman | 94cab07 | 2022-01-02 23:50:03 -0800 | [diff] [blame] | 81 | elif ctx.attr.cpu == "roborio": |
Austin Schuh | da9d060 | 2019-09-15 17:29:38 -0700 | [diff] [blame] | 82 | abi_version = "roborio" |
| 83 | else: |
| 84 | fail("Unreachable") |
| 85 | |
Brian Silverman | 33ca369 | 2022-02-06 18:37:17 -0800 | [diff] [blame] | 86 | if ctx.attr.cpu == "rp2040": |
Austin Schuh | 0a96ea3 | 2022-01-01 22:29:30 -0800 | [diff] [blame] | 87 | abi_libc_version = "rp2040" |
Brian Silverman | 94cab07 | 2022-01-02 23:50:03 -0800 | [diff] [blame] | 88 | elif ctx.attr.cpu == "cortex-m4f": |
Austin Schuh | da9d060 | 2019-09-15 17:29:38 -0700 | [diff] [blame] | 89 | abi_libc_version = "cortex-m4f" |
Brian Silverman | 94cab07 | 2022-01-02 23:50:03 -0800 | [diff] [blame] | 90 | elif ctx.attr.cpu == "cortex-m4f-k22": |
Austin Schuh | da9d060 | 2019-09-15 17:29:38 -0700 | [diff] [blame] | 91 | abi_libc_version = "cortex-m4f-k22" |
Brian Silverman | 94cab07 | 2022-01-02 23:50:03 -0800 | [diff] [blame] | 92 | elif ctx.attr.cpu == "roborio": |
Austin Schuh | da9d060 | 2019-09-15 17:29:38 -0700 | [diff] [blame] | 93 | abi_libc_version = "roborio" |
| 94 | else: |
| 95 | fail("Unreachable") |
| 96 | |
| 97 | cc_target_os = None |
| 98 | |
| 99 | builtin_sysroot = None |
| 100 | |
Austin Schuh | da9d060 | 2019-09-15 17:29:38 -0700 | [diff] [blame] | 101 | all_cpp_compile_actions = [ |
| 102 | ACTION_NAMES.cpp_compile, |
| 103 | ACTION_NAMES.linkstamp_compile, |
| 104 | ACTION_NAMES.cpp_header_parsing, |
| 105 | ACTION_NAMES.cpp_module_compile, |
| 106 | ACTION_NAMES.cpp_module_codegen, |
| 107 | ACTION_NAMES.clif_match, |
| 108 | ] |
| 109 | |
Austin Schuh | da9d060 | 2019-09-15 17:29:38 -0700 | [diff] [blame] | 110 | all_link_actions = [ |
| 111 | ACTION_NAMES.cpp_link_executable, |
| 112 | ACTION_NAMES.cpp_link_dynamic_library, |
| 113 | ACTION_NAMES.cpp_link_nodeps_dynamic_library, |
| 114 | ] |
| 115 | |
Brian Silverman | 94cab07 | 2022-01-02 23:50:03 -0800 | [diff] [blame] | 116 | if ctx.attr.cpu == "roborio": |
Austin Schuh | da9d060 | 2019-09-15 17:29:38 -0700 | [diff] [blame] | 117 | objcopy_embed_data_action = action_config( |
| 118 | action_name = "objcopy_embed_data", |
| 119 | enabled = True, |
| 120 | tools = [ |
| 121 | tool( |
| 122 | path = "arm-frc-linux-gnueabi/arm-frc-linux-gnueabi-objcopy", |
| 123 | ), |
| 124 | ], |
| 125 | ) |
Austin Schuh | 0a96ea3 | 2022-01-01 22:29:30 -0800 | [diff] [blame] | 126 | elif (ctx.attr.cpu == "rp2040" or |
| 127 | ctx.attr.cpu == "cortex-m4f" or |
Austin Schuh | a2503a7 | 2020-12-15 20:57:57 -0800 | [diff] [blame] | 128 | ctx.attr.cpu == "cortex-m4f-k22"): |
Austin Schuh | da9d060 | 2019-09-15 17:29:38 -0700 | [diff] [blame] | 129 | objcopy_embed_data_action = action_config( |
| 130 | action_name = "objcopy_embed_data", |
| 131 | enabled = True, |
| 132 | tools = [tool(path = "gcc_arm_none_eabi/arm-none-eabi-objcopy")], |
| 133 | ) |
| 134 | else: |
| 135 | objcopy_embed_data_action = None |
| 136 | |
Brian Silverman | 33ca369 | 2022-02-06 18:37:17 -0800 | [diff] [blame] | 137 | if (ctx.attr.cpu == "rp2040" or |
| 138 | ctx.attr.cpu == "cortex-m4f" or |
| 139 | ctx.attr.cpu == "cortex-m4f-k22" or |
| 140 | ctx.attr.cpu == "roborio"): |
Austin Schuh | da9d060 | 2019-09-15 17:29:38 -0700 | [diff] [blame] | 141 | action_configs = [objcopy_embed_data_action] |
| 142 | else: |
| 143 | fail("Unreachable") |
| 144 | |
| 145 | opt_post_feature = feature( |
| 146 | name = "opt_post", |
| 147 | flag_sets = [ |
| 148 | flag_set( |
Brian Silverman | 7b53ae1 | 2022-05-22 21:40:57 -0700 | [diff] [blame] | 149 | actions = all_cpp_compile_actions + [ |
Austin Schuh | da9d060 | 2019-09-15 17:29:38 -0700 | [diff] [blame] | 150 | ACTION_NAMES.preprocess_assemble, |
| 151 | ACTION_NAMES.c_compile, |
Austin Schuh | da9d060 | 2019-09-15 17:29:38 -0700 | [diff] [blame] | 152 | ], |
| 153 | flag_groups = [flag_group(flags = ["-DAOS_DEBUG=0"])], |
| 154 | ), |
| 155 | ], |
| 156 | ) |
| 157 | |
| 158 | supports_pic_feature = feature(name = "supports_pic", enabled = True) |
| 159 | |
Brian Silverman | 4c7235a | 2021-11-17 19:04:37 -0800 | [diff] [blame] | 160 | if ctx.attr.cpu == "cortex-m4f-k22": |
Austin Schuh | da9d060 | 2019-09-15 17:29:38 -0700 | [diff] [blame] | 161 | default_compile_flags_feature = feature( |
| 162 | name = "default_compile_flags", |
| 163 | enabled = True, |
| 164 | flag_sets = [ |
| 165 | flag_set( |
| 166 | actions = [ |
| 167 | ACTION_NAMES.assemble, |
| 168 | ACTION_NAMES.preprocess_assemble, |
| 169 | ACTION_NAMES.linkstamp_compile, |
| 170 | ACTION_NAMES.c_compile, |
| 171 | ACTION_NAMES.cpp_compile, |
| 172 | ACTION_NAMES.cpp_header_parsing, |
| 173 | ACTION_NAMES.cpp_module_compile, |
| 174 | ACTION_NAMES.cpp_module_codegen, |
| 175 | ACTION_NAMES.lto_backend, |
| 176 | ACTION_NAMES.clif_match, |
| 177 | ], |
| 178 | flag_groups = [ |
| 179 | flag_group( |
| 180 | flags = [ |
| 181 | "-D__STDC_FORMAT_MACROS", |
| 182 | "-D__STDC_CONSTANT_MACROS", |
| 183 | "-D__STDC_LIMIT_MACROS", |
| 184 | "-D__MK22FX512__", |
| 185 | "-DF_CPU=120000000", |
| 186 | "-Wl,--gc-sections", |
| 187 | "-D__have_long32", |
| 188 | "-fstack-protector", |
| 189 | "-mcpu=cortex-m4", |
| 190 | "-mfpu=fpv4-sp-d16", |
| 191 | "-mthumb", |
| 192 | "-mfloat-abi=hard", |
| 193 | "-fno-strict-aliasing", |
| 194 | "-fmessage-length=80", |
| 195 | "-fmax-errors=20", |
| 196 | "-Wall", |
| 197 | "-Wextra", |
| 198 | "-Wpointer-arith", |
| 199 | "-Wcast-qual", |
| 200 | "-Wwrite-strings", |
| 201 | "-Wtype-limits", |
| 202 | "-Wsign-compare", |
| 203 | "-Wformat=2", |
| 204 | "-Werror", |
| 205 | "-Wstrict-aliasing=2", |
| 206 | "-Wno-misleading-indentation", |
| 207 | "-Wno-int-in-bool-context", |
| 208 | "-Wdouble-promotion", |
| 209 | "-pipe", |
| 210 | "-g", |
| 211 | "-fno-common", |
| 212 | "-ffreestanding", |
| 213 | "-fbuiltin", |
| 214 | ], |
| 215 | ), |
| 216 | ], |
| 217 | ), |
| 218 | flag_set( |
| 219 | actions = [ |
| 220 | ACTION_NAMES.assemble, |
| 221 | ACTION_NAMES.preprocess_assemble, |
| 222 | ACTION_NAMES.linkstamp_compile, |
| 223 | ACTION_NAMES.c_compile, |
| 224 | ACTION_NAMES.cpp_compile, |
| 225 | ACTION_NAMES.cpp_header_parsing, |
| 226 | ACTION_NAMES.cpp_module_compile, |
| 227 | ACTION_NAMES.cpp_module_codegen, |
| 228 | ACTION_NAMES.lto_backend, |
| 229 | ACTION_NAMES.clif_match, |
| 230 | ], |
| 231 | flag_groups = [ |
| 232 | flag_group( |
| 233 | flags = [ |
| 234 | "-O2", |
| 235 | "-finline-functions", |
| 236 | "-ffast-math", |
| 237 | "-funroll-loops", |
| 238 | "-DNDEBUG", |
| 239 | "-ffunction-sections", |
| 240 | ], |
| 241 | ), |
| 242 | ], |
| 243 | with_features = [with_feature_set(features = ["opt"])], |
| 244 | ), |
| 245 | ], |
| 246 | ) |
Brian Silverman | 94cab07 | 2022-01-02 23:50:03 -0800 | [diff] [blame] | 247 | elif ctx.attr.cpu == "cortex-m4f": |
Austin Schuh | da9d060 | 2019-09-15 17:29:38 -0700 | [diff] [blame] | 248 | default_compile_flags_feature = feature( |
| 249 | name = "default_compile_flags", |
| 250 | enabled = True, |
| 251 | flag_sets = [ |
| 252 | flag_set( |
| 253 | actions = [ |
| 254 | ACTION_NAMES.assemble, |
| 255 | ACTION_NAMES.preprocess_assemble, |
| 256 | ACTION_NAMES.linkstamp_compile, |
| 257 | ACTION_NAMES.c_compile, |
| 258 | ACTION_NAMES.cpp_compile, |
| 259 | ACTION_NAMES.cpp_header_parsing, |
| 260 | ACTION_NAMES.cpp_module_compile, |
| 261 | ACTION_NAMES.cpp_module_codegen, |
| 262 | ACTION_NAMES.lto_backend, |
| 263 | ACTION_NAMES.clif_match, |
| 264 | ], |
| 265 | flag_groups = [ |
| 266 | flag_group( |
| 267 | flags = [ |
| 268 | "-D__STDC_FORMAT_MACROS", |
| 269 | "-D__STDC_CONSTANT_MACROS", |
| 270 | "-D__STDC_LIMIT_MACROS", |
| 271 | "-D__MK64FX512__", |
| 272 | "-DF_CPU=120000000", |
| 273 | "-Wl,--gc-sections", |
| 274 | "-D__have_long32", |
| 275 | "-fstack-protector", |
| 276 | "-mcpu=cortex-m4", |
| 277 | "-mfpu=fpv4-sp-d16", |
| 278 | "-mthumb", |
| 279 | "-mfloat-abi=hard", |
| 280 | "-fno-strict-aliasing", |
| 281 | "-fmessage-length=80", |
| 282 | "-fmax-errors=20", |
| 283 | "-Wall", |
| 284 | "-Wextra", |
| 285 | "-Wpointer-arith", |
| 286 | "-Wcast-qual", |
| 287 | "-Wwrite-strings", |
| 288 | "-Wtype-limits", |
| 289 | "-Wsign-compare", |
| 290 | "-Wformat=2", |
| 291 | "-Werror", |
| 292 | "-Wstrict-aliasing=2", |
| 293 | "-Wno-misleading-indentation", |
| 294 | "-Wno-int-in-bool-context", |
| 295 | "-Wdouble-promotion", |
| 296 | "-pipe", |
| 297 | "-g", |
| 298 | "-fno-common", |
Austin Schuh | da9d060 | 2019-09-15 17:29:38 -0700 | [diff] [blame] | 299 | "-fbuiltin", |
| 300 | ], |
| 301 | ), |
| 302 | ], |
| 303 | ), |
| 304 | flag_set( |
| 305 | actions = [ |
| 306 | ACTION_NAMES.assemble, |
| 307 | ACTION_NAMES.preprocess_assemble, |
| 308 | ACTION_NAMES.linkstamp_compile, |
| 309 | ACTION_NAMES.c_compile, |
| 310 | ACTION_NAMES.cpp_compile, |
| 311 | ACTION_NAMES.cpp_header_parsing, |
| 312 | ACTION_NAMES.cpp_module_compile, |
| 313 | ACTION_NAMES.cpp_module_codegen, |
| 314 | ACTION_NAMES.lto_backend, |
| 315 | ACTION_NAMES.clif_match, |
| 316 | ], |
| 317 | flag_groups = [ |
| 318 | flag_group( |
| 319 | flags = [ |
| 320 | "-O2", |
| 321 | "-finline-functions", |
| 322 | "-ffast-math", |
| 323 | "-funroll-loops", |
| 324 | "-DNDEBUG", |
| 325 | "-ffunction-sections", |
| 326 | ], |
| 327 | ), |
| 328 | ], |
| 329 | with_features = [with_feature_set(features = ["opt"])], |
| 330 | ), |
| 331 | ], |
| 332 | ) |
Brian Silverman | 94cab07 | 2022-01-02 23:50:03 -0800 | [diff] [blame] | 333 | elif ctx.attr.cpu == "rp2040": |
Austin Schuh | 0a96ea3 | 2022-01-01 22:29:30 -0800 | [diff] [blame] | 334 | default_compile_flags_feature = feature( |
| 335 | name = "default_compile_flags", |
| 336 | enabled = True, |
| 337 | flag_sets = [ |
| 338 | flag_set( |
| 339 | actions = [ |
| 340 | ACTION_NAMES.assemble, |
| 341 | ACTION_NAMES.preprocess_assemble, |
| 342 | ACTION_NAMES.linkstamp_compile, |
| 343 | ACTION_NAMES.c_compile, |
| 344 | ACTION_NAMES.cpp_compile, |
| 345 | ACTION_NAMES.cpp_header_parsing, |
| 346 | ACTION_NAMES.cpp_module_compile, |
| 347 | ACTION_NAMES.cpp_module_codegen, |
| 348 | ACTION_NAMES.lto_backend, |
| 349 | ACTION_NAMES.clif_match, |
| 350 | ], |
| 351 | flag_groups = [ |
| 352 | flag_group( |
| 353 | flags = [ |
| 354 | "-DPICO_BOARD=\"pico\"", |
| 355 | "-DPICO_BUILD=1", |
| 356 | "-DPICO_NO_HARDWARE=0", |
| 357 | "-DPICO_ON_DEVICE=1", |
| 358 | "-D__STDC_FORMAT_MACROS", |
| 359 | "-D__STDC_CONSTANT_MACROS", |
| 360 | "-D__STDC_LIMIT_MACROS", |
| 361 | "-Wl,--gc-sections", |
| 362 | "-fstack-protector", |
| 363 | "-mcpu=cortex-m0plus", |
| 364 | "-mthumb", |
| 365 | "-fno-strict-aliasing", |
| 366 | "-fmessage-length=80", |
| 367 | "-fmax-errors=20", |
| 368 | "-Wall", |
| 369 | "-Wextra", |
| 370 | "-Wpointer-arith", |
| 371 | "-Wcast-qual", |
| 372 | "-Wwrite-strings", |
| 373 | "-Wtype-limits", |
| 374 | "-Wsign-compare", |
| 375 | "-Wformat=2", |
| 376 | "-Werror", |
| 377 | "-Wstrict-aliasing=2", |
| 378 | "-Wno-misleading-indentation", |
| 379 | "-Wno-int-in-bool-context", |
| 380 | "-Wdouble-promotion", |
| 381 | "-pipe", |
| 382 | "-g", |
| 383 | ], |
| 384 | ), |
| 385 | ], |
| 386 | ), |
| 387 | flag_set( |
| 388 | actions = [ |
| 389 | ACTION_NAMES.assemble, |
| 390 | ACTION_NAMES.preprocess_assemble, |
| 391 | ACTION_NAMES.linkstamp_compile, |
| 392 | ACTION_NAMES.c_compile, |
| 393 | ACTION_NAMES.cpp_compile, |
| 394 | ACTION_NAMES.cpp_header_parsing, |
| 395 | ACTION_NAMES.cpp_module_compile, |
| 396 | ACTION_NAMES.cpp_module_codegen, |
| 397 | ACTION_NAMES.lto_backend, |
| 398 | ACTION_NAMES.clif_match, |
| 399 | ], |
| 400 | flag_groups = [ |
| 401 | flag_group( |
| 402 | flags = [ |
| 403 | "-O3", |
| 404 | "-finline-functions", |
| 405 | "-funroll-loops", |
| 406 | "-DNDEBUG", |
| 407 | "-ffunction-sections", |
| 408 | ], |
| 409 | ), |
| 410 | ], |
| 411 | with_features = [with_feature_set(features = ["opt"])], |
| 412 | ), |
| 413 | ], |
| 414 | ) |
Austin Schuh | da9d060 | 2019-09-15 17:29:38 -0700 | [diff] [blame] | 415 | else: |
| 416 | default_compile_flags_feature = None |
| 417 | |
Brian Silverman | 4c7235a | 2021-11-17 19:04:37 -0800 | [diff] [blame] | 418 | if ctx.attr.cpu == "roborio": |
Austin Schuh | da9d060 | 2019-09-15 17:29:38 -0700 | [diff] [blame] | 419 | dbg_feature = feature( |
| 420 | name = "dbg", |
| 421 | flag_sets = [ |
| 422 | flag_set( |
Brian Silverman | 7b53ae1 | 2022-05-22 21:40:57 -0700 | [diff] [blame] | 423 | actions = all_cpp_compile_actions + [ |
Austin Schuh | da9d060 | 2019-09-15 17:29:38 -0700 | [diff] [blame] | 424 | ACTION_NAMES.preprocess_assemble, |
| 425 | ACTION_NAMES.c_compile, |
Austin Schuh | da9d060 | 2019-09-15 17:29:38 -0700 | [diff] [blame] | 426 | ], |
| 427 | flag_groups = [ |
| 428 | flag_group(flags = ["-DAOS_DEBUG=1"]), |
| 429 | flag_group(flags = ["-fno-omit-frame-pointer"]), |
| 430 | ], |
| 431 | ), |
| 432 | ], |
| 433 | ) |
Austin Schuh | 0a96ea3 | 2022-01-01 22:29:30 -0800 | [diff] [blame] | 434 | elif (ctx.attr.cpu == "rp2040" or |
| 435 | ctx.attr.cpu == "cortex-m4f" or |
Austin Schuh | a2503a7 | 2020-12-15 20:57:57 -0800 | [diff] [blame] | 436 | ctx.attr.cpu == "cortex-m4f-k22"): |
Austin Schuh | da9d060 | 2019-09-15 17:29:38 -0700 | [diff] [blame] | 437 | dbg_feature = feature( |
| 438 | name = "dbg", |
| 439 | flag_sets = [ |
| 440 | flag_set( |
Brian Silverman | 7b53ae1 | 2022-05-22 21:40:57 -0700 | [diff] [blame] | 441 | actions = all_cpp_compile_actions + [ |
Austin Schuh | da9d060 | 2019-09-15 17:29:38 -0700 | [diff] [blame] | 442 | ACTION_NAMES.preprocess_assemble, |
| 443 | ACTION_NAMES.c_compile, |
Austin Schuh | da9d060 | 2019-09-15 17:29:38 -0700 | [diff] [blame] | 444 | ], |
| 445 | flag_groups = [flag_group(flags = ["-fno-omit-frame-pointer"])], |
| 446 | ), |
| 447 | ], |
| 448 | implies = ["all_modes"], |
| 449 | ) |
| 450 | else: |
| 451 | dbg_feature = None |
| 452 | |
Brian Silverman | 4c7235a | 2021-11-17 19:04:37 -0800 | [diff] [blame] | 453 | if ctx.attr.cpu == "roborio": |
Austin Schuh | da9d060 | 2019-09-15 17:29:38 -0700 | [diff] [blame] | 454 | fastbuild_feature = feature( |
| 455 | name = "fastbuild", |
| 456 | flag_sets = [ |
| 457 | flag_set( |
Brian Silverman | 7b53ae1 | 2022-05-22 21:40:57 -0700 | [diff] [blame] | 458 | actions = all_cpp_compile_actions + [ |
Austin Schuh | da9d060 | 2019-09-15 17:29:38 -0700 | [diff] [blame] | 459 | ACTION_NAMES.preprocess_assemble, |
| 460 | ACTION_NAMES.c_compile, |
Austin Schuh | da9d060 | 2019-09-15 17:29:38 -0700 | [diff] [blame] | 461 | ], |
| 462 | flag_groups = [flag_group(flags = ["-DAOS_DEBUG=0"])], |
| 463 | ), |
| 464 | ], |
| 465 | ) |
Austin Schuh | 0a96ea3 | 2022-01-01 22:29:30 -0800 | [diff] [blame] | 466 | elif (ctx.attr.cpu == "rp2040" or |
| 467 | ctx.attr.cpu == "cortex-m4f" or |
Austin Schuh | a2503a7 | 2020-12-15 20:57:57 -0800 | [diff] [blame] | 468 | ctx.attr.cpu == "cortex-m4f-k22"): |
Austin Schuh | da9d060 | 2019-09-15 17:29:38 -0700 | [diff] [blame] | 469 | fastbuild_feature = feature(name = "fastbuild", implies = ["all_modes"]) |
| 470 | else: |
| 471 | fastbuild_feature = None |
| 472 | |
| 473 | pie_for_linking_feature = feature( |
| 474 | name = "pie_for_linking", |
| 475 | enabled = True, |
| 476 | flag_sets = [ |
| 477 | flag_set( |
| 478 | actions = [ACTION_NAMES.cpp_link_executable], |
| 479 | flag_groups = [flag_group(flags = ["-pie"])], |
| 480 | ), |
| 481 | ], |
| 482 | ) |
| 483 | |
Brian Silverman | 94cab07 | 2022-01-02 23:50:03 -0800 | [diff] [blame] | 484 | if ctx.attr.cpu == "roborio": |
Austin Schuh | da9d060 | 2019-09-15 17:29:38 -0700 | [diff] [blame] | 485 | opt_feature = feature( |
| 486 | name = "opt", |
| 487 | flag_sets = [ |
| 488 | flag_set( |
| 489 | actions = [ |
| 490 | ACTION_NAMES.assemble, |
| 491 | ACTION_NAMES.preprocess_assemble, |
| 492 | ACTION_NAMES.c_compile, |
| 493 | ACTION_NAMES.cpp_compile, |
| 494 | ACTION_NAMES.cpp_module_compile, |
| 495 | ACTION_NAMES.objc_compile, |
| 496 | ACTION_NAMES.objcpp_compile, |
| 497 | ACTION_NAMES.cpp_header_parsing, |
| 498 | ACTION_NAMES.linkstamp_compile, |
| 499 | ], |
| 500 | flag_groups = [ |
| 501 | flag_group( |
| 502 | flags = [ |
| 503 | "-O2", |
| 504 | "-DNDEBUG", |
| 505 | "-D_FORTIFY_SOURCE=1", |
| 506 | "-ffunction-sections", |
| 507 | "-fdata-sections", |
| 508 | ], |
| 509 | ), |
| 510 | ], |
| 511 | ), |
| 512 | flag_set( |
| 513 | actions = [ |
| 514 | ACTION_NAMES.cpp_link_executable, |
| 515 | ACTION_NAMES.cpp_link_nodeps_dynamic_library, |
| 516 | ACTION_NAMES.cpp_link_dynamic_library, |
| 517 | ], |
| 518 | flag_groups = [flag_group(flags = ["-Wl,--gc-sections"])], |
| 519 | ), |
| 520 | ], |
| 521 | implies = ["opt_post"], |
| 522 | ) |
Austin Schuh | 0a96ea3 | 2022-01-01 22:29:30 -0800 | [diff] [blame] | 523 | elif (ctx.attr.cpu == "rp2040" or |
| 524 | ctx.attr.cpu == "cortex-m4f" or |
Austin Schuh | a2503a7 | 2020-12-15 20:57:57 -0800 | [diff] [blame] | 525 | ctx.attr.cpu == "cortex-m4f-k22"): |
Austin Schuh | da9d060 | 2019-09-15 17:29:38 -0700 | [diff] [blame] | 526 | opt_feature = feature(name = "opt", implies = ["all_modes"]) |
| 527 | else: |
| 528 | opt_feature = None |
| 529 | |
| 530 | pic_feature = feature( |
| 531 | name = "pic", |
| 532 | enabled = True, |
| 533 | flag_sets = [ |
| 534 | flag_set( |
| 535 | actions = [ |
| 536 | ACTION_NAMES.assemble, |
| 537 | ACTION_NAMES.preprocess_assemble, |
| 538 | ACTION_NAMES.linkstamp_compile, |
| 539 | ACTION_NAMES.c_compile, |
| 540 | ACTION_NAMES.cpp_compile, |
| 541 | ACTION_NAMES.cpp_module_codegen, |
| 542 | ACTION_NAMES.cpp_module_compile, |
| 543 | ], |
| 544 | flag_groups = [ |
| 545 | flag_group(flags = ["-fPIC"], expand_if_available = "pic"), |
| 546 | ], |
| 547 | ), |
| 548 | ], |
| 549 | ) |
| 550 | |
Austin Schuh | 0a96ea3 | 2022-01-01 22:29:30 -0800 | [diff] [blame] | 551 | if (ctx.attr.cpu == "rp2040" or |
| 552 | ctx.attr.cpu == "cortex-m4f" or |
Austin Schuh | a2503a7 | 2020-12-15 20:57:57 -0800 | [diff] [blame] | 553 | ctx.attr.cpu == "cortex-m4f-k22"): |
Austin Schuh | da9d060 | 2019-09-15 17:29:38 -0700 | [diff] [blame] | 554 | include_paths_feature = feature( |
| 555 | name = "include_paths", |
| 556 | enabled = True, |
| 557 | flag_sets = [ |
| 558 | flag_set( |
Brian Silverman | 7b53ae1 | 2022-05-22 21:40:57 -0700 | [diff] [blame] | 559 | actions = all_cpp_compile_actions + [ |
Austin Schuh | da9d060 | 2019-09-15 17:29:38 -0700 | [diff] [blame] | 560 | ACTION_NAMES.preprocess_assemble, |
| 561 | ACTION_NAMES.c_compile, |
Austin Schuh | da9d060 | 2019-09-15 17:29:38 -0700 | [diff] [blame] | 562 | ], |
| 563 | flag_groups = [ |
| 564 | flag_group( |
| 565 | flags = ["-iquote", "%{quote_include_paths}"], |
| 566 | iterate_over = "quote_include_paths", |
| 567 | ), |
| 568 | flag_group( |
| 569 | flags = ["-I%{include_paths}"], |
| 570 | iterate_over = "include_paths", |
| 571 | ), |
| 572 | flag_group( |
| 573 | flags = ["-I", "%{system_include_paths}"], |
| 574 | iterate_over = "system_include_paths", |
| 575 | ), |
| 576 | ], |
| 577 | ), |
| 578 | ], |
| 579 | ) |
Brian Silverman | 94cab07 | 2022-01-02 23:50:03 -0800 | [diff] [blame] | 580 | elif ctx.attr.cpu == "roborio": |
Austin Schuh | da9d060 | 2019-09-15 17:29:38 -0700 | [diff] [blame] | 581 | include_paths_feature = feature( |
| 582 | name = "include_paths", |
| 583 | enabled = True, |
| 584 | flag_sets = [ |
| 585 | flag_set( |
Brian Silverman | 7b53ae1 | 2022-05-22 21:40:57 -0700 | [diff] [blame] | 586 | actions = all_cpp_compile_actions + [ |
Austin Schuh | da9d060 | 2019-09-15 17:29:38 -0700 | [diff] [blame] | 587 | ACTION_NAMES.preprocess_assemble, |
| 588 | ACTION_NAMES.c_compile, |
Austin Schuh | da9d060 | 2019-09-15 17:29:38 -0700 | [diff] [blame] | 589 | ], |
| 590 | flag_groups = [ |
| 591 | flag_group( |
| 592 | flags = ["-iquote", "%{quote_include_paths}"], |
| 593 | iterate_over = "quote_include_paths", |
| 594 | ), |
| 595 | flag_group( |
| 596 | flags = ["-I%{include_paths}"], |
| 597 | iterate_over = "include_paths", |
| 598 | ), |
| 599 | flag_group( |
| 600 | flags = ["-isystem", "%{system_include_paths}"], |
| 601 | iterate_over = "system_include_paths", |
| 602 | ), |
| 603 | ], |
| 604 | ), |
| 605 | ], |
| 606 | ) |
| 607 | else: |
| 608 | include_paths_feature = None |
| 609 | |
| 610 | random_seed_feature = feature( |
| 611 | name = "random_seed", |
| 612 | enabled = True, |
| 613 | flag_sets = [ |
| 614 | flag_set( |
| 615 | actions = [ |
| 616 | ACTION_NAMES.cpp_compile, |
| 617 | ACTION_NAMES.cpp_module_codegen, |
| 618 | ACTION_NAMES.cpp_module_compile, |
| 619 | ], |
| 620 | flag_groups = [ |
| 621 | flag_group( |
| 622 | flags = ["-frandom-seed=%{output_file}"], |
| 623 | expand_if_available = "output_file", |
| 624 | ), |
| 625 | ], |
| 626 | ), |
| 627 | ], |
| 628 | ) |
| 629 | |
Brian Silverman | 94cab07 | 2022-01-02 23:50:03 -0800 | [diff] [blame] | 630 | if ctx.attr.cpu == "roborio": |
Austin Schuh | da9d060 | 2019-09-15 17:29:38 -0700 | [diff] [blame] | 631 | default_link_flags_feature = feature( |
| 632 | name = "default_link_flags", |
| 633 | enabled = True, |
| 634 | flag_sets = [ |
| 635 | flag_set( |
| 636 | actions = all_link_actions, |
| 637 | flag_groups = [ |
| 638 | flag_group( |
| 639 | flags = [ |
| 640 | "-lstdc++", |
| 641 | "-Ltools/cpp/arm-frc-linux-gnueabi/libs", |
| 642 | "-no-canonical-prefixes", |
| 643 | "-Wl,-z,relro,-z,now", |
| 644 | "-lm", |
| 645 | "-pass-exit-codes", |
| 646 | "-Wl,--build-id=md5", |
| 647 | "-Wl,--hash-style=gnu", |
| 648 | ], |
| 649 | ), |
| 650 | ], |
| 651 | ), |
| 652 | ], |
| 653 | ) |
Brian Silverman | 94cab07 | 2022-01-02 23:50:03 -0800 | [diff] [blame] | 654 | elif ctx.attr.cpu == "cortex-m4f-k22": |
Austin Schuh | da9d060 | 2019-09-15 17:29:38 -0700 | [diff] [blame] | 655 | default_link_flags_feature = feature( |
| 656 | name = "default_link_flags", |
| 657 | enabled = True, |
| 658 | flag_sets = [ |
| 659 | flag_set( |
| 660 | actions = all_link_actions, |
| 661 | flag_groups = [ |
| 662 | flag_group( |
| 663 | flags = [ |
| 664 | "-no-canonical-prefixes", |
| 665 | "-mcpu=cortex-m4", |
| 666 | "-mfpu=fpv4-sp-d16", |
| 667 | "-mthumb", |
| 668 | "-mfloat-abi=hard", |
| 669 | "-fno-strict-aliasing", |
| 670 | "--specs=nano.specs", |
| 671 | "-lgcc", |
| 672 | "-lstdc++_nano", |
| 673 | "-lm", |
| 674 | "-lc_nano", |
| 675 | "-Tmotors/core/kinetis_512_128.ld", |
| 676 | "-Tmotors/core/kinetis_sections.ld", |
| 677 | ], |
| 678 | ), |
| 679 | ], |
| 680 | ), |
| 681 | flag_set( |
| 682 | actions = all_link_actions, |
| 683 | flag_groups = [flag_group(flags = ["-Wl,--gc-sections"])], |
| 684 | with_features = [with_feature_set(features = ["opt"])], |
| 685 | ), |
| 686 | ], |
| 687 | ) |
Brian Silverman | 94cab07 | 2022-01-02 23:50:03 -0800 | [diff] [blame] | 688 | elif ctx.attr.cpu == "cortex-m4f": |
Austin Schuh | da9d060 | 2019-09-15 17:29:38 -0700 | [diff] [blame] | 689 | default_link_flags_feature = feature( |
| 690 | name = "default_link_flags", |
| 691 | enabled = True, |
| 692 | flag_sets = [ |
| 693 | flag_set( |
| 694 | actions = all_link_actions, |
| 695 | flag_groups = [ |
| 696 | flag_group( |
| 697 | flags = [ |
| 698 | "-no-canonical-prefixes", |
| 699 | "-mcpu=cortex-m4", |
| 700 | "-mfpu=fpv4-sp-d16", |
| 701 | "-mthumb", |
| 702 | "-mfloat-abi=hard", |
| 703 | "-fno-strict-aliasing", |
| 704 | "--specs=nano.specs", |
| 705 | "-lgcc", |
| 706 | "-lstdc++_nano", |
| 707 | "-lm", |
| 708 | "-lc_nano", |
| 709 | "-Tmotors/core/kinetis_512_256.ld", |
| 710 | "-Tmotors/core/kinetis_sections.ld", |
| 711 | ], |
| 712 | ), |
| 713 | ], |
| 714 | ), |
| 715 | flag_set( |
| 716 | actions = all_link_actions, |
| 717 | flag_groups = [flag_group(flags = ["-Wl,--gc-sections"])], |
| 718 | with_features = [with_feature_set(features = ["opt"])], |
| 719 | ), |
| 720 | ], |
| 721 | ) |
Brian Silverman | 94cab07 | 2022-01-02 23:50:03 -0800 | [diff] [blame] | 722 | elif ctx.attr.cpu == "rp2040": |
Austin Schuh | 0a96ea3 | 2022-01-01 22:29:30 -0800 | [diff] [blame] | 723 | default_link_flags_feature = feature( |
| 724 | name = "default_link_flags", |
| 725 | enabled = True, |
| 726 | flag_sets = [ |
| 727 | flag_set( |
| 728 | actions = all_link_actions, |
| 729 | flag_groups = [ |
| 730 | flag_group( |
| 731 | flags = [ |
| 732 | "-no-canonical-prefixes", |
| 733 | "-mcpu=cortex-m0plus", |
| 734 | "-mthumb", |
| 735 | "-fno-strict-aliasing", |
| 736 | "-Wl,--build-id=none", |
| 737 | "--specs=nosys.specs", |
| 738 | "-nostartfiles", |
| 739 | ], |
| 740 | ), |
| 741 | ], |
| 742 | ), |
| 743 | # TODO(austin): I'd love to turn --gc-sections on, but that breaks things. |
| 744 | ], |
| 745 | ) |
Austin Schuh | da9d060 | 2019-09-15 17:29:38 -0700 | [diff] [blame] | 746 | else: |
| 747 | default_link_flags_feature = None |
| 748 | |
Brian Silverman | 94cab07 | 2022-01-02 23:50:03 -0800 | [diff] [blame] | 749 | if ctx.attr.cpu == "roborio": |
Austin Schuh | da9d060 | 2019-09-15 17:29:38 -0700 | [diff] [blame] | 750 | all_modes_feature = feature( |
| 751 | name = "all_modes", |
| 752 | enabled = True, |
| 753 | flag_sets = [ |
| 754 | flag_set( |
| 755 | actions = [ |
| 756 | ACTION_NAMES.preprocess_assemble, |
| 757 | ACTION_NAMES.assemble, |
| 758 | ACTION_NAMES.c_compile, |
| 759 | ], |
| 760 | flag_groups = [flag_group(flags = ["-std=gnu99"])], |
| 761 | ), |
| 762 | flag_set( |
Brian Silverman | 7b53ae1 | 2022-05-22 21:40:57 -0700 | [diff] [blame] | 763 | actions = all_cpp_compile_actions, |
Austin Schuh | da9d060 | 2019-09-15 17:29:38 -0700 | [diff] [blame] | 764 | flag_groups = [ |
| 765 | flag_group( |
James Kuszmaul | 9776b39 | 2023-01-14 14:08:08 -0800 | [diff] [blame] | 766 | flags = ["-std=gnu++20", "-fno-sized-deallocation"], |
Austin Schuh | da9d060 | 2019-09-15 17:29:38 -0700 | [diff] [blame] | 767 | ), |
| 768 | ], |
| 769 | ), |
| 770 | flag_set( |
Brian Silverman | 7b53ae1 | 2022-05-22 21:40:57 -0700 | [diff] [blame] | 771 | actions = all_cpp_compile_actions + [ |
Austin Schuh | da9d060 | 2019-09-15 17:29:38 -0700 | [diff] [blame] | 772 | ACTION_NAMES.preprocess_assemble, |
| 773 | ACTION_NAMES.assemble, |
| 774 | "c++-link", |
Austin Schuh | da9d060 | 2019-09-15 17:29:38 -0700 | [diff] [blame] | 775 | ACTION_NAMES.c_compile, |
| 776 | ], |
| 777 | flag_groups = [flag_group(flags = ["-pthread"])], |
| 778 | ), |
| 779 | ], |
| 780 | ) |
Austin Schuh | 0a96ea3 | 2022-01-01 22:29:30 -0800 | [diff] [blame] | 781 | elif (ctx.attr.cpu == "rp2040" or |
| 782 | ctx.attr.cpu == "cortex-m4f" or |
Austin Schuh | a2503a7 | 2020-12-15 20:57:57 -0800 | [diff] [blame] | 783 | ctx.attr.cpu == "cortex-m4f-k22"): |
Austin Schuh | da9d060 | 2019-09-15 17:29:38 -0700 | [diff] [blame] | 784 | all_modes_feature = feature( |
| 785 | name = "all_modes", |
| 786 | flag_sets = [ |
| 787 | flag_set( |
| 788 | actions = [ |
| 789 | ACTION_NAMES.preprocess_assemble, |
| 790 | ACTION_NAMES.assemble, |
| 791 | ACTION_NAMES.c_compile, |
| 792 | ], |
Austin Schuh | 0a96ea3 | 2022-01-01 22:29:30 -0800 | [diff] [blame] | 793 | flag_groups = [flag_group(flags = ["--std=gnu11"])], |
Austin Schuh | da9d060 | 2019-09-15 17:29:38 -0700 | [diff] [blame] | 794 | ), |
| 795 | flag_set( |
Brian Silverman | 7b53ae1 | 2022-05-22 21:40:57 -0700 | [diff] [blame] | 796 | actions = all_cpp_compile_actions, |
Austin Schuh | da9d060 | 2019-09-15 17:29:38 -0700 | [diff] [blame] | 797 | flag_groups = [ |
| 798 | flag_group( |
James Kuszmaul | ef420da | 2023-12-27 12:02:15 -0800 | [diff] [blame^] | 799 | flags = ["--std=gnu++20", "-fno-exceptions", "-fno-rtti"], |
Austin Schuh | da9d060 | 2019-09-15 17:29:38 -0700 | [diff] [blame] | 800 | ), |
| 801 | ], |
| 802 | ), |
| 803 | ], |
| 804 | ) |
Austin Schuh | da9d060 | 2019-09-15 17:29:38 -0700 | [diff] [blame] | 805 | else: |
| 806 | all_modes_feature = None |
| 807 | |
| 808 | supports_dynamic_linker_feature = feature(name = "supports_dynamic_linker", enabled = True) |
| 809 | |
Brian Silverman | 4c7235a | 2021-11-17 19:04:37 -0800 | [diff] [blame] | 810 | if (ctx.attr.cpu == "rp2040" or |
| 811 | ctx.attr.cpu == "cortex-m4f" or |
| 812 | ctx.attr.cpu == "cortex-m4f-k22" or |
| 813 | ctx.attr.cpu == "roborio"): |
Austin Schuh | da9d060 | 2019-09-15 17:29:38 -0700 | [diff] [blame] | 814 | unfiltered_compile_flags_feature = feature( |
| 815 | name = "unfiltered_compile_flags", |
| 816 | enabled = True, |
| 817 | flag_sets = [ |
| 818 | flag_set( |
| 819 | actions = [ |
| 820 | ACTION_NAMES.assemble, |
| 821 | ACTION_NAMES.preprocess_assemble, |
| 822 | ACTION_NAMES.linkstamp_compile, |
| 823 | ACTION_NAMES.c_compile, |
| 824 | ACTION_NAMES.cpp_compile, |
| 825 | ACTION_NAMES.cpp_header_parsing, |
| 826 | ACTION_NAMES.cpp_module_compile, |
| 827 | ACTION_NAMES.cpp_module_codegen, |
| 828 | ACTION_NAMES.lto_backend, |
| 829 | ACTION_NAMES.clif_match, |
| 830 | ], |
| 831 | flag_groups = [ |
| 832 | flag_group( |
| 833 | flags = [ |
| 834 | "-no-canonical-prefixes", |
| 835 | "-Wno-builtin-macro-redefined", |
| 836 | "-D__DATE__=\"redacted\"", |
| 837 | "-D__TIMESTAMP__=\"redacted\"", |
| 838 | "-D__TIME__=\"redacted\"", |
Austin Schuh | da9d060 | 2019-09-15 17:29:38 -0700 | [diff] [blame] | 839 | ], |
| 840 | ), |
| 841 | ], |
| 842 | ), |
| 843 | ], |
| 844 | ) |
| 845 | else: |
| 846 | unfiltered_compile_flags_feature = None |
| 847 | |
| 848 | dependency_file_feature = feature( |
| 849 | name = "dependency_file", |
| 850 | enabled = True, |
| 851 | flag_sets = [ |
| 852 | flag_set( |
| 853 | actions = [ |
| 854 | ACTION_NAMES.assemble, |
| 855 | ACTION_NAMES.preprocess_assemble, |
| 856 | ACTION_NAMES.c_compile, |
| 857 | ACTION_NAMES.cpp_compile, |
| 858 | ACTION_NAMES.cpp_module_compile, |
| 859 | ACTION_NAMES.objc_compile, |
| 860 | ACTION_NAMES.objcpp_compile, |
| 861 | ACTION_NAMES.cpp_header_parsing, |
| 862 | ACTION_NAMES.clif_match, |
| 863 | ], |
| 864 | flag_groups = [ |
| 865 | flag_group( |
| 866 | flags = ["-MD", "-MF", "%{dependency_file}"], |
| 867 | expand_if_available = "dependency_file", |
| 868 | ), |
| 869 | ], |
| 870 | ), |
| 871 | ], |
| 872 | ) |
| 873 | |
Austin Schuh | da9d060 | 2019-09-15 17:29:38 -0700 | [diff] [blame] | 874 | user_compile_flags_feature = feature( |
| 875 | name = "user_compile_flags", |
| 876 | enabled = True, |
| 877 | flag_sets = [ |
| 878 | flag_set( |
| 879 | actions = [ |
| 880 | ACTION_NAMES.assemble, |
| 881 | ACTION_NAMES.preprocess_assemble, |
| 882 | ACTION_NAMES.linkstamp_compile, |
| 883 | ACTION_NAMES.c_compile, |
| 884 | ACTION_NAMES.cpp_compile, |
| 885 | ACTION_NAMES.cpp_header_parsing, |
| 886 | ACTION_NAMES.cpp_module_compile, |
| 887 | ACTION_NAMES.cpp_module_codegen, |
| 888 | ACTION_NAMES.lto_backend, |
| 889 | ACTION_NAMES.clif_match, |
| 890 | ], |
| 891 | flag_groups = [ |
| 892 | flag_group( |
| 893 | flags = ["%{user_compile_flags}"], |
| 894 | iterate_over = "user_compile_flags", |
| 895 | expand_if_available = "user_compile_flags", |
| 896 | ), |
| 897 | ], |
| 898 | ), |
| 899 | ], |
| 900 | ) |
| 901 | |
| 902 | sysroot_feature = feature( |
| 903 | name = "sysroot", |
| 904 | enabled = True, |
| 905 | flag_sets = [ |
| 906 | flag_set( |
| 907 | actions = [ |
| 908 | ACTION_NAMES.preprocess_assemble, |
| 909 | ACTION_NAMES.linkstamp_compile, |
| 910 | ACTION_NAMES.c_compile, |
| 911 | ACTION_NAMES.cpp_compile, |
| 912 | ACTION_NAMES.cpp_header_parsing, |
| 913 | ACTION_NAMES.cpp_module_compile, |
| 914 | ACTION_NAMES.cpp_module_codegen, |
| 915 | ACTION_NAMES.lto_backend, |
| 916 | ACTION_NAMES.clif_match, |
| 917 | ACTION_NAMES.cpp_link_executable, |
| 918 | ACTION_NAMES.cpp_link_dynamic_library, |
| 919 | ACTION_NAMES.cpp_link_nodeps_dynamic_library, |
| 920 | ], |
| 921 | flag_groups = [ |
| 922 | flag_group( |
| 923 | flags = ["--sysroot=%{sysroot}"], |
| 924 | expand_if_available = "sysroot", |
| 925 | ), |
| 926 | ], |
| 927 | ), |
| 928 | ], |
| 929 | ) |
| 930 | |
| 931 | compile_flags1_feature = feature( |
| 932 | name = "compile_flags1", |
| 933 | enabled = True, |
| 934 | flag_sets = [ |
| 935 | flag_set( |
| 936 | actions = [ |
| 937 | ACTION_NAMES.assemble, |
| 938 | ACTION_NAMES.preprocess_assemble, |
| 939 | ACTION_NAMES.c_compile, |
| 940 | ACTION_NAMES.cpp_compile, |
| 941 | ACTION_NAMES.cpp_header_parsing, |
| 942 | ACTION_NAMES.cpp_module_compile, |
| 943 | ACTION_NAMES.cpp_module_codegen, |
| 944 | ACTION_NAMES.lto_backend, |
| 945 | ACTION_NAMES.clif_match, |
| 946 | ], |
| 947 | flag_groups = [ |
| 948 | flag_group( |
| 949 | flags = [ |
James Kuszmaul | 9776b39 | 2023-01-14 14:08:08 -0800 | [diff] [blame] | 950 | "--sysroot=external/arm_frc_linux_gnueabi_repo/arm-nilrt-linux-gnueabi/sysroot", |
Austin Schuh | da9d060 | 2019-09-15 17:29:38 -0700 | [diff] [blame] | 951 | "-nostdinc", |
| 952 | "-isystem", |
James Kuszmaul | 9776b39 | 2023-01-14 14:08:08 -0800 | [diff] [blame] | 953 | "external/arm_frc_linux_gnueabi_repo/arm-nilrt-linux-gnueabi/sysroot/usr/lib/gcc/arm-nilrt-linux-gnueabi/12/include", |
Austin Schuh | da9d060 | 2019-09-15 17:29:38 -0700 | [diff] [blame] | 954 | "-isystem", |
James Kuszmaul | 9776b39 | 2023-01-14 14:08:08 -0800 | [diff] [blame] | 955 | "external/arm_frc_linux_gnueabi_repo/arm-nilrt-linux-gnueabi/sysroot/usr/lib/gcc/arm-nilrt-linux-gnueabi/12/include-fixed", |
Austin Schuh | da9d060 | 2019-09-15 17:29:38 -0700 | [diff] [blame] | 956 | ], |
| 957 | ), |
| 958 | ], |
| 959 | ), |
| 960 | flag_set( |
Brian Silverman | 7b53ae1 | 2022-05-22 21:40:57 -0700 | [diff] [blame] | 961 | actions = all_cpp_compile_actions + [ |
Austin Schuh | da9d060 | 2019-09-15 17:29:38 -0700 | [diff] [blame] | 962 | ACTION_NAMES.assemble, |
| 963 | ACTION_NAMES.preprocess_assemble, |
Austin Schuh | da9d060 | 2019-09-15 17:29:38 -0700 | [diff] [blame] | 964 | ], |
| 965 | flag_groups = [flag_group(flags = ["-fno-canonical-system-headers"])], |
| 966 | ), |
| 967 | flag_set( |
| 968 | actions = [ |
| 969 | ACTION_NAMES.cpp_compile, |
| 970 | ACTION_NAMES.cpp_header_parsing, |
| 971 | ACTION_NAMES.cpp_module_compile, |
| 972 | ACTION_NAMES.cpp_module_codegen, |
| 973 | ], |
| 974 | flag_groups = [ |
| 975 | flag_group( |
| 976 | flags = [ |
| 977 | "-isystem", |
James Kuszmaul | 9776b39 | 2023-01-14 14:08:08 -0800 | [diff] [blame] | 978 | "external/arm_frc_linux_gnueabi_repo/arm-nilrt-linux-gnueabi/sysroot/usr/include/c++/12", |
Austin Schuh | da9d060 | 2019-09-15 17:29:38 -0700 | [diff] [blame] | 979 | "-isystem", |
James Kuszmaul | 9776b39 | 2023-01-14 14:08:08 -0800 | [diff] [blame] | 980 | "external/arm_frc_linux_gnueabi_repo/arm-nilrt-linux-gnueabi/sysroot/usr/include/c++/12/arm-nilrt-linux-gnueabi", |
Austin Schuh | da9d060 | 2019-09-15 17:29:38 -0700 | [diff] [blame] | 981 | "-isystem", |
James Kuszmaul | 9776b39 | 2023-01-14 14:08:08 -0800 | [diff] [blame] | 982 | "external/arm_frc_linux_gnueabi_repo/arm-nilrt-linux-gnueabi/sysroot/usr/include/c++/12/backward", |
Austin Schuh | da9d060 | 2019-09-15 17:29:38 -0700 | [diff] [blame] | 983 | ], |
| 984 | ), |
| 985 | ], |
| 986 | ), |
| 987 | flag_set( |
| 988 | actions = [ |
| 989 | ACTION_NAMES.assemble, |
| 990 | ACTION_NAMES.preprocess_assemble, |
| 991 | ACTION_NAMES.c_compile, |
| 992 | ACTION_NAMES.cpp_compile, |
| 993 | ACTION_NAMES.cpp_header_parsing, |
| 994 | ACTION_NAMES.cpp_module_compile, |
| 995 | ACTION_NAMES.cpp_module_codegen, |
| 996 | ACTION_NAMES.lto_backend, |
| 997 | ACTION_NAMES.clif_match, |
| 998 | ], |
| 999 | flag_groups = [ |
| 1000 | flag_group( |
| 1001 | flags = [ |
| 1002 | "-isystem", |
James Kuszmaul | 9776b39 | 2023-01-14 14:08:08 -0800 | [diff] [blame] | 1003 | "external/arm_frc_linux_gnueabi_repo/arm-nilrt-linux-gnueabi/sysroot/usr/include", |
Austin Schuh | da9d060 | 2019-09-15 17:29:38 -0700 | [diff] [blame] | 1004 | "-mfpu=neon", |
| 1005 | "-D__STDC_FORMAT_MACROS", |
| 1006 | "-D__STDC_CONSTANT_MACROS", |
| 1007 | "-D__STDC_LIMIT_MACROS", |
| 1008 | "-D_FILE_OFFSET_BITS=64", |
| 1009 | "-DAOS_ARCHITECTURE_arm_frc", |
| 1010 | "-U_FORTIFY_SOURCE", |
| 1011 | "-fstack-protector", |
| 1012 | "-fPIE", |
| 1013 | "-fdiagnostics-color=always", |
| 1014 | "-Wall", |
| 1015 | "-Wextra", |
| 1016 | "-Wpointer-arith", |
| 1017 | "-Wstrict-aliasing", |
| 1018 | "-Wcast-qual", |
| 1019 | "-Wwrite-strings", |
| 1020 | "-Wtype-limits", |
| 1021 | "-Wsign-compare", |
| 1022 | "-Wformat=2", |
| 1023 | "-Werror", |
| 1024 | "-Wunused-local-typedefs", |
| 1025 | "-Wno-psabi", |
| 1026 | "-fno-omit-frame-pointer", |
| 1027 | "-D__has_feature(x)=0", |
| 1028 | "-pipe", |
| 1029 | "-ggdb3", |
| 1030 | ], |
| 1031 | ), |
| 1032 | ], |
| 1033 | ), |
| 1034 | ], |
| 1035 | ) |
| 1036 | |
Austin Schuh | 0a96ea3 | 2022-01-01 22:29:30 -0800 | [diff] [blame] | 1037 | if (ctx.attr.cpu == "rp2040" or |
| 1038 | ctx.attr.cpu == "cortex-m4f" or |
Austin Schuh | a2503a7 | 2020-12-15 20:57:57 -0800 | [diff] [blame] | 1039 | ctx.attr.cpu == "cortex-m4f-k22"): |
Austin Schuh | da9d060 | 2019-09-15 17:29:38 -0700 | [diff] [blame] | 1040 | features = [ |
Austin Schuh | a2503a7 | 2020-12-15 20:57:57 -0800 | [diff] [blame] | 1041 | default_compile_flags_feature, |
| 1042 | default_link_flags_feature, |
| 1043 | dbg_feature, |
| 1044 | opt_feature, |
| 1045 | fastbuild_feature, |
| 1046 | all_modes_feature, |
| 1047 | include_paths_feature, |
Austin Schuh | a2503a7 | 2020-12-15 20:57:57 -0800 | [diff] [blame] | 1048 | user_compile_flags_feature, |
| 1049 | sysroot_feature, |
| 1050 | unfiltered_compile_flags_feature, |
| 1051 | ] |
Brian Silverman | 94cab07 | 2022-01-02 23:50:03 -0800 | [diff] [blame] | 1052 | elif ctx.attr.cpu == "roborio": |
Austin Schuh | da9d060 | 2019-09-15 17:29:38 -0700 | [diff] [blame] | 1053 | features = [ |
Austin Schuh | a2503a7 | 2020-12-15 20:57:57 -0800 | [diff] [blame] | 1054 | default_link_flags_feature, |
| 1055 | compile_flags1_feature, |
| 1056 | opt_feature, |
| 1057 | dependency_file_feature, |
| 1058 | random_seed_feature, |
| 1059 | pic_feature, |
| 1060 | include_paths_feature, |
| 1061 | opt_post_feature, |
| 1062 | dbg_feature, |
| 1063 | fastbuild_feature, |
| 1064 | all_modes_feature, |
| 1065 | pie_for_linking_feature, |
| 1066 | supports_dynamic_linker_feature, |
| 1067 | supports_pic_feature, |
Austin Schuh | a2503a7 | 2020-12-15 20:57:57 -0800 | [diff] [blame] | 1068 | user_compile_flags_feature, |
| 1069 | sysroot_feature, |
| 1070 | unfiltered_compile_flags_feature, |
| 1071 | ] |
Austin Schuh | da9d060 | 2019-09-15 17:29:38 -0700 | [diff] [blame] | 1072 | else: |
| 1073 | fail("Unreachable") |
| 1074 | |
Brian Silverman | 33ca369 | 2022-02-06 18:37:17 -0800 | [diff] [blame] | 1075 | if ctx.attr.cpu == "roborio": |
Austin Schuh | da9d060 | 2019-09-15 17:29:38 -0700 | [diff] [blame] | 1076 | cxx_builtin_include_directories = [ |
James Kuszmaul | 9776b39 | 2023-01-14 14:08:08 -0800 | [diff] [blame] | 1077 | "%package(@arm_frc_linux_gnueabi_repo//arm-nilrt-linux-gnueabi/sysroot/usr/lib/gcc/arm-nilrt-linux-gnueabi/12/include)%", |
| 1078 | "%package(@arm_frc_linux_gnueabi_repo//arm-nilrt-linux-gnueabi/sysroot/usr/lib/gcc/arm-nilrt-linux-gnueabi/12/include-fixed)%", |
| 1079 | "%package(@arm_frc_linux_gnueabi_repo//arm-nilrt-linux-gnueabi/sysroot/usr/include/c++/12/arm-nilrt-linux-gnueabi)%", |
| 1080 | "%package(@arm_frc_linux_gnueabi_repo//arm-nilrt-linux-gnueabi/sysroot/usr/include/c++/12/backward)%", |
Austin Schuh | a2503a7 | 2020-12-15 20:57:57 -0800 | [diff] [blame] | 1081 | ] |
Austin Schuh | 0a96ea3 | 2022-01-01 22:29:30 -0800 | [diff] [blame] | 1082 | elif (ctx.attr.cpu == "rp2040" or |
| 1083 | ctx.attr.cpu == "cortex-m4f" or |
Austin Schuh | a2503a7 | 2020-12-15 20:57:57 -0800 | [diff] [blame] | 1084 | ctx.attr.cpu == "cortex-m4f-k22"): |
Austin Schuh | da9d060 | 2019-09-15 17:29:38 -0700 | [diff] [blame] | 1085 | cxx_builtin_include_directories = [ |
Austin Schuh | a2503a7 | 2020-12-15 20:57:57 -0800 | [diff] [blame] | 1086 | "/usr/lib/gcc/arm-none-eabi/4.8/include", |
| 1087 | "/usr/lib/gcc/arm-none-eabi/4.8/include-fixed", |
| 1088 | "/usr/lib/arm-none-eabi/include", |
| 1089 | "/usr/include/newlib", |
| 1090 | ] |
Austin Schuh | da9d060 | 2019-09-15 17:29:38 -0700 | [diff] [blame] | 1091 | else: |
| 1092 | fail("Unreachable") |
| 1093 | |
| 1094 | artifact_name_patterns = [] |
| 1095 | |
| 1096 | make_variables = [] |
| 1097 | |
Brian Silverman | 94cab07 | 2022-01-02 23:50:03 -0800 | [diff] [blame] | 1098 | if ctx.attr.cpu == "roborio": |
Austin Schuh | da9d060 | 2019-09-15 17:29:38 -0700 | [diff] [blame] | 1099 | tool_paths = [ |
| 1100 | tool_path( |
| 1101 | name = "ar", |
| 1102 | path = "arm-frc-linux-gnueabi/arm-frc-linux-gnueabi-ar", |
| 1103 | ), |
| 1104 | tool_path( |
| 1105 | name = "as", |
| 1106 | path = "arm-frc-linux-gnueabi/arm-frc-linux-gnueabi-as", |
| 1107 | ), |
| 1108 | tool_path( |
| 1109 | name = "compat-ld", |
| 1110 | path = "arm-frc-linux-gnueabi/arm-frc-linux-gnueabi-ld", |
| 1111 | ), |
| 1112 | tool_path( |
| 1113 | name = "cpp", |
| 1114 | path = "arm-frc-linux-gnueabi/arm-frc-linux-gnueabi-cpp", |
| 1115 | ), |
| 1116 | tool_path(name = "dwp", path = "/bin/false"), |
| 1117 | tool_path( |
| 1118 | name = "gcc", |
| 1119 | path = "arm-frc-linux-gnueabi/arm-frc-linux-gnueabi-gcc", |
| 1120 | ), |
| 1121 | tool_path( |
| 1122 | name = "gcov", |
| 1123 | path = "arm-frc-linux-gnueabi/arm-frc-linux-gnueabi-gcov-4.9", |
| 1124 | ), |
| 1125 | tool_path( |
| 1126 | name = "ld", |
| 1127 | path = "arm-frc-linux-gnueabi/arm-frc-linux-gnueabi-ld", |
| 1128 | ), |
| 1129 | tool_path( |
| 1130 | name = "nm", |
| 1131 | path = "arm-frc-linux-gnueabi/arm-frc-linux-gnueabi-nm", |
| 1132 | ), |
| 1133 | tool_path( |
| 1134 | name = "objcopy", |
| 1135 | path = "arm-frc-linux-gnueabi/arm-frc-linux-gnueabi-objcopy", |
| 1136 | ), |
| 1137 | tool_path( |
| 1138 | name = "objdump", |
| 1139 | path = "arm-frc-linux-gnueabi/arm-frc-linux-gnueabi-objdump", |
| 1140 | ), |
| 1141 | tool_path( |
| 1142 | name = "strip", |
| 1143 | path = "arm-frc-linux-gnueabi/arm-frc-linux-gnueabi-strip", |
| 1144 | ), |
| 1145 | ] |
Austin Schuh | 0a96ea3 | 2022-01-01 22:29:30 -0800 | [diff] [blame] | 1146 | elif (ctx.attr.cpu == "rp2040" or |
| 1147 | ctx.attr.cpu == "cortex-m4f" or |
Austin Schuh | a2503a7 | 2020-12-15 20:57:57 -0800 | [diff] [blame] | 1148 | ctx.attr.cpu == "cortex-m4f-k22"): |
Austin Schuh | da9d060 | 2019-09-15 17:29:38 -0700 | [diff] [blame] | 1149 | tool_paths = [ |
| 1150 | tool_path( |
| 1151 | name = "ar", |
| 1152 | path = "gcc_arm_none_eabi/arm-none-eabi-ar", |
| 1153 | ), |
| 1154 | tool_path( |
| 1155 | name = "compat-ld", |
| 1156 | path = "gcc_arm_none_eabi/arm-none-eabi-ld", |
| 1157 | ), |
| 1158 | tool_path( |
| 1159 | name = "cpp", |
| 1160 | path = "gcc_arm_none_eabi/arm-none-eabi-cpp", |
| 1161 | ), |
| 1162 | tool_path( |
| 1163 | name = "dwp", |
| 1164 | path = "gcc_arm_none_eabi/arm-none-eabi-dwp", |
| 1165 | ), |
| 1166 | tool_path( |
| 1167 | name = "gcc", |
| 1168 | path = "gcc_arm_none_eabi/arm-none-eabi-gcc", |
| 1169 | ), |
| 1170 | tool_path( |
| 1171 | name = "gcov", |
| 1172 | path = "gcc_arm_none_eabi/arm-none-eabi-gcov", |
| 1173 | ), |
| 1174 | tool_path( |
| 1175 | name = "ld", |
| 1176 | path = "gcc_arm_none_eabi/arm-none-eabi-ld", |
| 1177 | ), |
| 1178 | tool_path( |
| 1179 | name = "nm", |
| 1180 | path = "gcc_arm_none_eabi/arm-none-eabi-nm", |
| 1181 | ), |
| 1182 | tool_path( |
| 1183 | name = "objcopy", |
| 1184 | path = "gcc_arm_none_eabi/arm-none-eabi-objcopy", |
| 1185 | ), |
| 1186 | tool_path( |
| 1187 | name = "objdump", |
| 1188 | path = "gcc_arm_none_eabi/arm-none-eabi-objdump", |
| 1189 | ), |
| 1190 | tool_path( |
| 1191 | name = "strip", |
| 1192 | path = "gcc_arm_none_eabi/arm-none-eabi-strip", |
| 1193 | ), |
| 1194 | ] |
Austin Schuh | da9d060 | 2019-09-15 17:29:38 -0700 | [diff] [blame] | 1195 | else: |
| 1196 | fail("Unreachable") |
| 1197 | |
Austin Schuh | da9d060 | 2019-09-15 17:29:38 -0700 | [diff] [blame] | 1198 | out = ctx.actions.declare_file(ctx.label.name) |
| 1199 | ctx.actions.write(out, "Fake executable") |
| 1200 | return [ |
| 1201 | cc_common.create_cc_toolchain_config_info( |
| 1202 | ctx = ctx, |
| 1203 | features = features, |
| 1204 | action_configs = action_configs, |
| 1205 | artifact_name_patterns = artifact_name_patterns, |
| 1206 | cxx_builtin_include_directories = cxx_builtin_include_directories, |
| 1207 | toolchain_identifier = toolchain_identifier, |
| 1208 | host_system_name = host_system_name, |
| 1209 | target_system_name = target_system_name, |
| 1210 | target_cpu = target_cpu, |
| 1211 | target_libc = target_libc, |
| 1212 | compiler = compiler, |
| 1213 | abi_version = abi_version, |
| 1214 | abi_libc_version = abi_libc_version, |
| 1215 | tool_paths = tool_paths, |
| 1216 | make_variables = make_variables, |
| 1217 | builtin_sysroot = builtin_sysroot, |
Austin Schuh | a2503a7 | 2020-12-15 20:57:57 -0800 | [diff] [blame] | 1218 | cc_target_os = cc_target_os, |
Austin Schuh | da9d060 | 2019-09-15 17:29:38 -0700 | [diff] [blame] | 1219 | ), |
| 1220 | DefaultInfo( |
| 1221 | executable = out, |
| 1222 | ), |
| 1223 | ] |
Austin Schuh | a2503a7 | 2020-12-15 20:57:57 -0800 | [diff] [blame] | 1224 | |
| 1225 | cc_toolchain_config = rule( |
Austin Schuh | da9d060 | 2019-09-15 17:29:38 -0700 | [diff] [blame] | 1226 | implementation = _impl, |
| 1227 | attrs = { |
Brian Silverman | 33ca369 | 2022-02-06 18:37:17 -0800 | [diff] [blame] | 1228 | "cpu": attr.string(mandatory = True, values = ["cortex-m4f", "cortex-m4f-k22", "roborio", "rp2040"]), |
Austin Schuh | da9d060 | 2019-09-15 17:29:38 -0700 | [diff] [blame] | 1229 | }, |
| 1230 | provides = [CcToolchainConfigInfo], |
| 1231 | executable = True, |
| 1232 | ) |