[meta-ti] [PATCH] cm3-pm-firmware: Use ffreestanding in cflags

Khem Raj raj.khem at gmail.com
Mon Oct 8 18:25:04 PDT 2018


This helps it compile when we use hard-float ABI for linux
and want to build this standlone app using same toolchain for
cortex-m3 ( which does not have FPU )

Signed-off-by: Khem Raj <raj.khem at gmail.com>
---
 recipes-bsp/cm3-pm-firmware/amx3-cm3_git.bb   |  8 ++--
 .../files/0001-Use-ffreestanding.patch        | 39 +++++++++++++++++++
 2 files changed, 43 insertions(+), 4 deletions(-)
 create mode 100644 recipes-bsp/cm3-pm-firmware/files/0001-Use-ffreestanding.patch

diff --git a/recipes-bsp/cm3-pm-firmware/amx3-cm3_git.bb b/recipes-bsp/cm3-pm-firmware/amx3-cm3_git.bb
index 1dcc021c..3572638d 100644
--- a/recipes-bsp/cm3-pm-firmware/amx3-cm3_git.bb
+++ b/recipes-bsp/cm3-pm-firmware/amx3-cm3_git.bb
@@ -9,14 +9,14 @@ PR = "r0"
 SRCREV = "7eb9c0856a9e8b3b42bf64f761da135852b8eea7"
 BRANCH ?= "ti-v4.1.y"
 
-SRC_URI = "git://git.ti.com/processor-firmware/ti-amx3-cm3-pm-firmware.git;protocol=git;branch=${BRANCH}"
+SRC_URI = "git://git.ti.com/processor-firmware/ti-amx3-cm3-pm-firmware.git;protocol=git;branch=${BRANCH} \
+           file://0001-Use-ffreestanding.patch \
+          "
 
 S = "${WORKDIR}/git"
 
-FLOATABI = "${@bb.utils.contains("TUNE_FEATURES", "vfp", bb.utils.contains("TUNE_FEATURES", "callconvention-hard", " -mfloat-abi=hard", " -mfloat-abi=softfp", d), "" ,d)}"
-
 do_compile() {
-	make CROSS_COMPILE="${TARGET_PREFIX}" CC="${TARGET_PREFIX}gcc ${TOOLCHAIN_OPTIONS} ${FLOATABI} ${SECURITY_NOPIE_CFLAGS}"
+	make CROSS_COMPILE="${TARGET_PREFIX}" CC="${TARGET_PREFIX}gcc ${TOOLCHAIN_OPTIONS} ${SECURITY_NOPIE_CFLAGS}"
 }
 
 do_install() {
diff --git a/recipes-bsp/cm3-pm-firmware/files/0001-Use-ffreestanding.patch b/recipes-bsp/cm3-pm-firmware/files/0001-Use-ffreestanding.patch
new file mode 100644
index 00000000..701d2956
--- /dev/null
+++ b/recipes-bsp/cm3-pm-firmware/files/0001-Use-ffreestanding.patch
@@ -0,0 +1,39 @@
+From 8f19f63a6fa65ce0fc4de2162d6aaeb6a92fedd9 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem at gmail.com>
+Date: Mon, 8 Oct 2018 18:15:13 -0700
+Subject: [PATCH] Use -ffreestanding
+
+When compiled using hosted toolchains e.g. default Linux targetted
+toolchains from OpenEmbedded, we need to ensure that none of hosted
+nature of toolchain is manifested and its compiled as a standalone
+baremetal application. In addition to using -nostdlib we also need to
+specify -ffreestanding so it does not include linux specific compiler
+headers etc.
+
+This means that the floating point config defaults of toolchain is not
+looking for platform specific headers e.g. gnu/stubs-soft.h or
+gnu/stubs-hard.h, since OE make it free choice to use hard-fp calling
+convention ABI choice, this change ensures it does not affect compiling
+this baremetal application
+
+Signed-off-by: Khem Raj <raj.khem at gmail.com>
+---
+ Makefile | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/Makefile b/Makefile
+index f1c10ae..3fd9f23 100644
+--- a/Makefile
++++ b/Makefile
+@@ -13,7 +13,7 @@ SRCDIR = src
+ BINDIR = bin
+ 
+ INCLUDES = $(SRCDIR)/include
+-CFLAGS =-mcpu=cortex-m3 -mthumb -nostdlib -Wall -Wundef \
++CFLAGS =-mcpu=cortex-m3 -mthumb -nostdlib -ffreestanding -Wall -Wundef \
+ 	-Werror-implicit-function-declaration -Wstrict-prototypes \
+ 	-Wdeclaration-after-statement -fno-delete-null-pointer-checks \
+ 	-Wempty-body -fno-strict-overflow  -g -I$(INCLUDES) -O2	-MD
+-- 
+2.19.1
+
-- 
2.19.1



More information about the meta-ti mailing list