Found ChibiOS by accident but as it turns out it is perfectly suited to my application. However, I will be requiring hardware FPU support (as I will be doing a large amount of Matrix operations via Eigen). After modifying the makefile (see attached) to include FPU support I get the following error message:
Code: Select all
**** Build of configuration Default for project STM32F407 FYP Firmware ****
make -j1 all
arm-none-eabi-gcc -c -mcpu=cortex-m4 -O2 -ggdb -fomit-frame-pointer -falign-functions=16 -mfloat-abi=softfp -mfpu=fpv4-sp-d16 -ffunction-sections -fdata-sections -fno-common -Wall -Wextra -Wstrict-prototypes -Wa,-alms=build/lst/crt0.lst -DCORTEX_USE_FPU=TRUE -DTHUMB_PRESENT -mno-thumb-interwork -DTHUMB_NO_INTERWORKING -MD -MP -MF .dep/crt0.o.d -mthumb -DTHUMB -I. -I../ChibiOS_2.6.1/os/ports/common/ARMCMx/CMSIS/include -I../ChibiOS_2.6.1/os/ports/common/ARMCMx -I../ChibiOS_2.6.1/os/ports/GCC/ARMCMx -I../ChibiOS_2.6.1/os/ports/GCC/ARMCMx/STM32F4xx -I../ChibiOS_2.6.1/os/kernel/include -I../ChibiOS_2.6.1/test -I../ChibiOS_2.6.1/os/hal/include -I../ChibiOS_2.6.1/os/hal/platforms/STM32F4xx -I../ChibiOS_2.6.1/os/hal/platforms/STM32 -I../ChibiOS_2.6.1/os/hal/platforms/STM32/GPIOv2 -I../ChibiOS_2.6.1/os/hal/platforms/STM32/I2Cv1 -I../ChibiOS_2.6.1/os/hal/platforms/STM32/OTGv1 -I../ChibiOS_2.6.1/os/hal/platforms/STM32/RTCv2 -I../ChibiOS_2.6.1/os/hal/platforms/STM32/SPIv1 -I../ChibiOS_2.6.1/os/hal/platforms/STM32/TIMv1 -I../ChibiOS_2.6.1/os/hal/platforms/STM32/USARTv1 -I../ChibiOS_2.6.1/boards/ST_STM32F4_DISCOVERY -I../ChibiOS_2.6.1/os/various/devices_lib/accel -I../ChibiOS_2.6.1/os/various -I../Eigen -I../ChibiOS_2.6.1/os/various/cpp_wrappers ../ChibiOS_2.6.1/os/ports/GCC/ARMCMx/crt0.c -o build/obj/crt0.o
C:\Users\Thomas\AppData\Local\Temp\cck6tS4T.s: Assembler messages:
C:\Users\Thomas\AppData\Local\Temp\cck6tS4T.s:126: Error: bad instruction `vmsr FPSCR,r2'
make: *** [build/obj/crt0.o] Error 1
Which from what I can tell is the assembler not understanding that "vmsr FPSCR, r2" is a valid assembly instruction (which it is as far as I can tell from here at page 165).
Question is how can I fix this/is it a known problem?
Thanks, Thomas.
Makefile
Code: Select all
##############################################################################
# Build global options
# NOTE: Can be overridden externally.
#
# Compiler options here.
ifeq ($(USE_OPT),)
USE_OPT = -O2 -ggdb -fomit-frame-pointer -falign-functions=16
endif
# C specific options here (added to USE_OPT).
ifeq ($(USE_COPT),)
USE_COPT =
endif
# C++ specific options here (added to USE_OPT).
ifeq ($(USE_CPPOPT),)
USE_CPPOPT = -fno-rtti
endif
# Enable this if you want the linker to remove unused code and data
ifeq ($(USE_LINK_GC),)
USE_LINK_GC = yes
endif
# If enabled, this option allows to compile the application in THUMB mode.
ifeq ($(USE_THUMB),)
USE_THUMB = yes
endif
# Enable this if you want to see the full log while compiling.
ifeq ($(USE_VERBOSE_COMPILE),)
USE_VERBOSE_COMPILE = yes
endif
#
# Build global options
##############################################################################
##############################################################################
# Architecture or project specific options
#
# 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
# Enable this if you really want to use the STM FWLib.
ifeq ($(USE_FWLIB),)
USE_FWLIB = no
endif
#
# Architecture or project specific options
##############################################################################
##############################################################################
# Project, sources and paths
#
# Define project name here
PROJECT = STM32F407_FYP_Firmware
# Imported source files and paths
CHIBIOS = ../ChibiOS_2.6.1
include $(CHIBIOS)/boards/ST_STM32F4_DISCOVERY/board.mk
include $(CHIBIOS)/os/hal/platforms/STM32F4xx/platform.mk
include $(CHIBIOS)/os/hal/hal.mk
include $(CHIBIOS)/os/ports/GCC/ARMCMx/STM32F4xx/port.mk
include $(CHIBIOS)/os/kernel/kernel.mk
include $(CHIBIOS)/test/test.mk
# Imported C++ wrappers
include $(CHIBIOS)/os/various/cpp_wrappers/kernel.mk
# Define linker script file here
LDSCRIPT= $(PORTLD)/STM32F407xG.ld
#LDSCRIPT= $(PORTLD)/STM32F407xG_CCM.ld
# C sources that can be compiled in ARM or THUMB mode depending on the global
# setting.
CSRC = $(PORTSRC) \
$(KERNSRC) \
$(TESTSRC) \
$(HALSRC) \
$(PLATFORMSRC) \
$(BOARDSRC) \
$(CHIBIOS)/os/various/devices_lib/accel/lis302dl.c \
$(CHIBIOS)/os/various/shell.c \
$(CHIBIOS)/os/various/chprintf.c \
system/syscalls.c \
system/stubs.c \
usbcfg.c main.c
# C++ sources that can be compiled in ARM or THUMB mode depending on the global
# setting.
CPPSRC = $(CHCPPSRC) \
TestClass.cpp
# C sources to be compiled in ARM mode regardless of the global setting.
# NOTE: Mixing ARM and THUMB mode enables the -mthumb-interwork compiler
# option that results in lower performance and larger code size.
ACSRC =
# C++ sources to be compiled in ARM mode regardless of the global setting.
# NOTE: Mixing ARM and THUMB mode enables the -mthumb-interwork compiler
# option that results in lower performance and larger code size.
ACPPSRC =
# C sources to be compiled in THUMB mode regardless of the global setting.
# NOTE: Mixing ARM and THUMB mode enables the -mthumb-interwork compiler
# option that results in lower performance and larger code size.
TCSRC =
# C sources to be compiled in THUMB mode regardless of the global setting.
# NOTE: Mixing ARM and THUMB mode enables the -mthumb-interwork compiler
# option that results in lower performance and larger code size.
TCPPSRC =
# List ASM source files here
ASMSRC = $(PORTASM)
INCDIR = $(PORTINC) $(KERNINC) $(TESTINC) \
$(HALINC) $(PLATFORMINC) $(BOARDINC) \
$(CHIBIOS)/os/various/devices_lib/accel \
$(CHIBIOS)/os/various \
../Eigen $(CHCPPINC)
#
# Project, sources and paths
##############################################################################
##############################################################################
# Compiler settings
#
MCU = cortex-m4
#TRGT = arm-elf-
TRGT = arm-none-eabi-
CC = $(TRGT)gcc
CPPC = $(TRGT)g++
# Enable loading with g++ only if you need C++ runtime support.
# NOTE: You can use C++ even without C++ support if you are careful. C++
# runtime support makes code size explode.
#LD = $(TRGT)gcc
LD = $(TRGT)g++
CP = $(TRGT)objcopy
AS = $(TRGT)gcc -x assembler-with-cpp
OD = $(TRGT)objdump
HEX = $(CP) -O ihex
BIN = $(CP) -O binary
# ARM-specific options here
AOPT =
# THUMB-specific options here
TOPT = -mthumb -DTHUMB
# Define C warning options here
CWARN = -Wall -Wextra -Wstrict-prototypes
# Define C++ warning options here
CPPWARN = -Wall -Wextra
#
# Compiler settings
##############################################################################
##############################################################################
# Start of default section
#
# List all default C defines here, like -D_DEBUG=1
DDEFS =
# List all default ASM defines here, like -D_DEBUG=1
DADEFS =
# List all default directories to look for include files here
DINCDIR =
# List the default directory to look for the libraries here
DLIBDIR =
# List all default libraries here
DLIBS =
#
# End of default section
##############################################################################
##############################################################################
# Start of user section
#
# List all user C define here, like -D_DEBUG=1
UDEFS =
# Define ASM defines here
UADEFS =
# List all user directories here
UINCDIR =
# List the user directory to look for the libraries here
ULIBDIR =
# List all user libraries here
ULIBS =
#
# End of user defines
##############################################################################
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
ifeq ($(USE_FWLIB),yes)
include $(CHIBIOS)/ext/stm32lib/stm32lib.mk
CSRC += $(STM32SRC)
INCDIR += $(STM32INC)
USE_OPT += -DUSE_STDPERIPH_DRIVER
endif
include $(CHIBIOS)/os/ports/GCC/ARMCMx/rules.mk
##############################################################################
all:
arm-none-eabi-size.exe build/$(PROJECT).elf