-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds aarch64_none_linux_gnu support (#49)
* Rebased from https://github.com/hexdae/bazel-arm-none-eabi/actions/runs/8789248662 * [AARCH64][LINUX] add test * [AARCH64][LINUX] test on windows * [AARCH64][LINUX] fix windows --------- Co-authored-by: d-asnaghi <[email protected]>
- Loading branch information
1 parent
80c1f68
commit 3061c51
Showing
14 changed files
with
293 additions
and
30 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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,59 @@ | ||
# project/BUILD.bazel | ||
|
||
load("@aspect_bazel_lib//lib:transitions.bzl", "platform_transition_filegroup") | ||
load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library") | ||
|
||
platform( | ||
name = "aarch64_none_linux_gnu", | ||
constraint_values = [ | ||
"@platforms//cpu:aarch64", | ||
"@platforms//os:linux", | ||
], | ||
) | ||
|
||
cc_library( | ||
name = "arm_library", | ||
srcs = ["library.cpp"], | ||
hdrs = ["library.h"], | ||
copts = [ | ||
"-mcpu=cortex-a53", | ||
], | ||
includes = ["includes"], | ||
target_compatible_with = [ | ||
"@platforms//cpu:aarch64", | ||
"@platforms//os:linux", | ||
], | ||
) | ||
|
||
cc_binary( | ||
name = "arm_elf", | ||
srcs = ["main.cpp"], | ||
copts = [ | ||
"-mcpu=cortex-a53", | ||
], | ||
linkopts = [ | ||
"-nostartfiles", | ||
"-Wl,--entry,main", | ||
], | ||
deps = [":arm_library"], | ||
) | ||
|
||
platform_transition_filegroup( | ||
name = "elf", | ||
srcs = [":arm_elf"], | ||
target_compatible_with = select({ | ||
"@platforms//os:linux": ["@platforms//cpu:x86_64"], # linux x86 (no arm) | ||
"@platforms//os:windows": ["@platforms//cpu:x86_64"], # windows | ||
"//conditions:default": ["@platforms//:incompatible"], | ||
}), | ||
target_platform = ":aarch64_none_linux_gnu", | ||
) | ||
|
||
genrule( | ||
name = "hex", | ||
srcs = [":elf"], | ||
outs = ["mock.hex"], | ||
cmd = "$(execpath @aarch64_none_linux_gnu//:objcopy) -O ihex $< $@", | ||
tools = ["@aarch64_none_linux_gnu//:objcopy"], | ||
visibility = ["//visibility:public"], | ||
) |
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,15 @@ | ||
#include "library.h" | ||
#include <vector> | ||
|
||
uint16_t baz(uint8_t a) { return a * 2; } | ||
|
||
uint32_t foo() { | ||
static constexpr int k = 5; | ||
return baz(k); | ||
} | ||
|
||
uint16_t foobaz() { | ||
std::vector<uint8_t> vec(10); | ||
vec.push_back(1); | ||
return vec[0]; | ||
} |
Oops, something went wrong.