Where did the Posix-GCC demo go?
Posted: Tue Oct 11, 2016 3:56 pm
Subject is the message.
Cheers
Cheers
ChibiOS Web Boards
https://forum.chibios.org/
Code: Select all
diff --git i/demos/Posix-GCC/Makefile w/demos/Posix-GCC/Makefile
index 58a18f8..c90dc05 100644
--- i/demos/Posix-GCC/Makefile
+++ w/demos/Posix-GCC/Makefile
@@ -108,14 +108,14 @@ CPFLAGS = $(OPT) -Wall -Wextra -Wstrict-prototypes -fverbose-asm $(DEFS)
ifeq ($(HOST_OSX),yes)
ifeq ($(OSX_SDK),)
- OSX_SDK = /Developer/SDKs/MacOSX10.7.sdk
+ OSX_SDK = $(shell xcrun --show-sdk-path)
endif
ifeq ($(OSX_ARCH),)
- OSX_ARCH = -mmacosx-version-min=10.3 -arch i386
+ OSX_ARCH = -mmacosx-version-min=$(shell sw_vers -productVersion | perl -pe 's/([0-9].?).([0-9].?).*/\1.\2/g') -arch i386
endif
- CPFLAGS += -isysroot $(OSX_SDK) $(OSX_ARCH)
- LDFLAGS = -Wl -Map=$(PROJECT).map,-syslibroot,$(OSX_SDK),$(LIBDIR)
+ CPFLAGS += $(OSX_ARCH)
+ LDFLAGS = -Wl,-map,$(PROJECT).map
LIBS += $(OSX_ARCH)
else
# Linux, or other
diff --git i/os/ports/GCC/SIMIA32/chcore.c w/os/ports/GCC/SIMIA32/chcore.c
index c1aaf17..96cccae 100644
--- i/os/ports/GCC/SIMIA32/chcore.c
+++ w/os/ports/GCC/SIMIA32/chcore.c
@@ -55,6 +55,18 @@ static void __dummy(Thread *ntp, Thread *otp) {
".globl port_switch \n\t"
"port_switch:"
#endif
+#if defined(__amd64__)
+ "push %rbp \n\t"
+ "push %rsi \n\t"
+ "push %rdi \n\t"
+ "push %rbx \n\t"
+ "mov %rsp, 12(%rdx) \n\t"
+ "mov 12(%rcx), %rsp \n\t"
+ "pop %rbx \n\t"
+ "pop %rdi \n\t"
+ "pop %rsi \n\t"
+ "pop %rbp \n\t"
+#else // 32-bit
"push %ebp \n\t"
"push %esi \n\t"
"push %edi \n\t"
@@ -65,6 +77,7 @@ static void __dummy(Thread *ntp, Thread *otp) {
"pop %edi \n\t"
"pop %esi \n\t"
"pop %ebp \n\t"
+#endif
"ret");
}
Code: Select all
diff --git i/demos/Posix-GCC/Makefile w/demos/Posix-GCC/Makefile
index c35a5f7..a3b6bde 100644
--- i/demos/Posix-GCC/Makefile
+++ w/demos/Posix-GCC/Makefile
@@ -109,14 +109,14 @@ CPFLAGS = $(OPT) -Wall -Wextra -Wstrict-prototypes -fverbose-asm $(DEFS)
ifeq ($(HOST_OSX),yes)
ifeq ($(OSX_SDK),)
- OSX_SDK = /Developer/SDKs/MacOSX10.7.sdk
+ OSX_SDK = $(shell xcrun --show-sdk-path)
endif
ifeq ($(OSX_ARCH),)
- OSX_ARCH = -mmacosx-version-min=10.3 -arch i386
+ OSX_ARCH = -mmacosx-version-min=$(shell sw_vers -productVersion | perl -pe 's/([0-9].?).([0-9].?).*/\1.\2/g') -arch i386
endif
- CPFLAGS += -isysroot $(OSX_SDK) $(OSX_ARCH)
- LDFLAGS = -Wl -Map=$(PROJECT).map,-syslibroot,$(OSX_SDK),$(LIBDIR)
+ CPFLAGS += $(OSX_ARCH)
+ LDFLAGS = -Wl,-map,$(PROJECT).map
LIBS += $(OSX_ARCH)
else
# Linux, or otherCode: Select all
diff --git i/demos/various/RT-Posix-Simulator/Makefile w/demos/various/RT-Posix-Simulator/Makefile
index 9578952..93237c5 100755
--- i/demos/various/RT-Posix-Simulator/Makefile
+++ w/demos/various/RT-Posix-Simulator/Makefile
@@ -135,6 +135,8 @@ CWARN = -Wall -Wextra -Wundef -Wstrict-prototypes
# Define C++ warning options here
CPPWARN = -Wall -Wextra -Wundef
+
+
#
# Compiler settings
##############################################################################
diff --git i/demos/various/RT-Posix-Simulator/readme.txt w/demos/various/RT-Posix-Simulator/readme.txt
index 0b81e84..38f115e 100755
--- i/demos/various/RT-Posix-Simulator/readme.txt
+++ w/demos/various/RT-Posix-Simulator/readme.txt
@@ -19,7 +19,8 @@ See demo.c for details.
** Build Procedure **
-The demo was built using GCC.
+The demo was built using GCC. The Makefile defaults to building for a Linux host.
+To build on OS X, use the following command: `make HOST_OSX=yes`
** Connect to the demo **
diff --git i/os/common/startup/SIMIA32/compilers/GCC/rules.mk w/os/common/startup/SIMIA32/compilers/GCC/rules.mk
index 54c27f0..420912e 100644
--- i/os/common/startup/SIMIA32/compilers/GCC/rules.mk
+++ w/os/common/startup/SIMIA32/compilers/GCC/rules.mk
@@ -10,11 +10,13 @@ COPT = $(USE_COPT)
CPPOPT = $(USE_CPPOPT)
# Garbage collection
-ifeq ($(USE_LINK_GC),yes)
- OPT += -ffunction-sections -fdata-sections -fno-common
- LDOPT := --gc-sections
-else
- LDOPT := --no-gc-sections
+ifneq ($(HOST_OSX),yes) # Do not use GC on OS X. LD does not support it.
+ ifeq ($(USE_LINK_GC),yes)
+ OPT += -ffunction-sections -fdata-sections -fno-common
+ LDOPT := --gc-sections
+ else
+ LDOPT := --no-gc-sections
+ endif
endif
# Linker extra options
@@ -66,11 +68,19 @@ LIBS = $(DLIBS) $(ULIBS)
# Various settings
MCFLAGS =
ODFLAGS = -x --syms
-ASFLAGS = $(MCFLAGS) -Wa,-amhls=$(LSTDIR)/$(notdir $(<:.s=.lst)) $(ADEFS)
-ASXFLAGS = $(MCFLAGS) -Wa,-amhls=$(LSTDIR)/$(notdir $(<:.S=.lst)) $(ADEFS)
-CFLAGS = $(MCFLAGS) $(OPT) $(COPT) $(CWARN) -Wa,-alms=$(LSTDIR)/$(notdir $(<:.c=.lst)) $(DEFS)
-CPPFLAGS = $(MCFLAGS) $(OPT) $(CPPOPT) $(CPPWARN) -Wa,-alms=$(LSTDIR)/$(notdir $(<:.cpp=.lst)) $(DEFS)
-LDFLAGS = $(MCFLAGS) $(OPT) $(LLIBDIR) -Wl,-Map=$(BUILDDIR)/$(PROJECT).map,--cref,--no-warn-mismatch,$(LDOPT)
+ifeq ($(HOST_OSX),yes)
+ ASFLAGS = $(MCFLAGS) $(ADEFS)
+ ASXFLAGS = $(MCFLAGS) $(ADEFS)
+ CFLAGS = $(MCFLAGS) $(OPT) $(COPT) $(CWARN) $(DEFS)
+ CPPFLAGS = $(MCFLAGS) $(OPT) $(CPPOPT) $(CPPWARN) $(DEFS)
+ LDFLAGS = $(MCFLAGS) $(OPT) $(LLIBDIR) -Wl,-map,$(BUILDDIR)/$(PROJECT).map,$(LDOPT)
+else
+ ASFLAGS = $(MCFLAGS) -Wa,-amhls=$(LSTDIR)/$(notdir $(<:.s=.lst)) $(ADEFS)
+ ASXFLAGS = $(MCFLAGS) -Wa,-amhls=$(LSTDIR)/$(notdir $(<:.S=.lst)) $(ADEFS)
+ CFLAGS = $(MCFLAGS) $(OPT) $(COPT) $(CWARN) -Wa,-alms=$(LSTDIR)/$(notdir $(<:.c=.lst)) $(DEFS)
+ CPPFLAGS = $(MCFLAGS) $(OPT) $(CPPOPT) $(CPPWARN) -Wa,-alms=$(LSTDIR)/$(notdir $(<:.cpp=.lst)) $(DEFS)
+ LDFLAGS = $(MCFLAGS) $(OPT) $(LLIBDIR) -Wl,-Map=$(BUILDDIR)/$(PROJECT).map,--cref,--no-warn-mismatch,$(LDOPT)
+endif
# Generate dependency information
ASFLAGS += -MD -MP -MF .dep/$(@F).d