-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Greg Balke <gbalke@berkeley.edu>
- Loading branch information
Showing
11 changed files
with
425 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# Enable toolchain resolution with cc | ||
build --incompatible_enable_cc_toolchain_resolution |
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 |
---|---|---|
|
@@ -13,3 +13,5 @@ firmware/.settings/ | |
bd_tools.egg-info/ | ||
build/ | ||
dist/ | ||
|
||
bazel-* |
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,5 @@ | ||
load("@com_github_bazelbuild_buildtools//buildifier:def.bzl", "buildifier") | ||
|
||
buildifier( | ||
name = "buildifier", | ||
) |
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,96 @@ | ||
load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository") | ||
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") | ||
|
||
git_repository( | ||
name = "bazel_embedded", | ||
commit = "d3cbe4eff9a63d3dee63067d61096d681daca33b", | ||
remote = "https://github.com/bazelembedded/bazel-embedded.git", | ||
shallow_since = "1585022166 +0800", | ||
) | ||
|
||
load("@bazel_embedded//:bazel_embedded_deps.bzl", "bazel_embedded_deps") | ||
|
||
bazel_embedded_deps() | ||
|
||
load("@bazel_embedded//platforms:execution_platforms.bzl", "register_platforms") | ||
|
||
register_platforms() | ||
|
||
load( | ||
"@bazel_embedded//toolchains/compilers/gcc_arm_none_eabi:gcc_arm_none_repository.bzl", | ||
"gcc_arm_none_compiler", | ||
) | ||
|
||
gcc_arm_none_compiler() | ||
|
||
load("@bazel_embedded//toolchains/gcc_arm_none_eabi:gcc_arm_none_toolchain.bzl", "register_gcc_arm_none_toolchain") | ||
|
||
register_gcc_arm_none_toolchain() | ||
|
||
load("@bazel_embedded//tools/openocd:openocd_repository.bzl", "openocd_deps") | ||
|
||
openocd_deps() | ||
|
||
git_repository( | ||
name = "rules_meta", | ||
commit = "062936fe3bab149bc2fc664301d8151868a3c874", | ||
remote = "https://github.com/fmeum/rules_meta.git", | ||
shallow_since = "1647421183 +0100", | ||
) | ||
|
||
### BUILDIFIER DEPENDENCIES ### | ||
# buildifier is written in Go and hence needs rules_go to be built. | ||
# See https://github.com/bazelbuild/rules_go for the up to date setup instructions. | ||
http_archive( | ||
name = "io_bazel_rules_go", | ||
sha256 = "d6b2513456fe2229811da7eb67a444be7785f5323c6708b38d851d2b51e54d83", | ||
urls = [ | ||
"https://mirror.bazel.build/github.com/bazelbuild/rules_go/releases/download/v0.30.0/rules_go-v0.30.0.zip", | ||
"https://github.com/bazelbuild/rules_go/releases/download/v0.30.0/rules_go-v0.30.0.zip", | ||
], | ||
) | ||
|
||
load("@io_bazel_rules_go//go:deps.bzl", "go_rules_dependencies") | ||
|
||
go_rules_dependencies() | ||
|
||
load("@io_bazel_rules_go//go:deps.bzl", "go_register_toolchains") | ||
|
||
go_register_toolchains(version = "1.17.2") | ||
|
||
http_archive( | ||
name = "bazel_gazelle", | ||
sha256 = "de69a09dc70417580aabf20a28619bb3ef60d038470c7cf8442fafcf627c21cb", | ||
urls = [ | ||
"https://mirror.bazel.build/github.com/bazelbuild/bazel-gazelle/releases/download/v0.24.0/bazel-gazelle-v0.24.0.tar.gz", | ||
"https://github.com/bazelbuild/bazel-gazelle/releases/download/v0.24.0/bazel-gazelle-v0.24.0.tar.gz", | ||
], | ||
) | ||
|
||
load("@bazel_gazelle//:deps.bzl", "gazelle_dependencies") | ||
|
||
# If you use WORKSPACE.bazel, use the following line instead of the bare gazelle_dependencies(): | ||
# gazelle_dependencies(go_repository_default_config = "@//:WORKSPACE.bazel") | ||
gazelle_dependencies() | ||
|
||
http_archive( | ||
name = "com_google_protobuf", | ||
sha256 = "3bd7828aa5af4b13b99c191e8b1e884ebfa9ad371b0ce264605d347f135d2568", | ||
strip_prefix = "protobuf-3.19.4", | ||
urls = [ | ||
"https://github.com/protocolbuffers/protobuf/archive/v3.19.4.tar.gz", | ||
], | ||
) | ||
|
||
load("@com_google_protobuf//:protobuf_deps.bzl", "protobuf_deps") | ||
|
||
protobuf_deps() | ||
|
||
http_archive( | ||
name = "com_github_bazelbuild_buildtools", | ||
sha256 = "ae34c344514e08c23e90da0e2d6cb700fcd28e80c02e23e4d5715dddcb42f7b3", | ||
strip_prefix = "buildtools-4.2.2", | ||
urls = [ | ||
"https://github.com/bazelbuild/buildtools/archive/refs/tags/4.2.2.tar.gz", | ||
], | ||
) |
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,68 @@ | ||
load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library") | ||
load("//third_party:variables.bzl", "chibios_inc_paths") | ||
load("//:platforms.bzl", "cc_f4_binary") | ||
|
||
cc_f4_binary( | ||
name = "bootloader", | ||
srcs = glob(["src/*.c"]) + glob(["src/*.cpp"]), | ||
copts = chibios_inc_paths + [ | ||
"-O2", | ||
"-ggdb", | ||
"-ffunction-sections", | ||
"-fdata-sections", | ||
"-fno-common", | ||
], | ||
linkopts = [ | ||
"-T $(location :link.ld)", | ||
"-lc", | ||
"-lm", | ||
"-lnosys", | ||
"-u _printf_float", | ||
], | ||
target_compatible_with = [ | ||
"@platforms//cpu:armv7e-m", | ||
], | ||
visibility = ["//visibility:public"], | ||
deps = [ | ||
":link.ld", | ||
":main_libs", | ||
"//third_party:chibios_hal", | ||
], | ||
) | ||
|
||
cc_library( | ||
name = "main_libs", | ||
hdrs = glob( | ||
["include/*.h"], | ||
exclude = [ | ||
"include/stm32f4xx_conf.h", | ||
"include/chconf.h", | ||
"include/halconf.h", | ||
"include/mcuconf.h", | ||
], | ||
) + glob( | ||
["include/*.hpp"], | ||
exclude = [ | ||
"include/peripherals.hpp", | ||
], | ||
), | ||
copts = chibios_inc_paths, | ||
strip_include_prefix = "include", | ||
deps = [ | ||
"//common", | ||
], | ||
) | ||
|
||
cc_library( | ||
name = "os_config", | ||
hdrs = [ | ||
"include/chconf.h", | ||
"include/halconf.h", | ||
"include/mcuconf.h", | ||
"include/peripherals.hpp", | ||
"include/stm32f4xx_conf.h", | ||
], | ||
includes = ["include"], | ||
strip_include_prefix = "include", | ||
visibility = ["//visibility:public"], | ||
) |
Empty file.
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,26 @@ | ||
load("@rules_cc//cc:defs.bzl", "cc_library") | ||
load("//third_party:variables.bzl", "chibios_inc_paths") | ||
|
||
filegroup( | ||
name = "board_config_hdrs", | ||
srcs = ["board.h"], | ||
visibility = ["//visibility:public"], | ||
) | ||
|
||
filegroup( | ||
name = "board_config_srcs", | ||
srcs = ["board.c"], | ||
visibility = ["//visibility:public"], | ||
) | ||
|
||
cc_library( | ||
name = "common", | ||
srcs = glob(["src/*.c"]) + glob(["src/*.cpp"]), | ||
hdrs = glob(["include/*.h"]) + glob(["include/*.hpp"]), | ||
copts = chibios_inc_paths, | ||
strip_include_prefix = "include", | ||
visibility = ["//visibility:public"], | ||
deps = [ | ||
"//third_party:chibios_hal", | ||
], | ||
) |
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,9 @@ | ||
load("@rules_meta//meta:defs.bzl", "meta") | ||
|
||
cc_f4_binary = meta.wrap_with_transition( | ||
native.cc_binary, | ||
{ | ||
"platforms": meta.replace_with(["@bazel_embedded//platforms:cortex_m4_fpu"]), | ||
}, | ||
executable = True, | ||
) |
Oops, something went wrong.