Skip to content

Commit

Permalink
[E2E] fadd readme
Browse files Browse the repository at this point in the history
  • Loading branch information
hexdae committed Mar 28, 2024
1 parent 887854b commit c486ffa
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 27 deletions.
14 changes: 3 additions & 11 deletions MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

module(
name = "arm_gnu_toolchain",
compatibility_level = 1,
version = "0.0.1",
compatibility_level = 1,
)

bazel_dep(name = "platforms", version = "0.0.8")
Expand All @@ -16,7 +16,6 @@ arm_toolchain = use_extension("@arm_gnu_toolchain//:extensions.bzl", "arm_toolch
# module extension will select the version here if a consumer attempts to use
# the newer toolchain.
arm_toolchain.arm_none_eabi(version = "13.2.1")

use_repo(
arm_toolchain,
"arm_none_eabi",
Expand All @@ -26,9 +25,7 @@ use_repo(
"arm_none_eabi_linux_x86_64",
"arm_none_eabi_windows_x86_64",
)

arm_toolchain.arm_none_linux_gnueabihf(version = "13.2.1")

use_repo(
arm_toolchain,
"arm_none_linux_gnueabihf",
Expand All @@ -38,16 +35,11 @@ use_repo(
)

# DEV ONLY (not needed for release)
bazel_dep(name = "aspect_bazel_lib", dev_dependency = True, version = "2.0.0")
bazel_dep(name = "bazel_skylib", dev_dependency = True, version = "1.5.0")
bazel_dep(name = "aspect_bazel_lib", version = "2.0.0", dev_dependency = True)
bazel_dep(name = "bazel_skylib", version = "1.5.0", dev_dependency = True)

register_toolchains(
"@arm_none_eabi//toolchain:all",
"@arm_none_linux_gnueabihf//toolchain:all",
dev_dependency = True,
)

register_toolchains(
"@arm_gnu_toolchain//examples/arm-none/custom/toolchain:all",
dev_dependency = True,
)
7 changes: 3 additions & 4 deletions MODULE.bazel.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 10 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,19 +28,21 @@

</p>


The goal of the project is to illustrate how to use a custom arm-none-eabi embedded toolchain with Bazel.
The goal of the project is to make arm cross compilation toolchains readily
available (and customizable) for bazel developers.

If this project was useful to you, give it a ⭐️ and I'll keep improving it!

You can follow the post [Bazel for ARM embedded toolchains](https://asnaghi.me/post/embedded-bazel/) to get more details about this code.
You might also like another, similar, toolchain project for `bazel`
[RISCV toolchains](https://github.com/hexdae/bazel-riscv-none-elf)

## Features

- [MODULE support](#bzlmod)
- [WORKSPACE support](#workspace)
- [Direct access to gcc tools](#direct-access-to-gcc-tools)
- [Custom toolchain support](#custom-toolchain)
- [Examples](#examples)
- Remote execution support

## Use the toolchain from this repo
Expand All @@ -54,9 +56,11 @@ And this to your `.bazelrc`

# Build using platforms by default
build --incompatible_enable_cc_toolchain_resolution
build --platforms=@arm_gnu_toolchain//platforms:arm_none_generic
```

## Examples

Please look at the [`e2e`](./e2e/) folder for reference usage

## Bzlmod

Expand Down Expand Up @@ -157,7 +161,7 @@ arm_none_eabi_toolchain(
)
```

And in your WORKSPACE:
And in your WORKSPACE / MODULE file:

```python
register_toolchains("@//path/to/toolchains:all")
Expand Down Expand Up @@ -199,6 +203,7 @@ genrule(
## Remote execution

This toolchain is compatible with remote execution, see [`remote.yml`](.github/workflows/remote.yml)

## Building with the ARM Linux toolchain on Windows

The Windows maximum path length limitation may cause build failures with the
Expand Down
1 change: 0 additions & 1 deletion bre/BUILD
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

platform(
name = "worker",
constraint_values = [
Expand Down
5 changes: 0 additions & 5 deletions e2e/bzlmod/MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,13 @@ module(
bazel_dep(name = "aspect_bazel_lib", version = "2.0.0")
bazel_dep(name = "bazel_skylib", version = "1.5.0")
bazel_dep(name = "arm_gnu_toolchain")

local_path_override(
module_name = "arm_gnu_toolchain",
path = "../..",
)

arm_toolchain = use_extension("@arm_gnu_toolchain//:extensions.bzl", "arm_toolchain")

arm_toolchain.arm_none_eabi(version = "13.2.1")

use_repo(
arm_toolchain,
"arm_none_eabi",
Expand All @@ -27,9 +24,7 @@ use_repo(
"arm_none_eabi_linux_x86_64",
"arm_none_eabi_windows_x86_64",
)

arm_toolchain.arm_none_linux_gnueabihf(version = "13.2.1")

use_repo(
arm_toolchain,
"arm_none_linux_gnueabihf",
Expand Down
2 changes: 1 addition & 1 deletion e2e/workspace/WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository")

git_repository(
name = "rules_cc",
branch = "main",
commit = "4a62c693309887664cb733245d1c74f17a992942",
remote = "https://github.com/bazelbuild/rules_cc",
)

Expand Down

0 comments on commit c486ffa

Please sign in to comment.