diff --git a/examples/.bazelrc b/examples/.bazelrc index 975a32e..f4575ff 100644 --- a/examples/.bazelrc +++ b/examples/.bazelrc @@ -68,3 +68,11 @@ build:target_config_3 --extra_toolchains=@score_aarch64_gcc_toolchain//:aarch64- build:target_config_4 --config=host_config_1 build:target_config_4 --platforms=@score_bazel_platforms//:x86_64-linux-autosd10 build:target_config_4 --extra_toolchains=@score_autosd_10_toolchain//:x86_64-linux-autosd10 + +# ------------------------------------------------------------------------------- +# Config dedicated to target platform CPU:aarch64 and OS:ebclfsa +# ------------------------------------------------------------------------------- +build:aarch64-ebclfsa --config=shared +build:aarch64-ebclfsa --platforms=@score_bazel_platforms//:aarch64-linux-sdk_0.1.0-ebclfsa +build:aarch64-ebclfsa --extra_toolchains=@score_ebclfsa_toolchain//:aarch64-linux-sdk_0.1.0-ebclfsa +build:aarch64-ebclfsa --spawn_strategy=local diff --git a/examples/MODULE.bazel b/examples/MODULE.bazel index c9a958d..8347a0f 100644 --- a/examples/MODULE.bazel +++ b/examples/MODULE.bazel @@ -144,6 +144,18 @@ gcc.toolchain( use_default_package = True, ) +# ******************************************************************************* +# Setting EBcLfSA 0.1.0 GCC (CPU:aarch64|OS:Linux|V:ebclfsa-0.1.0|ES:ebclfsa) +# ******************************************************************************* +gcc.toolchain( + name = "score_ebclfsa_toolchain", + target_os = "linux", + target_cpu = "aarch64", + runtime_ecosystem = "ebclfsa", + sdk_version = "0.1.0", + use_default_package = True, +) + use_repo( gcc, "my_toolchain", @@ -153,6 +165,7 @@ use_repo( "score_gcc_toolchain", "score_qcc_arm_toolchain", "score_qcc_toolchain", + "score_ebclfsa_toolchain", ) # register_toolchains( diff --git a/examples/README.md b/examples/README.md index fbbc619..2f1fd1f 100644 --- a/examples/README.md +++ b/examples/README.md @@ -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. diff --git a/examples/test.sh b/examples/test.sh index 271af03..e344c33 100755 --- a/examples/test.sh +++ b/examples/test.sh @@ -20,4 +20,7 @@ bazel build --config target_config_3 //:main_cpp bazel clean --expunge echo -e "Testing 'target_config_4' ..." bazel build --config target_config_4 //:main_cpp -bazel clean --expunge \ No newline at end of file +bazel clean --expunge +echo -e "Testing 'aarch64-ebclfsa' ..." +bazel build --config aarch64-ebclfsa //:main_cpp +bazel clean --expunge diff --git a/packages/linux/aarch64/ebclfsa/0.1.0/BUILD b/packages/linux/aarch64/ebclfsa/0.1.0/BUILD new file mode 100644 index 0000000..92c8d57 --- /dev/null +++ b/packages/linux/aarch64/ebclfsa/0.1.0/BUILD @@ -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", +]) diff --git a/packages/linux/aarch64/ebclfsa/0.1.0/ebclfsa.BUILD b/packages/linux/aarch64/ebclfsa/0.1.0/ebclfsa.BUILD new file mode 100644 index 0000000..f7be295 --- /dev/null +++ b/packages/linux/aarch64/ebclfsa/0.1.0/ebclfsa.BUILD @@ -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 = ["."], +) diff --git a/packages/version_matrix.bzl b/packages/version_matrix.bzl index 666466e..3636543 100644 --- a/packages/version_matrix.bzl +++ b/packages/version_matrix.bzl @@ -124,6 +124,48 @@ VERSION_MATRIX = { "strip_prefix": "sysroot", "url": "https://github.com/eclipse-score/inc_os_autosd/releases/download/continuous/autosd-toolchain-x86_64.tar.gz", }, + "aarch64-linux-sdk_0.1.0-ebclfsa": { + "build_file": "@score_bazel_cpp_toolchains//packages/linux/aarch64/ebclfsa/0.1.0:ebclfsa.BUILD", + "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": [ + "-L", + "external/%{toolchain_pkg}%/lib/aarch64-linux-gnu", + "-L", + "external/%{toolchain_pkg}%/usr/aarch64-linux-gnu/lib", + "-L", + "external/%{toolchain_pkg}%/usr/lib/x86_64-linux-gnu", + "-lm", + "-ldl", + "-lrt", + "-static-libstdc++", + "-static-libgcc", + "-static", + "-no-canonical-prefixes" + ], + "sha256": "05b57bbc8d99d46df6b57f774c39a5a2664964ea7eb94147cbece08508c1f121", + "strip_prefix": "fastdev-sdk-ubuntu-ebclfsa-ebcl-qemuarm64", + "url": "https://github.com/elektrobit-contrib/eclipse-score_toolchains_gcc/releases/download/0.5.0-beta/fastdev-sdk-ubuntu-ebclfsa-ebcl-qemuarm64.tar.gz", + }, "x86_64-qnx-sdp_8.0.0": { "build_file": "@score_bazel_cpp_toolchains//packages/qnx/x86_64/sdp/8.0.0:sdp.BUILD", "sha256": "f2e0cb21c6baddbcb65f6a70610ce498e7685de8ea2e0f1648f01b327f6bac63", diff --git a/rules/gcc.bzl b/rules/gcc.bzl index 4666bfd..a14f14e 100644 --- a/rules/gcc.bzl +++ b/rules/gcc.bzl @@ -227,7 +227,7 @@ gcc_toolchain = repository_rule( "license_info_value": attr.string(doc = "License info value (custom settings)"), "license_info_variable": attr.string(doc = "License info variable name (custom settings)"), "license_path": attr.string(doc = "Lincese path"), - "sdk_version": attr.string(doc = "SDP version string"), + "sdk_version": attr.string(doc = "SDK version string"), "sdp_version": attr.string(doc = "SDP version string"), "tc_cpu": attr.string(doc = "Target platform CPU."), "tc_identifier": attr.string(doc = "Constraint to be used for toolchain definition (e.g. gcc_12.2.0)."),