Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@ bazel_dep(name = "bazel_skylib", version = "1.8.1")
# *******************************************************************************
bazel_dep(name = "platforms", version = "1.0.0")
bazel_dep(name = "score_bazel_platforms", version = "0.0.2")
git_override(
module_name = "score_bazel_platforms",
commit = "2dfd3d123214ed34e25f90a48cb6a0a69b7e386a",
remote = "https://github.com/elektrobit-contrib/eclipse-score_bazel_platforms.git",
)
Comment on lines 30 to 34
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR requires eclipse-score/bazel_platforms#12. Once that is "in", the git_overrides can be removed.


# *******************************************************************************
# C++ Rules for Bazel
Expand Down
8 changes: 8 additions & 0 deletions examples/.bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -75,3 +75,11 @@ build:aarch64-qnx --platforms=@score_bazel_platforms//:aarch64-qnx-sdp_8.0.0-pos
# -------------------------------------------------------------------------------
build:target_config_2 --config=aarch64-qnx
build:target_config_2 --extra_toolchains=@score_qcc_arm_toolchain//:aarch64-qnx-sdp_8.0.0-posix

# -------------------------------------------------------------------------------
# Config dedicated to target platform CPU:aarch64 and OS:ebclfsa
# -------------------------------------------------------------------------------
build:aarch64-ebclfsa --config=shared
build:aarch64-ebclfsa --platforms=@score_bazel_platforms//:aarch64-linux-gcc_13.3.0-ebclfsa
build:aarch64-ebclfsa --extra_toolchains=@score_ebclfsa_toolchain//:aarch64-linux-gcc_13.3.0-ebclfsa
build:aarch64-ebclfsa --spawn_strategy=local
49 changes: 49 additions & 0 deletions examples/MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,12 @@ bazel_dep(name = "bazel_skylib", version = "1.8.2")
bazel_dep(name = "platforms", version = "1.0.0")
bazel_dep(name = "score_bazel_platforms", version = "0.0.4")

git_override(
module_name = "score_bazel_platforms",
commit = "2dfd3d123214ed34e25f90a48cb6a0a69b7e386a",
remote = "https://github.com/elektrobit-contrib/eclipse-score_bazel_platforms.git",
)

Comment on lines 30 to 35
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR requires eclipse-score/bazel_platforms#12. Once that is "in", the git_overrides can be removed.

# *******************************************************************************
# C++ Rules for Bazel
# *******************************************************************************
Expand Down Expand Up @@ -146,6 +152,48 @@ gcc.toolchain(
use_default_package = True,
)

# *******************************************************************************
# Setting EBcLfSA 0.1.0 GCC (CPU:aarch64|OS:Linux|V:ebclfsa-0.1.0|ES:ebclfsa)
# *******************************************************************************
gcc.sdp(
name = "score_ebclfsa_toolchain_pkg",
url = "https://github.com/elektrobit-contrib/eclipse-score_toolchains_gcc/releases/download/0.5.0-beta/fastdev-sdk-ubuntu-ebclfsa-ebcl-qemuarm64.tar.gz",
strip_prefix = "fastdev-sdk-ubuntu-ebclfsa-ebcl-qemuarm64",
sha256 = "05b57bbc8d99d46df6b57f774c39a5a2664964ea7eb94147cbece08508c1f121",
build_file = "@score_bazel_cpp_toolchains//packages/linux/aarch64/ebclfsa/0.1.0:ebclfsa.BUILD",
)
gcc.toolchain(
name = "score_ebclfsa_toolchain",
sdp_to_link = "score_ebclfsa_toolchain_pkg",
target_os = "linux",
target_cpu = "aarch64",
runtime_ecosystem = "ebclfsa",
version = "13.3.0",
extra_c_compile_flags = [
"-nostdinc",
"-isystem", "external/%{toolchain_pkg}%/usr/lib/gcc-cross/aarch64-linux-gnu/13/include",
"-isystem", "external/%{toolchain_pkg}%/usr/aarch64-linux-gnu/include",
],
extra_cxx_compile_flags = [
"-nostdinc++",
"-isystem", "external/%{toolchain_pkg}%/usr/aarch64-linux-gnu/include/c++/13",
"-isystem", "external/%{toolchain_pkg}%/usr/aarch64-linux-gnu/include/c++/13/aarch64-linux-gnu",
"-isystem", "external/%{toolchain_pkg}%/usr/aarch64-linux-gnu/include/c++/13/backward",
"-nostdinc",
"-isystem", "external/%{toolchain_pkg}%/usr/lib/gcc-cross/aarch64-linux-gnu/13/include",
"-isystem", "external/%{toolchain_pkg}%/usr/aarch64-linux-gnu/include",
],
extra_link_flags = [
"-lm",
"-ldl",
"-lrt",
"-static-libstdc++",
"-static-libgcc",
"-static",
"-no-canonical-prefixes"
],
)

