Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save FantomJAC/176d04deb061f06a8edba31e4fa9baa2 to your computer and use it in GitHub Desktop.
Save FantomJAC/176d04deb061f06a8edba31e4fa9baa2 to your computer and use it in GitHub Desktop.
Zephyr RTOS Patch for GCC ARM Embedded support (Tested on macOS)
From 011c702c39baa392beef9457f22fc7eb29285f11 Mon Sep 17 00:00:00 2001
From: Shotaro Uchida <fantom@xmaker.mx>
Date: Thu, 23 Feb 2017 23:56:50 +0900
Subject: [PATCH] gccarmemb: Needs arm specific flags at linkage
---
Makefile | 6 +++++-
arch/arm/Makefile | 3 +++
2 files changed, 8 insertions(+), 1 deletion(-)
diff --git a/Makefile b/Makefile
index 06122c4..f67c03d 100644
--- a/Makefile
+++ b/Makefile
@@ -419,6 +419,9 @@ exports += KBUILD_CPPFLAGS NOSTDINC_FLAGS ZEPHYRINCLUDE OBJCOPYFLAGS LDFLAGS
exports += KBUILD_CFLAGS KBUILD_CXXFLAGS CFLAGS_GCOV KBUILD_AFLAGS AFLAGS_KERNEL
exports += KBUILD_ARFLAGS FIXDEP
+# GCCARMEMB Workaround: ARM specific flags for linker (gcc)
+exports += ARM_CFLAGS
+
# Push the exports to sub-processes
export $(exports)
@@ -849,7 +852,8 @@ linker.cmd: $(zephyr-deps)
PREBUILT_KERNEL = $(KERNEL_NAME)_prebuilt.elf
$(PREBUILT_KERNEL): $(zephyr-deps) libzephyr.a $(KBUILD_ZEPHYR_APP) $(app-y) linker.cmd $(KERNEL_NAME).lnk
- $(Q)$(CC) -T linker.cmd @$(KERNEL_NAME).lnk -o $@
+ # GCCARMEMB Workaround: Need ARM specific flags for link
+ $(Q)$(CC) $(ARM_CFLAGS) -T linker.cmd @$(KERNEL_NAME).lnk -o $@
quiet_cmd_gen_idt = SIDT $@
cmd_gen_idt = \
diff --git a/arch/arm/Makefile b/arch/arm/Makefile
index a705f03..c9f97d3 100644
--- a/arch/arm/Makefile
+++ b/arch/arm/Makefile
@@ -51,6 +51,9 @@ KBUILD_AFLAGS += $(aflags-y)
KBUILD_CFLAGS += $(cflags-y)
KBUILD_CXXFLAGS += $(cflags-y)
+# GCCARMEMB Workaround
+ARM_CFLAGS += $(cflags-y)
+
soc-cxxflags ?= $(soc-cflags)
soc-aflags ?= $(soc-cflags)
KBUILD_CFLAGS += $(soc-cflags)
--
2.10.1 (Apple Git-78)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment