aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorinmarket <andrewh@inmarket.com.au>2014-10-06 15:50:19 +1000
committerinmarket <andrewh@inmarket.com.au>2014-10-06 15:50:19 +1000
commit18c4a9f8703b8a6ddcea050d74d31b194005dae1 (patch)
tree6101b238aeccc91ccb5331b3108e832bfbc0ff70
parent2151935b3a89fdf357181f6f1161c1c0c1dde1f0 (diff)
downloaduGFX-18c4a9f8703b8a6ddcea050d74d31b194005dae1.tar.gz
uGFX-18c4a9f8703b8a6ddcea050d74d31b194005dae1.tar.bz2
uGFX-18c4a9f8703b8a6ddcea050d74d31b194005dae1.zip
Update support for ChibiOS v3 to the current repository.
Update Make system to match. Add ability to make to a library rather than a program Stop ignoring objcode invalid format errors Multiple make tidy ups
-rw-r--r--boards/base/Linux-Framebuffer/example/Makefile8
-rw-r--r--boards/base/Linux/example/Makefile8
-rw-r--r--boards/base/Mikromedia-STM32-M4-ILI9341/ChibiOS_Board/board.h1
-rw-r--r--boards/base/Mikromedia-STM32-M4-ILI9341/example_chibios_2.x/Makefile9
-rw-r--r--boards/base/Mikromedia-STM32-M4-ILI9341/example_chibios_3.x/Makefile35
-rw-r--r--boards/base/Mikromedia-STM32-M4-ILI9341/example_chibios_3.x/chconf.h2
-rw-r--r--boards/base/Mikromedia-STM32-M4-ILI9341/example_chibios_3.x/halconf.h18
-rw-r--r--boards/base/Mikromedia-STM32-M4-ILI9341/example_chibios_3.x/mcuconf.h2
-rw-r--r--boards/base/OSX/example/Makefile8
-rw-r--r--boards/base/Olimex-SAM7EX256-GE8/example/Makefile11
-rw-r--r--boards/base/Win32/example/Makefile8
-rw-r--r--src/gos/gos_chibios.h4
-rw-r--r--tools/gmake_scripts/compiler_gcc.mk78
-rw-r--r--tools/gmake_scripts/cpu_at91sam7.mk20
-rw-r--r--tools/gmake_scripts/cpu_stm32m4.mk19
-rw-r--r--tools/gmake_scripts/cpu_x64.mk18
-rw-r--r--tools/gmake_scripts/cpu_x86.mk18
-rw-r--r--tools/gmake_scripts/os_chibios.mk31
-rw-r--r--tools/gmake_scripts/readme.txt4
19 files changed, 180 insertions, 122 deletions
diff --git a/boards/base/Linux-Framebuffer/example/Makefile b/boards/base/Linux-Framebuffer/example/Makefile
index fb0c1b7a..802fddc3 100644
--- a/boards/base/Linux-Framebuffer/example/Makefile
+++ b/boards/base/Linux-Framebuffer/example/Makefile
@@ -6,13 +6,8 @@
# General settings
# See $(GFXLIB)/tools/gmake_scripts/readme.txt for the list of variables
- OPT_VERBOSE_COMPILE = no
- OPT_GENERATE_LISTINGS = yes
- OPT_GENERATE_MAP = yes
- OPT_COPY_EXE = no
- OPT_LINK_OPTIMIZE = yes
- OPT_NONSTANDARD_FLAGS = no
OPT_OS = linux
+ OPT_LINK_OPTIMIZE = yes
# Change this next setting (or add the explicit compiler flags) if you are not compiling for x86 linux
OPT_CPU = x86
@@ -20,7 +15,6 @@
# See $(GFXLIB)/tools/gmake_scripts/library_ugfx.mk for the list of variables
GFXLIB = ../uGFX
GFXBOARD = Linux-Framebuffer
- #GFXDRIVERS = multiple/uGFXnet
GFXDEMO = modules/gdisp/basics
# Linux settings
diff --git a/boards/base/Linux/example/Makefile b/boards/base/Linux/example/Makefile
index 3d6d3d60..d75c1dd2 100644
--- a/boards/base/Linux/example/Makefile
+++ b/boards/base/Linux/example/Makefile
@@ -6,13 +6,8 @@
# General settings
# See $(GFXLIB)/tools/gmake_scripts/readme.txt for the list of variables
- OPT_VERBOSE_COMPILE = no
- OPT_GENERATE_LISTINGS = yes
- OPT_GENERATE_MAP = yes
- OPT_COPY_EXE = no
- OPT_LINK_OPTIMIZE = yes
- OPT_NONSTANDARD_FLAGS = no
OPT_OS = linux
+ OPT_LINK_OPTIMIZE = yes
# Change this next setting (or add the explicit compiler flags) if you are not compiling for x86 linux
OPT_CPU = x86
@@ -20,7 +15,6 @@
# See $(GFXLIB)/tools/gmake_scripts/library_ugfx.mk for the list of variables
GFXLIB = ../uGFX
GFXBOARD = Linux
- #GFXDRIVERS = multiple/uGFXnet
GFXDEMO = modules/gdisp/basics
# Linux settings
diff --git a/boards/base/Mikromedia-STM32-M4-ILI9341/ChibiOS_Board/board.h b/boards/base/Mikromedia-STM32-M4-ILI9341/ChibiOS_Board/board.h
index 41f15201..b5ee34ad 100644
--- a/boards/base/Mikromedia-STM32-M4-ILI9341/ChibiOS_Board/board.h
+++ b/boards/base/Mikromedia-STM32-M4-ILI9341/ChibiOS_Board/board.h
@@ -49,6 +49,7 @@
* MCU type as defined in the ST header.
*/
#define STM32F40_41xxx
+#define STM32F407xx
/*
* IO pins assignments.
diff --git a/boards/base/Mikromedia-STM32-M4-ILI9341/example_chibios_2.x/Makefile b/boards/base/Mikromedia-STM32-M4-ILI9341/example_chibios_2.x/Makefile
index ac483689..8baa399f 100644
--- a/boards/base/Mikromedia-STM32-M4-ILI9341/example_chibios_2.x/Makefile
+++ b/boards/base/Mikromedia-STM32-M4-ILI9341/example_chibios_2.x/Makefile
@@ -6,22 +6,16 @@
# General settings
# See $(GFXLIB)/tools/gmake_scripts/readme.txt for the list of variables
- OPT_VERBOSE_COMPILE = no
- OPT_GENERATE_LISTINGS = yes
- OPT_GENERATE_MAP = yes
- OPT_COPY_EXE = no
- OPT_LINK_OPTIMIZE = yes
- OPT_NONSTANDARD_FLAGS = no
OPT_NATIVEOS = chibios
OPT_OS = chibios
OPT_THUMB = yes
+ OPT_LINK_OPTIMIZE = yes
OPT_CPU = stm32m4
# uGFX settings
# See $(GFXLIB)/tools/gmake_scripts/library_ugfx.mk for the list of variables
GFXLIB = ../uGFX
GFXBOARD = Mikromedia-STM32-M4-ILI9341
- #GFXDRIVERS = multiple/uGFXnet
GFXDEMO = modules/gdisp/basics
# ChibiOS settings
@@ -31,7 +25,6 @@ ifeq ($(OPT_OS),chibios)
CHIBIOS_BOARD =
CHIBIOS_PLATFORM = STM32F4xx
CHIBIOS_PORT = GCC/ARMCMx/STM32F4xx
- CHIBIOS_DEFS =
CHIBIOS_LDSCRIPT = STM32F407xG.ld
# We define a non standard board script as this is not a standard ChibiOS supported board
include $(GFXLIB)/boards/base/Mikromedia-STM32-M4-ILI9341/ChibiOS_Board/board.mk
diff --git a/boards/base/Mikromedia-STM32-M4-ILI9341/example_chibios_3.x/Makefile b/boards/base/Mikromedia-STM32-M4-ILI9341/example_chibios_3.x/Makefile
index d19c3d28..55778283 100644
--- a/boards/base/Mikromedia-STM32-M4-ILI9341/example_chibios_3.x/Makefile
+++ b/boards/base/Mikromedia-STM32-M4-ILI9341/example_chibios_3.x/Makefile
@@ -6,33 +6,27 @@
# General settings
# See $(GFXLIB)/tools/gmake_scripts/readme.txt for the list of variables
- OPT_VERBOSE_COMPILE = no
- OPT_GENERATE_LISTINGS = yes
- OPT_GENERATE_MAP = yes
- OPT_COPY_EXE = no
- OPT_LINK_OPTIMIZE = yes
- OPT_NONSTANDARD_FLAGS = no
OPT_NATIVEOS = chibios
OPT_OS = chibios
OPT_THUMB = yes
+ OPT_LINK_OPTIMIZE = yes
OPT_CPU = stm32m4
# uGFX settings
# See $(GFXLIB)/tools/gmake_scripts/library_ugfx.mk for the list of variables
GFXLIB = ../uGFX
GFXBOARD = Mikromedia-STM32-M4-ILI9341
- #GFXDRIVERS = multiple/uGFXnet
GFXDEMO = modules/gdisp/basics
# ChibiOS settings
ifeq ($(OPT_OS),chibios)
# See $(GFXLIB)/tools/gmake_scripts/os_chibios.mk for the list of variables
- CHIBIOS = ../ChibiOS
- CHBIOS_VERSION = 3
+ CHIBIOS = ../ChibiOS3
+ CHIBIOS_VERSION = 3
CHIBIOS_BOARD =
+ CHIBIOS_CPUCLASS = ARMCMx
CHIBIOS_PLATFORM = STM32/STM32F4xx
- CHIBIOS_PORT = ARMCMx/compilers/GCC/mk/port_stm32f4xx
- CHIBIOS_DEFS =
+ CHIBIOS_PORT = stm32f4xx
CHIBIOS_LDSCRIPT = STM32F407xG.ld
# We define a non standard board script as this is not a standard ChibiOS supported board
include $(GFXLIB)/boards/base/Mikromedia-STM32-M4-ILI9341/ChibiOS_Board/board.mk
@@ -65,22 +59,3 @@ include $(GFXLIB)/tools/gmake_scripts/library_ugfx.mk
include $(GFXLIB)/tools/gmake_scripts/os_$(OPT_OS).mk
include $(GFXLIB)/tools/gmake_scripts/compiler_gcc.mk
# *** EOF ***
-##############################################################################
-###############################################################################
-# Architecture or project specific options
-#
-
-# Stack size to be allocated to the Cortex-M process stack. This stack is
-# the stack used by the main() thread.
-ifeq ($(USE_PROCESS_STACKSIZE),)
- USE_PROCESS_STACKSIZE = 0x400
-endif
-
-# Stack size to the allocated to the Cortex-M main/exceptions stack. This
-# stack is used for processing interrupts and exceptions.
-ifeq ($(USE_EXCEPTIONS_STACKSIZE),)
- USE_EXCEPTIONS_STACKSIZE = 0x400
-endif
-
-RULESPATH = $(CHIBIOS)/os/common/ports/ARMCMx/compilers/GCC
-include $(RULESPATH)/rules.mk \ No newline at end of file
diff --git a/boards/base/Mikromedia-STM32-M4-ILI9341/example_chibios_3.x/chconf.h b/boards/base/Mikromedia-STM32-M4-ILI9341/example_chibios_3.x/chconf.h
index 150bd73c..53700421 100644
--- a/boards/base/Mikromedia-STM32-M4-ILI9341/example_chibios_3.x/chconf.h
+++ b/boards/base/Mikromedia-STM32-M4-ILI9341/example_chibios_3.x/chconf.h
@@ -1,5 +1,5 @@
/*
- ChibiOS/RT - Copyright (C) 2006-2013 Giovanni Di Sirio
+ ChibiOS - Copyright (C) 2006-2014 Giovanni Di Sirio
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/boards/base/Mikromedia-STM32-M4-ILI9341/example_chibios_3.x/halconf.h b/boards/base/Mikromedia-STM32-M4-ILI9341/example_chibios_3.x/halconf.h
index 40c57eeb..06d3e2ff 100644
--- a/boards/base/Mikromedia-STM32-M4-ILI9341/example_chibios_3.x/halconf.h
+++ b/boards/base/Mikromedia-STM32-M4-ILI9341/example_chibios_3.x/halconf.h
@@ -1,5 +1,5 @@
/*
- ChibiOS/RT - Copyright (C) 2006-2013 Giovanni Di Sirio
+ ChibiOS - Copyright (C) 2006-2014 Giovanni Di Sirio
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -31,13 +31,6 @@
#include "mcuconf.h"
/**
- * @brief Enables the TM subsystem.
- */
-#if !defined(HAL_USE_TM) || defined(__DOXYGEN__)
-#define HAL_USE_TM FALSE
-#endif
-
-/**
* @brief Enables the PAL subsystem.
*/
#if !defined(HAL_USE_PAL) || defined(__DOXYGEN__)
@@ -80,6 +73,13 @@
#endif
/**
+ * @brief Enables the I2S subsystem.
+ */
+#if !defined(HAL_USE_I2S) || defined(__DOXYGEN__)
+#define HAL_USE_I2S FALSE
+#endif
+
+/**
* @brief Enables the ICU subsystem.
*/
#if !defined(HAL_USE_ICU) || defined(__DOXYGEN__)
@@ -104,7 +104,7 @@
* @brief Enables the PWM subsystem.
*/
#if !defined(HAL_USE_PWM) || defined(__DOXYGEN__)
-#define HAL_USE_PWM TRUE
+#define HAL_USE_PWM FALSE
#endif
/**
diff --git a/boards/base/Mikromedia-STM32-M4-ILI9341/example_chibios_3.x/mcuconf.h b/boards/base/Mikromedia-STM32-M4-ILI9341/example_chibios_3.x/mcuconf.h
index 047224f1..1f8378d2 100644
--- a/boards/base/Mikromedia-STM32-M4-ILI9341/example_chibios_3.x/mcuconf.h
+++ b/boards/base/Mikromedia-STM32-M4-ILI9341/example_chibios_3.x/mcuconf.h
@@ -1,5 +1,5 @@
/*
- ChibiOS/RT - Copyright (C) 2006-2013 Giovanni Di Sirio
+ ChibiOS - Copyright (C) 2006-2014 Giovanni Di Sirio
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/boards/base/OSX/example/Makefile b/boards/base/OSX/example/Makefile
index 5bbcb5df..4226f613 100644
--- a/boards/base/OSX/example/Makefile
+++ b/boards/base/OSX/example/Makefile
@@ -6,19 +6,13 @@
# General settings
# See $(GFXLIB)/tools/gmake_scripts/readme.txt for the list of variables
- OPT_VERBOSE_COMPILE = no
- OPT_GENERATE_LISTINGS = yes
- OPT_GENERATE_MAP = yes
- OPT_COPY_EXE = no
- OPT_LINK_OPTIMIZE = yes
- OPT_NONSTANDARD_FLAGS = no
OPT_OS = osx
+ OPT_LINK_OPTIMIZE = yes
# uGFX settings
# See $(GFXLIB)/tools/gmake_scripts/library_ugfx.mk for the list of variables
GFXLIB = ../uGFX
GFXBOARD = OSX
- #GFXDRIVERS = multiple/uGFXnet
GFXDEMO = modules/gdisp/basics
# OSX settings
diff --git a/boards/base/Olimex-SAM7EX256-GE8/example/Makefile b/boards/base/Olimex-SAM7EX256-GE8/example/Makefile
index 9130ed5a..fe0e5178 100644
--- a/boards/base/Olimex-SAM7EX256-GE8/example/Makefile
+++ b/boards/base/Olimex-SAM7EX256-GE8/example/Makefile
@@ -6,22 +6,16 @@
# General settings
# See $(GFXLIB)/tools/gmake_scripts/readme.txt for the list of variables
- OPT_VERBOSE_COMPILE = no
- OPT_GENERATE_LISTINGS = yes
- OPT_GENERATE_MAP = yes
- OPT_COPY_EXE = no
- OPT_LINK_OPTIMIZE = yes
- OPT_NONSTANDARD_FLAGS = no
OPT_NATIVEOS = chibios
OPT_OS = chibios
- OPT_THUMB = no
+ OPT_THUMB = yes
+ OPT_LINK_OPTIMIZE = yes
OPT_CPU = at91sam7
# uGFX settings
# See $(GFXLIB)/tools/gmake_scripts/library_ugfx.mk for the list of variables
GFXLIB = ../uGFX
GFXBOARD = Olimex-SAM7EX256-GE8
- #GFXDRIVERS = multiple/uGFXnet
GFXDEMO = modules/gdisp/basics
# ChibiOS settings
@@ -31,7 +25,6 @@ ifeq ($(OPT_OS),chibios)
CHIBIOS_BOARD = OLIMEX_SAM7_EX256
CHIBIOS_PLATFORM = AT91SAM7
CHIBIOS_PORT = GCC/ARM/AT91SAM7
- CHIBIOS_DEFS =
CHIBIOS_LDSCRIPT = AT91SAM7X256.ld
endif
diff --git a/boards/base/Win32/example/Makefile b/boards/base/Win32/example/Makefile
index 5670f0f1..0087ca90 100644
--- a/boards/base/Win32/example/Makefile
+++ b/boards/base/Win32/example/Makefile
@@ -6,20 +6,14 @@
# General settings
# See $(GFXLIB)/tools/gmake_scripts/readme.txt for the list of variables
- OPT_VERBOSE_COMPILE = no
- OPT_GENERATE_LISTINGS = yes
- OPT_GENERATE_MAP = yes
- OPT_COPY_EXE = no
- OPT_LINK_OPTIMIZE = yes
- OPT_NONSTANDARD_FLAGS = no
# For Win32 this variable can be set to "win32" (native win32 api) or "win32.chibios" (ChibiOS simulator).
OPT_OS = win32
+ OPT_LINK_OPTIMIZE = yes
# uGFX settings
# See $(GFXLIB)/tools/gmake_scripts/library_ugfx.mk for the list of variables
GFXLIB = ../uGFX
GFXBOARD = Win32
- #GFXDRIVERS = multiple/uGFXnet
GFXDEMO = modules/gdisp/basics
# ChibiOS settings
diff --git a/src/gos/gos_chibios.h b/src/gos/gos_chibios.h
index a07c72ab..a3aba712 100644
--- a/src/gos/gos_chibios.h
+++ b/src/gos/gos_chibios.h
@@ -28,6 +28,10 @@
* are already defined by ChibiOS
*/
+#if CH_KERNEL_MAJOR == 3
+ typedef char bool_t;
+#endif
+
typedef systime_t delaytime_t;
typedef systime_t systemticks_t;
typedef cnt_t semcount_t;
diff --git a/tools/gmake_scripts/compiler_gcc.mk b/tools/gmake_scripts/compiler_gcc.mk
index bc3c216b..04a68afc 100644
--- a/tools/gmake_scripts/compiler_gcc.mk
+++ b/tools/gmake_scripts/compiler_gcc.mk
@@ -9,9 +9,9 @@
# See readme.txt for the make API
#
+# Win32 Nasty - must convert all paths into a format make can handle
ifeq ($(basename $(OPT_OS)),win32)
- # Nasty - must convert all paths into a format make can handle
- PATHEXPAND := ARCH XCC XCXX XAS XLD XOC XOD XSZ PROJECT BUILDDIR SRC DEFS LIBS INCPATH LIBPATH $(PATHLIST)
+ PATHEXPAND := ARCH XCC XCXX XAS XLD XOC XOD XSZ XAR PROJECT BUILDDIR SRC DEFS LIBS INCPATH LIBPATH $(PATHLIST)
# First convert \'s to /'s
$(foreach var,$(PATHEXPAND),$(eval $(var):=$$(subst \,/,$($(var)))))
@@ -23,6 +23,14 @@ ifeq ($(basename $(OPT_OS)),win32)
endif
endif
+# Where are we
+CURRENTDIR := $(dir $(abspath $(lastword $(MAKEFILE_LIST))))
+
+# Handle cpu specific options
+ifneq ($(OPT_CPU),)
+ include $(CURRENTDIR)cpu_$(OPT_CPU).mk
+endif
+
# Path resolution - Functions to convert a source path to a object path and visa-versa
src_obj_fn := $$(1)
obj_src_fn := $$(1)
@@ -54,7 +62,10 @@ ifeq ($(XOD),)
endif
ifeq ($(XSZ),)
XSZ = $(ARCH)size
- endif
+endif
+ifeq ($(XAR),)
+ XAR = $(ARCH)ar
+endif
# Default project name is the project directory name
ifeq ($(PROJECT),)
@@ -87,6 +98,7 @@ DEPDIR = $(BUILDDIR)/dep
# Output files
MAPFILE = $(BUILDDIR)/$(PROJECT).map
+LIBFILE = $(BUILDDIR)/lib$(PROJECT).a
FAKEFILE= fakefile.o
EXEFILE =
ifeq ($(basename $(OPT_OS)),win32)
@@ -135,13 +147,10 @@ ifneq ($(OPT_NONSTANDARD_FLAGS),yes)
endif
ifeq ($(OPT_LINK_OPTIMIZE),yes)
SRCFLAGS += -ffunction-sections -fdata-sections -fno-common -flto
+ LDFLAGS += -Wl,--gc-sections
endif
ifeq ($(OPT_GENERATE_MAP),yes)
- ifeq ($(OPT_LINK_OPTIMIZE),yes)
- LDFLAGS += -Wl,-Map=$(MAPFILE),--cref,--no-warn-mismatch,--gc-sections
- else
- LDFLAGS += -Wl,-Map=$(MAPFILE),--cref,--no-warn-mismatch
- endif
+ LDFLAGS += -Wl,-Map=$(MAPFILE),--cref
endif
ifeq ($(OPT_GENERATE_LISTINGS),yes)
CFLAGS += -Wa,-alms=$(@:.o=.lst)
@@ -151,23 +160,6 @@ endif
ifneq ($(LDSCRIPT),)
LDFLAGS += -T$(LDSCRIPT)
endif
-ifeq ($(OPT_CPU),x86)
- SRCFLAGS += -m32
- LDFLAGS += -m32
-endif
-ifeq ($(OPT_CPU),x64)
- SRCFLAGS += -m64
- LDFLAGS += -m64
-endif
-ifeq ($(OPT_CPU),at91sam7)
- SRCFLAGS += -mcpu=arm7tdmi -mabi=apcs-gnu
- LDFLAGS += -mcpu=arm7tdmi
-endif
-ifeq ($(OPT_CPU),stm32m4)
- SRCFLAGS += -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 -fsingle-precision-constant -falign-functions=16
- LDFLAGS += -mcpu=cortex-m4
- LIBS += m
-endif
# Generate dependency information
SRCFLAGS += -MMD -MP -MF $(DEPDIR)/$(@F).d
@@ -176,13 +168,23 @@ SRCFLAGS += -MMD -MP -MF $(DEPDIR)/$(@F).d
SRCFLAGS += -I. $(patsubst %,-I%,$(INCPATH)) $(patsubst %,-D%,$(patsubst -D%,%,$(DEFS)))
LDFLAGS += $(patsubst %,-L%,$(LIBPATH)) $(patsubst %,-l%,$(patsubst -l%,%,$(LIBS)))
-# Targets
-.PHONY: builddirs fakefile.o fakethumbfile.o elfstats all clean Debug Release cleanDebug cleanRelease
+################# Targets ######################
+.PHONY: builddirs fakefile.o fakethumbfile.o elfstats all exe lib clean Debug Release cleanDebug cleanRelease
+
+# Many IDE's use these targets instead.
Debug Release: all
cleanDebug cleanRelease: clean
-all: builddirs $(FAKEFILE) $(TARGETS)
+# Make a program or a library?
+ifeq ($(OPT_MAKE_LIB),yes)
+ all: lib
+else
+ all: exe
+endif
+
+exe: builddirs $(FAKEFILE) $(TARGETS)
+lib: builddirs $(FAKEFILE) $(LIBFILE)
builddirs:
@mkdir -p $(BUILDDIR)
@@ -205,7 +207,9 @@ ifneq ($(OPT_VERBOSE_COMPILE),yes)
ifneq ($(filter %.s,$(SRC) $(SRC_NOTHUMB) $(SRC_THUMB)),)
@echo Assembler Options..... $(XCC) -c $(CPPFLAGS) $(CFLAGS) $(SRCFLAGS) $(@:.o=.s) -o $(OBJDIR)/$@
endif
+ ifneq ($(OPT_MAKE_LIB),yes)
@echo Linker Options........ $(XLD) $(LDFLAGS) $(OBJDIR)/$@ -o $(EXEFILE)
+ endif
@echo .
endif
@@ -275,6 +279,18 @@ ifeq ($(OPT_COPY_EXE),yes)
@cp $@ .
endif
+$(LIBFILE): $(OBJS_THUMB) $(OBJS_NOTHUMB)
+ifeq ($(OPT_VERBOSE_COMPILE),yes)
+ @echo .
+ $(XAR) -r $@ $^
+else
+ @echo Creating Library $@
+ @$(XAR) -r $@ $^
+endif
+ifeq ($(OPT_COPY_EXE),yes)
+ @cp $@ .
+endif
+
%.hex: %.elf
ifeq ($(OPT_VERBOSE_COMPILE),yes)
$(XOC) -O ihex $< $@
@@ -287,7 +303,7 @@ ifeq ($(OPT_COPY_EXE),yes)
endif
%.bin: %.elf
-ifeq ($(USE_VERBOSE_COMPILE),yes)
+ifeq ($(OPT_VERBOSE_COMPILE),yes)
$(XOC) -O binary $< $@
else
@echo Creating $@
@@ -298,7 +314,7 @@ ifeq ($(OPT_COPY_EXE),yes)
endif
%.dmp: %.elf
-ifeq ($(USE_VERBOSE_COMPILE),yes)
+ifeq ($(OPT_VERBOSE_COMPILE),yes)
$(XOD) -x --syms $< > $@
else
@echo Creating $@
@@ -311,7 +327,7 @@ endif
# Goodness knows why we would want this.
gcov:
-mkdir gcov
- $(COV) -u $(subst /,\,$(SRC))
+ $(COV) -u $(subst /,\,$(SRC_NOTHUMB) $(SRC_THUMB))
-mv *.gcov ./gcov
# Include the dependency files, should be the last of the makefile except for clean
diff --git a/tools/gmake_scripts/cpu_at91sam7.mk b/tools/gmake_scripts/cpu_at91sam7.mk
new file mode 100644
index 00000000..fe5d528d
--- /dev/null
+++ b/tools/gmake_scripts/cpu_at91sam7.mk
@@ -0,0 +1,20 @@
+#
+# This file is subject to the terms of the GFX License. If a copy of
+# the license was not distributed with this file, you can obtain one at:
+#
+# http://ugfx.org/license.html
+#
+
+#
+# See readme.txt for the make API
+#
+
+# Requirements:
+#
+# NONE
+#
+
+SRCFLAGS += -mcpu=arm7tdmi
+LDFLAGS += -mcpu=arm7tdmi
+#SRCFLAGS += -mcpu=arm7tdmi -mabi=apcs-gnu
+#LDFLAGS += -mcpu=arm7tdmi -Wl,--no-warn-mismatch
diff --git a/tools/gmake_scripts/cpu_stm32m4.mk b/tools/gmake_scripts/cpu_stm32m4.mk
new file mode 100644
index 00000000..9e105a36
--- /dev/null
+++ b/tools/gmake_scripts/cpu_stm32m4.mk
@@ -0,0 +1,19 @@
+#
+# This file is subject to the terms of the GFX License. If a copy of
+# the license was not distributed with this file, you can obtain one at:
+#
+# http://ugfx.org/license.html
+#
+
+#
+# See readme.txt for the make API
+#
+
+# Requirements:
+#
+# NONE
+#
+
+SRCFLAGS += -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 -fsingle-precision-constant -falign-functions=16
+LDFLAGS += -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16
+LIBS += m
diff --git a/tools/gmake_scripts/cpu_x64.mk b/tools/gmake_scripts/cpu_x64.mk
new file mode 100644
index 00000000..5013e260
--- /dev/null
+++ b/tools/gmake_scripts/cpu_x64.mk
@@ -0,0 +1,18 @@
+#
+# This file is subject to the terms of the GFX License. If a copy of
+# the license was not distributed with this file, you can obtain one at:
+#
+# http://ugfx.org/license.html
+#
+
+#
+# See readme.txt for the make API
+#
+
+# Requirements:
+#
+# NONE
+#
+
+SRCFLAGS += -m64
+LDFLAGS += -m64
diff --git a/tools/gmake_scripts/cpu_x86.mk b/tools/gmake_scripts/cpu_x86.mk
new file mode 100644
index 00000000..0e3e5af1
--- /dev/null
+++ b/tools/gmake_scripts/cpu_x86.mk
@@ -0,0 +1,18 @@
+#
+# This file is subject to the terms of the GFX License. If a copy of
+# the license was not distributed with this file, you can obtain one at:
+#
+# http://ugfx.org/license.html
+#
+
+#
+# See readme.txt for the make API
+#
+
+# Requirements:
+#
+# NONE
+#
+
+SRCFLAGS += -m32
+LDFLAGS += -m32
diff --git a/tools/gmake_scripts/os_chibios.mk b/tools/gmake_scripts/os_chibios.mk
index b8205dd3..f583d186 100644
--- a/tools/gmake_scripts/os_chibios.mk
+++ b/tools/gmake_scripts/os_chibios.mk
@@ -12,6 +12,7 @@
# CHIBIOS: The location of the ChibiOS code eg CHIBIOS=../chibios
# CHIBIOS_PLATFORM The name of the ChibiOS platform eg CHIBIOS_PLATFORM=AT91SAM7
# CHIBIOS_PORT The name of the ChibiOS port eg CHIBIOS_PORT=GCC/ARM/AT91SAM7
+# CHIBIOS_CPUCLASS The class of the CPU. Only required for ChibiOS v3 eg CHIBIOS_CPUCLASS=ARMCMx
#
# Optional:
@@ -20,6 +21,8 @@
# CHIBIOS_BOARD The name of the ChibiOS board eg CHIBIOS_BOARD=OLIMEX_SAM7_EX256 - if not specified you must include equivalent code yourself
# CHIBIOS_STM32LIB Use the STM32 library source for drivers instead of native drivers (yes or no) - default no
# CHIBIOS_VERSION Which version of ChibiOS is this (2 or 3) - default is 2
+# CHIBIOS_PROCESS_STACKSIZE Size of the ChibiOS process stack. Only useful if the link script supports it - default is 0x400
+# CHIBIOS_EXCEPTIONS_STACKSIZE Size of the ChibiOS exceptopms stack. Only useful if the link script supports it - default is 0x400
#
PATHLIST += CHIBIOS
@@ -29,23 +32,40 @@ ifeq ($(CHIBIOS_VERSION),3)
include $(CHIBIOS)/os/hal/osal/rt/osal.mk
include $(CHIBIOS)/os/hal/ports/$(CHIBIOS_PLATFORM)/platform.mk
include $(CHIBIOS)/os/rt/rt.mk
- include $(CHIBIOS)/os/rt/ports/$(CHIBIOS_PORT).mk
+ include $(CHIBIOS)/os/rt/ports/$(CHIBIOS_CPUCLASS)/compilers/GCC/mk/port_$(CHIBIOS_PORT).mk
+ ifneq ($(CHIBIOS_BOARD),)
+ include $(CHIBIOS)/os/hal/boards/$(CHIBIOS_BOARD)/board.mk
+ endif
+ LIBPATH += $(CHIBIOS)/os/common/ports/$(CHIBIOS_CPUCLASS)/compilers/GCC
else
include $(CHIBIOS)/os/hal/hal.mk
include $(CHIBIOS)/os/hal/platforms/$(CHIBIOS_PLATFORM)/platform.mk
include $(CHIBIOS)/os/kernel/kernel.mk
include $(CHIBIOS)/os/ports/$(CHIBIOS_PORT)/port.mk
+ ifneq ($(CHIBIOS_BOARD),)
+ include $(CHIBIOS)/boards/$(CHIBIOS_BOARD)/board.mk
+ endif
endif
-ifneq ($(CHIBIOS_BOARD),)
- include $(CHIBIOS)/boards/$(CHIBIOS_BOARD)/board.mk
-endif
ifeq ($(LDSCRIPT),)
ifneq ($(CHIBIOS_LDSCRIPT),)
LDSCRIPT= $(PORTLD)/$(CHIBIOS_LDSCRIPT)
endif
endif
+ifneq ($(LDSCRIPT),)
+ ifeq ($(CHIBIOS_PROCESS_STACKSIZE),)
+ LDFLAGS += -Wl,--defsym=__process_stack_size__=0x400
+ else
+ LDFLAGS += -Wl,--defsym=__process_stack_size__=$(CHIBIOS_PROCESS_STACKSIZE)
+ endif
+ ifeq ($(CHIBIOS_EXCEPTIONS_STACKSIZE),)
+ LDFLAGS += -Wl,--defsym=__main_stack_size__=0x400
+ else
+ LDFLAGS += -Wl,--defsym=__main_stack_size__=$(CHIBIOS_EXCEPTIONS_STACKSIZE)
+ endif
+endif
+
ifeq ($(CHIBIOS_STM32LIB),yes)
include $(CHIBIOS)/ext/stm32lib/stm32lib.mk
SRC += $(STM32SRC)
@@ -53,7 +73,7 @@ ifeq ($(CHIBIOS_STM32LIB),yes)
INCPATH += $(STM32INC)
endif
-INCPATH += $(PORTINC) $(KERNINC) $(TESTINC) \
+INCPATH += $(PORTINC) $(KERNINC) $(TESTINC) $(OSALINC) \
$(HALINC) $(PLATFORMINC) $(BOARDINC)
SRC += $(PORTSRC) \
$(KERNSRC) \
@@ -61,4 +81,5 @@ SRC += $(PORTSRC) \
$(HALSRC) \
$(PLATFORMSRC) \
$(BOARDSRC) \
+ $(OSALSRC) \
$(PORTASM)
diff --git a/tools/gmake_scripts/readme.txt b/tools/gmake_scripts/readme.txt
index 48ac2c9e..eec7dd95 100644
--- a/tools/gmake_scripts/readme.txt
+++ b/tools/gmake_scripts/readme.txt
@@ -8,6 +8,7 @@ All make script files in this directory apply the following rules and assumption
Input Variables (all optional unless otherwise specified)
----------------------------
+OPT_MAKE_LIB=no|yes - Make a library instead of an program = default no
OPT_VERBOSE_COMPILE=no|yes - Turn on full compile messages - default no
OPT_GENERATE_LISTINGS=no|yes - Generate listing files - default no
OPT_GENERATE_MAP=no|yes - Generate a map file - default no
@@ -29,6 +30,7 @@ XLD - Linker - default is "$(ARCH)gcc"
XOC - Object Copy - default is "$(ARCH)objcopy"
XOD - Object Dump - default is "$(ARCH)objdump"
XSZ - Report binary dump details - default is "$(ARCH)size"
+XAR - Library archiver - default is "$(ARCH)ar"
SRCFLAGS - Compiler defines for c, c++ and assembler files - default is ""
CFLAGS - C specific compiler defines - default is ""
@@ -61,6 +63,8 @@ Targets
----------------------------
all
+lib
+exe
clean
Debug
cleanDebug