use_repo(
gcc,
"score_gcc_toolchain",
Expand All @@ -154,4 +202,5 @@ use_repo(
"score_qcc_toolchain",
"score_qcc_arm_toolchain",
"score_autosd_10_toolchain",
"score_ebclfsa_toolchain",
)
7 changes: 7 additions & 0 deletions examples/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,13 @@ bazel build --config=target_config_3 //:main_cpp
bazel build --config=target_config_3 //:main_pthread_cpp
```

**Build for EB corbos Linux for Safety Applications (ARM64):**
```bash
bazel build --config=aarch64-ebclfsa //:main_cpp
bazel build --config=aarch64-ebclfsa //:main_pthread_cpp
bazel test --config=aarch64-ebclfsa //:math_lib_test # this works if you have qemu-user-static installed and configured correctly
```

### QNX Target Builds

> **Note:** Take care of license requirements when using these toolchains and dependencies in your projects.
Expand Down
16 changes: 16 additions & 0 deletions packages/linux/aarch64/ebclfsa/0.1.0/BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# *******************************************************************************
# Copyright (c) 2025 Contributors to the Eclipse Foundation
#
# See the NOTICE file(s) distributed with this work for additional
# information regarding copyright ownership.
#
# This program and the accompanying materials are made available under the
# terms of the Apache License Version 2.0 which is available at
# https://www.apache.org/licenses/LICENSE-2.0
#
# SPDX-License-Identifier: Apache-2.0
# *******************************************************************************

exports_files([
"ebclfsa.BUILD",
])
62 changes: 62 additions & 0 deletions packages/linux/aarch64/ebclfsa/0.1.0/ebclfsa.BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# *******************************************************************************
# Copyright (c) 2025 Contributors to the Eclipse Foundation
#
# See the NOTICE file(s) distributed with this work for additional
# information regarding copyright ownership.
#
# This program and the accompanying materials are made available under the
# terms of the Apache License Version 2.0 which is available at
# https://www.apache.org/licenses/LICENSE-2.0
#
# SPDX-License-Identifier: Apache-2.0
# *******************************************************************************

"""Build file for EBcLfSA 0.1.0 toolchain package"""

package(default_visibility = ["//visibility:public"])

filegroup(
name = "all_files",
srcs = glob(["*/**/*"], exclude = ["usr/share/ca-certificates/**","usr/lib/ssl/certs/**", "lib/ssl/certs/**", "etc/ssl/certs/**", "usr/share/man/**", "var/lib/**"]),
)

filegroup(
name = "bin",
srcs = ["usr/bin"],
)

filegroup(
name = "ar",
srcs = ["usr/bin/aarch64-linux-gnu-ar"],
)

filegroup(
name = "cc",
srcs = ["usr/bin/aarch64-linux-gnu-gcc-13.bin"],
)

filegroup(
name = "gcov",
srcs = ["usr/bin/aarch64-linux-gnu-gcov-13"],
)

filegroup(
name = "cxx",
srcs = ["usr/bin/aarch64-linux-gnu-g++-13.bin"],
)

filegroup(
name = "strip",
srcs = ["usr/bin/aarch64-linux-gnu-strip"],
)

filegroup(
name = "elf-enabler",
srcs = ["usr/bin/lisa-elf-enabler"],
)

# The sysroot for EBcLfSA is the entire extracted directory
filegroup(
name = "sysroot_dir",
srcs = ["."],
)
1 change: 1 addition & 0 deletions rules/gcc.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ cc_toolchain_config(
tc_cpu = rctx.attr.tc_cpu,
tc_os = rctx.attr.tc_os,
)
#tc_elf_enabler = rctx.attr.tc_elf_enabler,

def _get_cc_config_qnx(rctx):
""" TODO: Write docstring
Expand Down