{"id":13864846,"url":"https://github.com/hexdae/toolchains_arm_gnu","last_synced_at":"2025-12-10T19:29:52.861Z","repository":{"id":45687684,"uuid":"266398332","full_name":"hexdae/toolchains_arm_gnu","owner":"hexdae","description":"ARM embedded toolchains for Bazel","archived":false,"fork":false,"pushed_at":"2025-07-06T20:55:54.000Z","size":297,"stargazers_count":124,"open_issues_count":0,"forks_count":37,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-07-09T15:08:08.293Z","etag":null,"topics":["arm","bazel","embedded","gcc","toolchain"],"latest_commit_sha":null,"homepage":"https://asnaghi.me/post/embedded-bazel/","language":"Starlark","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hexdae.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2020-05-23T18:43:20.000Z","updated_at":"2025-07-06T20:53:20.000Z","dependencies_parsed_at":"2022-09-16T18:51:10.222Z","dependency_job_id":"e907f2ef-2948-4565-9dce-4434a107d783","html_url":"https://github.com/hexdae/toolchains_arm_gnu","commit_stats":null,"previous_names":["hexdae/toolchains_arm_gnu","hexdae/bazel-arm-none-eabi"],"tags_count":9,"template":false,"template_full_name":null,"purl":"pkg:github/hexdae/toolchains_arm_gnu","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hexdae%2Ftoolchains_arm_gnu","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hexdae%2Ftoolchains_arm_gnu/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hexdae%2Ftoolchains_arm_gnu/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hexdae%2Ftoolchains_arm_gnu/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hexdae","download_url":"https://codeload.github.com/hexdae/toolchains_arm_gnu/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hexdae%2Ftoolchains_arm_gnu/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264708093,"owners_count":23652200,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["arm","bazel","embedded","gcc","toolchain"],"created_at":"2024-08-05T10:00:53.908Z","updated_at":"2025-12-08T15:05:28.985Z","avatar_url":"https://github.com/hexdae.png","language":"Starlark","readme":"\u003cp align=\"center\"\u003e\n\n\u003ca href=\"https://github.com/hexdae/toolchains_arm_gnu/blob/master/LICENSE\"\u003e\n    \u003cimg alt=\"GitHub license\" src=\"https://img.shields.io/github/license/hexdae/toolchains_arm_gnu?color=success\"\u003e\n\u003c/a\u003e\n\n\u003ca href=\"https://github.com/hexdae/toolchains_arm_gnu/stargazers\"\u003e\n    \u003cimg alt=\"GitHub stars\" src=\"https://img.shields.io/github/stars/hexdae/toolchains_arm_gnu?color=success\"\u003e\n\u003c/a\u003e\n\n\u003ca href=\"https://github.com/hexdae/toolchains_arm_gnu/issues\"\u003e\n    \u003cimg alt=\"GitHub issues\" src=\"https://img.shields.io/github/issues/hexdae/toolchains_arm_gnu\"\u003e\n\u003c/a\u003e\n\n\u003ca href=\"https://github.com/hexdae/toolchains_arm_gnu/actions\"\u003e\n    \u003cimg alt=\"CI\" src=\"https://github.com/hexdae/toolchains_arm_gnu/actions/workflows/ci.yml/badge.svg\"\u003e\n\u003c/a\u003e\n\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n\n\u003cimg src=\"https://asnaghi.me/images/bazel-arm.png\" width=\"400px\"/\u003e\n\n\u003c/p\u003e\n\nThe goal of the project is to make arm cross compilation toolchains readily\navailable (and customizable) for bazel developers.\n\nIf this project was useful to you, give it a ⭐️ and I'll keep improving it!\n\nYou might also like another, similar, toolchain project for `bazel`\n[RISCV toolchains](https://github.com/hexdae/bazel-riscv-none-elf)\n\n## Features\n\n- [MODULE support](#bzlmod)\n- [WORKSPACE support](#workspace)\n- [Direct access to gcc tools](#direct-access-to-gcc-tools)\n- [Custom toolchain support](#custom-toolchain)\n- [Use a specific GCC version](./examples/gcc_version)\n- [Link Map Generation](./examples/linkmap)\n- [Examples](./examples)\n- Remote execution support\n- Linux, MacOS, Windows\n\n## Use the toolchain from this repo\n\n## .bazelrc\n\nAnd this to your `.bazelrc`\n\n```bash\n# .bazelrc\n\n# Build using platforms by default\nbuild --incompatible_enable_cc_toolchain_resolution\n```\n\n## Bzlmod\n\n```python\nbazel_dep(name = \"toolchains_arm_gnu\", version = \"\u003cversion\u003e\")\n\narm_toolchain = use_extension(\"@toolchains_arm_gnu//:extensions.bzl\", \"arm_toolchain\")\n\narm_toolchain.arm_none_eabi()\nuse_repo(arm_toolchain, \"arm_none_eabi\")\nregister_toolchains(\"@arm_none_eabi//toolchain:all\")\n\narm_toolchain.arm_none_linux_gnueabihf()\nuse_repo(arm_toolchain, \"arm_none_linux_gnueabihf\")\nregister_toolchains(\"@arm_none_linux_gnueabihf//toolchain:all\")\n\narm_toolchain.aarch64_none_elf()\nuse_repo(arm_toolchain, \"aarch64_none_elf\")\nregister_toolchains(\"@aarch64_none_elf//toolchain:all\")\n\narm_toolchain.aarch64_none_linux_gnu()\nuse_repo(arm_toolchain, \"aarch64_none_linux_gnu\")\nregister_toolchains(\"@aarch64_none_linux_gnu//toolchain:all\")\n```\n\n## WORKSPACE\n\nAdd this git repository to your WORKSPACE to use the compiler (NOTE: WORSKPACE\nsetups will become obsolete soon, do not use for new projects)\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\nWORKSPACE\n\u003c/summary\u003e\n\n```python\nload(\"@bazel_tools//tools/build_defs/repo:git.bzl\", \"git_repository\")\n\ngit_repository(\n    name = \"rules_cc\",\n    remote = \"https://github.com/bazelbuild/rules_cc\",\n    branch = \"main\",\n)\n\ngit_repository(\n    name = \"arm_none_eabi\",\n    remote = \"https://github.com/hexdae/toolchains_arm_gnu\",\n    branch = \"master\",\n)\n\nload(\"@toolchains_arm_gnu//:deps.bzl\", \"arm_none_eabi_deps\")\narm_none_eabi_deps()\nregister_toolchains(\"@arm_none_eabi//toolchain:all\")\n\nload(\"@toolchains_arm_gnu//:deps.bzl\", \"arm_none_linux_gnueabihf_deps\")\narm_none_linux_gnueabihf_deps()\nregister_toolchains(\"@arm_none_linux_gnueabihf//toolchain:all\")\n\nload(\"@toolchains_arm_gnu//:deps.bzl\", \"aarch64_none_elf_deps\")\naarch64_none_elf_deps()\nregister_toolchains(\"@aarch64_none_elf//toolchain:all\")\n\nload(\"@toolchains_arm_gnu//:deps.bzl\", \"aarch64_none_linux_gnu_deps\")\naarch64_none_linux_gnu_deps()\nregister_toolchains(\"@aarch64_none_linux_gnu//toolchain:all\")\n```\n\n\u003c/details\u003e\n\n## Custom toolchain\n\nIf you want to bake certain compiler flags in to your toolchain, you can define a custom toolchain in your repo.\n\nIn a BUILD file:\n\n```python\n# path/to/toolchains/BUILD\n\nload(\"@arm_none_eabi//toolchain:toolchain.bzl\", \"arm_none_eabi_toolchain\")\narm_none_eabi_toolchain(\n    name = \"custom_toolchain\",\n    target_compatible_with = [\n        \"\u003cyour additional constraints\u003e\",\n    ],\n    copts = [\n        \"\u003cyour additional copts\u003e\",\n    ],\n    linkopts = [\n        \"\u003cyour additional linkopts\u003e\",\n    ],\n)\n```\n\nAnd in your WORKSPACE / MODULE file:\n\n```python\nregister_toolchains(\"@//path/to/toolchains:all\")\n```\n\nBe careful about registering the default toolchains when using a custom one\n\n## Direct access to gcc tools\n\nIf you need direct access to `gcc` tools, they are available as `@arm_none_eabi//:\u003ctool\u003e`. For example, the following `genrules` could be used to produce `.bin` and `.hex` artifacts from a generic `.out` target.\n\n```python\n\ncc_binary(\n    name = \"target.out\"\n    srcs = [...],\n    deps = [...],\n    copts = [...],\n    ...\n)\n\ngenrule(\n    name = \"bin\",\n    srcs = [\":target.out\"],\n    outs = [\"target.bin\"],\n    cmd = \"$(execpath @arm_none_eabi//:objcopy) -O binary $\u003c $@\",\n    tools = [\"@arm_none_eabi//:objcopy\"],\n)\n\ngenrule(\n    name = \"hex\",\n    srcs = [\":target.out\"],\n    outs = [\"target.hex\"],\n    cmd = \"$(execpath @arm_none_eabi//:objcopy) -O ihex $\u003c $@\",\n    tools = [\"@arm_none_eabi//:objcopy\"],\n)\n```\n\n### Build linkermap file\n\nIf you want to build a linkermap file, starting from bazel 7.2.0 it can be enabled through the `generate_linkmap` and accessed though the `linkmap` output group.\n\n```python\n\ncc_binary(\n    name = \"target.out\"\n    srcs = [...],\n    deps = [...],\n    copts = [...],\n    ...\n    features = [\"generate_linkmap\"],\n)\n\nfilegroup(\n    name = \"target.out.map\",\n    srcs = [\":target.out\"],\n    output_group = \"linkmap\",\n)\n```\n\n\n## Remote execution\n\nThis toolchain is compatible with remote execution\n\n## Building with the ARM Linux toolchain on Windows\n\nThe Windows maximum path length limitation may cause build failures with the\n`arm-none-linux-gnueabihf` toolchain. In some cases, it's enough to avoid this\nby setting a shorter output directory. Add this to your `.bazelrc` file:\n\n```\nstartup --output_user_root=C:/tmp\n```\n\nSee [avoid long path issues][1] for more information.\n\n[1]: https://bazel.build/configure/windows#long-path-issues\n","funding_links":[],"categories":["Tooling"],"sub_categories":["Toolchains"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhexdae%2Ftoolchains_arm_gnu","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhexdae%2Ftoolchains_arm_gnu","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhexdae%2Ftoolchains_arm_gnu/lists"}