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