From ad889575ae02de982a47f642db9c9fbfc17c1873 Mon Sep 17 00:00:00 2001 From: Andrey Zhizhikin Date: Fri, 3 Dec 2021 09:54:30 +0000 Subject: imx_atf: unexport variables instead of set in compile task CFLAGS, LDFLAGS, AS and LD variables are defined in TF-A Makefile and are dependent on the target build. Unexport those flags from build so they can be picked up by TF-A in a form it is defined in Makefile and not provided by OE build. Signed-off-by: Andrey Zhizhikin Cc: Tom Hochstein --- recipes-bsp/imx-atf/imx-atf_2.4.bb | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/recipes-bsp/imx-atf/imx-atf_2.4.bb b/recipes-bsp/imx-atf/imx-atf_2.4.bb index 8360bfa8..965e0948 100644 --- a/recipes-bsp/imx-atf/imx-atf_2.4.bb +++ b/recipes-bsp/imx-atf/imx-atf_2.4.bb @@ -25,13 +25,16 @@ EXTRA_OEMAKE += " \ PLAT=${ATF_PLATFORM} \ " -BUILD_OPTEE = "${@bb.utils.contains('MACHINE_FEATURES', 'optee', 'true', 'false', d)}" +# Let the Makefile handle setting up the CFLAGS and LDFLAGS as it is a standalone application +CFLAGS[unexport] = "1" +LDFLAGS[unexport] = "1" +AS[unexport] = "1" +LD[unexport] = "1" -CFLAGS:remove:mx8mq = "-O2" +BUILD_OPTEE = "${@bb.utils.contains('MACHINE_FEATURES', 'optee', 'true', 'false', d)}" do_compile() { # Clear LDFLAGS to avoid the option -Wl recognize issue - unset LDFLAGS oe_runmake bl31 if ${BUILD_OPTEE}; then oe_runmake clean BUILD_BASE=build-optee -- cgit v1.2.3-54-g00ecf From 0cc0d30c6ec43d1dc7a1cde172959d7a028b1a29 Mon Sep 17 00:00:00 2001 From: Andrey Zhizhikin Date: Fri, 3 Dec 2021 10:07:05 +0000 Subject: imx-atf: remove dependency on C runtime This is a port of commit de5d5e6 ("arm/trusted-firmware-a: no need to DEPENDS on a C runtime") from meta-arm [1]. TF-A is a baremetal application and do not need to DEPENDS on a C runtime. Signed-off-by: Andrey Zhizhikin Link: [1]: https://github.com/jonmason/meta-arm/commit/de5d5e611a81dd7934ef8343b84948fbeffc333b --- recipes-bsp/imx-atf/imx-atf_2.4.bb | 3 +++ 1 file changed, 3 insertions(+) diff --git a/recipes-bsp/imx-atf/imx-atf_2.4.bb b/recipes-bsp/imx-atf/imx-atf_2.4.bb index 965e0948..8792c0cd 100644 --- a/recipes-bsp/imx-atf/imx-atf_2.4.bb +++ b/recipes-bsp/imx-atf/imx-atf_2.4.bb @@ -31,6 +31,9 @@ LDFLAGS[unexport] = "1" AS[unexport] = "1" LD[unexport] = "1" +# Baremetal, just need a compiler +DEPENDS:remove = "virtual/${TARGET_PREFIX}compilerlibs virtual/libc" + BUILD_OPTEE = "${@bb.utils.contains('MACHINE_FEATURES', 'optee', 'true', 'false', d)}" do_compile() { -- cgit v1.2.3-54-g00ecf From d9fb91b0f1e0c0f894ec4ace9ae293d36da3f349 Mon Sep 17 00:00:00 2001 From: Andrey Zhizhikin Date: Fri, 3 Dec 2021 10:11:02 +0000 Subject: imx-atf: enable clang support This is a port of commit 5013182 ("trusted-firmware-a: enable clang support") from meta-arm [1]: The CC and LD parameters are used to point make to the currently used compiler and linkers. This change enables TFA to be compiled successfully when TOOLCHAIN=clang. Signed-off-by: Andrey Zhizhikin Link: [1]: https://github.com/jonmason/meta-arm/commit/5013182ddaf7fabc3cc87ba6c923abb7f68214f5 --- recipes-bsp/imx-atf/imx-atf_2.4.bb | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/recipes-bsp/imx-atf/imx-atf_2.4.bb b/recipes-bsp/imx-atf/imx-atf_2.4.bb index 8792c0cd..ce30822e 100644 --- a/recipes-bsp/imx-atf/imx-atf_2.4.bb +++ b/recipes-bsp/imx-atf/imx-atf_2.4.bb @@ -36,6 +36,17 @@ DEPENDS:remove = "virtual/${TARGET_PREFIX}compilerlibs virtual/libc" BUILD_OPTEE = "${@bb.utils.contains('MACHINE_FEATURES', 'optee', 'true', 'false', d)}" +# CC and LD introduce arguments which conflict with those otherwise provided by +# this recipe. The heads of these variables excluding those arguments +# are therefore used instead. +def remove_options_tail (in_string): + from itertools import takewhile + return ' '.join(takewhile(lambda x: not x.startswith('-'), in_string.split(' '))) + +EXTRA_OEMAKE += "LD=${@remove_options_tail(d.getVar('LD'))}" + +EXTRA_OEMAKE += "CC=${@remove_options_tail(d.getVar('CC'))}" + do_compile() { # Clear LDFLAGS to avoid the option -Wl recognize issue oe_runmake bl31 -- cgit v1.2.3-54-g00ecf