From fb484c5e54f2e31cf0a338d2927a06a2870bcc2c Mon Sep 17 00:00:00 2001
From: Denys Dmytriyenko <denys@ti.com>
Date: Thu, 11 Oct 2018 16:51:58 -0400
Subject: [PATCH] Use -ffreestanding

The fix is provided by Khem Raj <raj.khem@gmail.com>

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@gmail.com>
Signed-off-by: Denys Dmytriyenko <denys@ti.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
-- 
1.7.12.4

