From 4c6e2433a5d7e72e037322d2e521da4d846f1aef Mon Sep 17 00:00:00 2001 From: Joel Bodenmann Date: Sat, 29 Aug 2015 16:35:34 +0200 Subject: Updating ChibiOS 3.x build system support --- tools/gmake_scripts/os_chibios.mk | 73 ++------------------------------ tools/gmake_scripts/os_chibios_2.mk | 72 +++++++++++++++++++++++++++++++ tools/gmake_scripts/os_chibios_3.mk | 84 +++++++++++++++++++++++++++++++++++++ 3 files changed, 160 insertions(+), 69 deletions(-) create mode 100644 tools/gmake_scripts/os_chibios_2.mk create mode 100644 tools/gmake_scripts/os_chibios_3.mk (limited to 'tools') diff --git a/tools/gmake_scripts/os_chibios.mk b/tools/gmake_scripts/os_chibios.mk index f583d186..536ec3f7 100644 --- a/tools/gmake_scripts/os_chibios.mk +++ b/tools/gmake_scripts/os_chibios.mk @@ -9,77 +9,12 @@ # Requirements: # -# 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 +# CHIBIOS_VERSION Which version of ChibiOS is this (2 or 3) - default is 3 # -# Optional: -# -# CHIBIOS_LDSCRIPT The name of the loader script eg CHIBIOS_LDSCRIPT=AT91SAM7X256.ld -# 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 -ifeq ($(CHIBIOS_VERSION),3) - include $(CHIBIOS)/os/hal/hal.mk - 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_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 +ifeq ($(CHIBIOS_VERSION),2) + include $(GFXLIB)/tools/gmake_scripts/os_chibios_2.mk 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 - -ifeq ($(LDSCRIPT),) - ifneq ($(CHIBIOS_LDSCRIPT),) - LDSCRIPT= $(PORTLD)/$(CHIBIOS_LDSCRIPT) - endif + include $(GFXLIB)/tools/gmake_scripts/os_chibios_3.mk 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) - DEFS += USE_STDPERIPH_DRIVER - INCPATH += $(STM32INC) -endif - -INCPATH += $(PORTINC) $(KERNINC) $(TESTINC) $(OSALINC) \ - $(HALINC) $(PLATFORMINC) $(BOARDINC) -SRC += $(PORTSRC) \ - $(KERNSRC) \ - $(TESTSRC) \ - $(HALSRC) \ - $(PLATFORMSRC) \ - $(BOARDSRC) \ - $(OSALSRC) \ - $(PORTASM) diff --git a/tools/gmake_scripts/os_chibios_2.mk b/tools/gmake_scripts/os_chibios_2.mk new file mode 100644 index 00000000..299f42ec --- /dev/null +++ b/tools/gmake_scripts/os_chibios_2.mk @@ -0,0 +1,72 @@ +# +# 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: +# +# 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 +# + +# Optional: +# +# CHIBIOS_LDSCRIPT The name of the loader script eg. CHIBIOS_LDSCRIPT = AT91SAM7X256.ld +# CHIBIOS_BOARD The name of the ChibiOS board eg. CHIBIOS_BOARD = OLIMEX_SAM7_EX256 - if not specified you must include equivalent code yourself +# CHIBIOS_VERSION Which version of ChibiOS is this (2 or 3) - default is 3 +# CHIBIOS_STM32LIB Use the STM32 library source for drivers instead of native drivers (yes or no) - default no +# 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 + +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 + +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) + DEFS += USE_STDPERIPH_DRIVER + INCPATH += $(STM32INC) +endif + +INCPATH += $(PORTINC) $(KERNINC) $(OSALINC) \ + $(HALINC) $(PLATFORMINC) $(BOARDINC) + +SRC += $(PORTSRC) \ + $(KERNSRC) \ + $(HALSRC) \ + $(PLATFORMSRC) \ + $(BOARDSRC) \ + $(OSALSRC) \ + $(PORTASM) diff --git a/tools/gmake_scripts/os_chibios_3.mk b/tools/gmake_scripts/os_chibios_3.mk new file mode 100644 index 00000000..1a44f4b1 --- /dev/null +++ b/tools/gmake_scripts/os_chibios_3.mk @@ -0,0 +1,84 @@ +# +# 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: +# +# CHIBIOS The location of the ChibiOS code. eg CHIBIOS = ../chibios +# CHIBIOS_CPUCLASS The class of the CPU. eg CHIBIOS_CPUCLASS = ARMCMx +# CHIBIOS_PLATFORM The name of the ChibiOS platform. eg CHIBIOS_PLATFORM = STM32 +# CHIBIOS_DEVICE_FAMILY The name of the ChibiOS device family. eg CHIBIOS_DEVICE_FAMILY = STM32F4xx +# CHIBIOS_STARTUP The name of the ChibiOS startup files. eg CHIBIOS_STARTUP = startup_stm32f4xx +# CHIBIOS_PORT The name of the ChibiOS port. eg CHIBIOS_PORT = v7m +# + +# Optional: +# +# CHIBIOS_LDSCRIPT The name of the loader script eg CHIBIOS_LDSCRIPT = STM32F429xI.ld +# CHIBIOS_BOARD The name of the ChibiOS board eg CHIBIOS_BOARD = ST_STM32F429I_DISCOVERY - if not specified you must include equivalent code yourself +# CHIBIOS_VERSION Which version of ChibiOS is this (2 or 3) - default is 3 +# 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 + + + +include $(CHIBIOS)/os/common/ports/$(CHIBIOS_CPUCLASS)/compilers/GCC/mk/$(CHIBIOS_STARTUP).mk +include $(CHIBIOS)/os/hal/hal.mk +include $(CHIBIOS)/os/hal/ports/$(CHIBIOS_PLATFORM)/$(CHIBIOS_DEVICE_FAMILY)/platform.mk +include $(CHIBIOS)/os/hal/osal/rt/osal.mk +include $(CHIBIOS)/os/rt/rt.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 + +ifeq ($(LDSCRIPT),) + ifneq ($(CHIBIOS_LDSCRIPT),) + LDSCRIPT= $(STARTUPLD)/$(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 + +# Add include files +INCPATH += $(STARTUPINC) \ + $(KERNINC) \ + $(PORTINC) \ + $(OSALINC) \ + $(HALINC) \ + $(PLATFORMINC) \ + $(BOARDINC) + +# Add C files +SRC += $(STARTUPSRC) \ + $(KERNSRC) \ + $(PORTSRC) \ + $(OSALSRC) \ + $(HALSRC) \ + $(PLATFORMSRC) \ + $(BOARDSRC) + +# Add ASM files +SRC += $(STARTUPASM) \ + $(PORTASM) \ + $(OSALASM) -- cgit v1.2.3