-
Notifications
You must be signed in to change notification settings - Fork 795
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[doc] Add documentation for Bazel RISC-V toolchain
Signed-off-by: James Wainwright <[email protected]>
- Loading branch information
Showing
2 changed files
with
33 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# OpenTitan RISC-V toolchain | ||
|
||
This directory contains the Bazel configuration for OpenTitan's RISC-V | ||
toolchain. | ||
|
||
This LLVM toolchain comes from the [lowrisc-toolchains] repository. See | ||
`third_party/lowrisc/BUILD.lowrisc_toolchain.bazel` for changing the toolchain | ||
version. | ||
|
||
[lowrisc-toolchains]: https://github.com/lowRISC/lowrisc-toolchains | ||
|
||
## Configuration | ||
|
||
There are four rules used to configure the toolchain: | ||
|
||
1. `cc_toolchain`: groups flags, features, and tools into a toolchain. | ||
2. `cc_tool_map`: assigns tools to actions. | ||
3. `cc_args`: defines flags to add to tools based on actions. | ||
3. `cc_feature`: allows `cc_args` flags to be conditionally enabled. | ||
|
||
To add new flags to a tool in the toolchain, define a new `cc_args` target | ||
and assign it to some actions (e.g. compiling C code, linking, etc.). Add the | ||
new flags to `cc_toolchain.args`. | ||
|
||
To make flags optional, define a new `cc_feature` for those `cc_args`. Features | ||
can be enabled at the command line using `bazel --features=$feature_name`. Add | ||
the flags to `cc_toolchain.known_features` and optionally to | ||
`cc_toolchain.enabled_features`. | ||
|
||
Bazel has three built-in features called `dbg`, `fastbuild`, and `opt` that can | ||
be used to enable and disable flags at different optimization levels. |