summaryrefslogtreecommitdiff
path: root/software/mpu/Makefile
diff options
context:
space:
mode:
authorChristian Pointner <equinox@mur.at>2013-08-25 21:59:28 +0000
committerChristian Pointner <equinox@mur.at>2013-08-25 21:59:28 +0000
commit582ee14e1a501201e002f0b6d40180b74838f5fd (patch)
tree278c552c83ac81a89d9e53eb4b33f3505278593e /software/mpu/Makefile
parentmoved board specific code to new path (prepartion for dual support with f405-... (diff)
added support for STM32F405
git-svn-id: https://svn.spreadspace.org/mur.sat@841 7de4ea59-55d0-425e-a1af-a3118ea81d4c
Diffstat (limited to 'software/mpu/Makefile')
-rw-r--r--software/mpu/Makefile44
1 files changed, 39 insertions, 5 deletions
diff --git a/software/mpu/Makefile b/software/mpu/Makefile
index 2204662..3b242b5 100644
--- a/software/mpu/Makefile
+++ b/software/mpu/Makefile
@@ -41,6 +41,31 @@ endif
# Architecture or project specific options
#
+# set this to either F103 or F405
+ifeq ($(MURSAT_TRGT),)
+ MURSAT_TRGT = F405
+endif
+
+ifeq ($(MURSAT_TRGT),F103)
+ MCU = cortex-m3
+ STM_TYPE = STM32F1xx
+ STM_SUBTYPE = STM32F103xE
+else ifeq ($(MURSAT_TRGT),F405)
+ MCU = cortex-m4
+ STM_TYPE = STM32F4xx
+ STM_SUBTYPE = STM32F405xG
+else
+ $(error This MCU is not supported)
+endif
+
+ifeq ($(MCU),cortex-m4)
+ # Enables the use of FPU on Cortex-M4.
+ # Enable this if you really want to use the STM FWLib.
+ ifeq ($(USE_FPU),)
+ USE_FPU = yes
+ endif
+endif
+
# Enable this if you really want to use the STM FWLib.
ifeq ($(USE_FWLIB),)
USE_FWLIB = no
@@ -60,14 +85,14 @@ PROJECT = mpu
# Imported source files and paths
CHIBIOS = ../../contrib/ChibiOS_2.6.0
include board.mk
-include $(CHIBIOS)/os/hal/platforms/STM32F1xx/platform.mk
+include $(CHIBIOS)/os/hal/platforms/$(STM_TYPE)/platform.mk
include $(CHIBIOS)/os/hal/hal.mk
-include $(CHIBIOS)/os/ports/GCC/ARMCMx/STM32F1xx/port.mk
+include $(CHIBIOS)/os/ports/GCC/ARMCMx/$(STM_TYPE)/port.mk
include $(CHIBIOS)/os/kernel/kernel.mk
include $(CHIBIOS)/test/test.mk
# Define linker script file here
-LDSCRIPT= $(PORTLD)/STM32F103xE.ld
+LDSCRIPT= $(PORTLD)/$(STM_SUBTYPE).ld
# C sources that can be compiled in ARM or THUMB mode depending on the global
# setting.
@@ -122,8 +147,6 @@ INCDIR = $(PORTINC) $(KERNINC) $(TESTINC) \
# Compiler settings
#
-MCU = cortex-m3
-
#TRGT = arm-elf-
TRGT = arm-none-eabi-
CC = $(TRGT)gcc
@@ -201,6 +224,17 @@ ULIBS =
# End of user defines
##############################################################################
+DDEFS += -DMURSAT_TRGT=$(MURSAT_TRGT) -DMCUCONF_INC=\"mcuconf-$(MURSAT_TRGT).h\"
+
+ifeq ($(MCU),cortex-m4)
+ ifeq ($(USE_FPU),yes)
+ USE_OPT += -mfloat-abi=softfp -mfpu=fpv4-sp-d16 -fsingle-precision-constant
+ DDEFS += -DCORTEX_USE_FPU=TRUE
+ else
+ DDEFS += -DCORTEX_USE_FPU=FALSE
+ endif
+endif
+
ifeq ($(USE_FWLIB),yes)
include $(CHIBIOS)/ext/stm32lib/stm32lib.mk
CSRC += $(STM32SRC)