diff --git a/conf/Makefile.arm-common b/conf/Makefile.arm-common deleted file mode 100644 index 3f24704557..0000000000 --- a/conf/Makefile.arm-common +++ /dev/null @@ -1,43 +0,0 @@ -# Hey Emacs, this is a -*- makefile -*- -# -# Copyright (C) 2012 Felix Ruess -# -# This file is part of paparazzi. -# -# paparazzi is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2, or (at your option) -# any later version. -# -# paparazzi is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with paparazzi; see the file COPYING. If not, see -# . -# - -# -# This is the common Makefile for finding the arm compiler and OpenOcd -# - -# -# some generic and informative targets -# -printcommands: - @echo "" - @echo "Using CC = $(CC)" -# @echo "Using LD = $(LD)" -# @echo "Using CP = $(CP)" -# @echo "Using DMP = $(DMP)" -# @echo "Using NM = $(NM)" -# @echo "Using SIZE = $(SIZE)" - @echo "GCC version:" - @$(CC) --version | head -1 - @echo "" - - -.PHONY : printcommands - diff --git a/conf/Makefile.arm-embedded b/conf/Makefile.arm-embedded-common similarity index 74% rename from conf/Makefile.arm-embedded rename to conf/Makefile.arm-embedded-common index f3022f8190..936141bf4e 100644 --- a/conf/Makefile.arm-embedded +++ b/conf/Makefile.arm-embedded-common @@ -4,12 +4,21 @@ # -# This is the common Makefile for finding the arm compiler and OpenOcd +# This has some common targets # for bare metal systems like on the ARM7TDMI, cortex M3/4 -# include the common ARM makefiles to print the commands and find the toolchain -include $(PAPARAZZI_SRC)/conf/Makefile.arm-common -include $(PAPARAZZI_SRC)/conf/Makefile.arm-embedded-toolchain + +printcommands: + @echo "" + @echo "Using CC = $(CC)" +# @echo "Using LD = $(LD)" +# @echo "Using CP = $(CP)" +# @echo "Using DMP = $(DMP)" +# @echo "Using NM = $(NM)" +# @echo "Using SIZE = $(SIZE)" + @echo "GCC version:" + @$(CC) --version | head -1 + @echo "" # Display size of file. HEXSIZE = $(SIZE) --target=$(FORMAT) $(OBJDIR)/$(TARGET).hex @@ -46,4 +55,4 @@ clean_list : $(RM) .dep/* $(RM) *~ -.PHONY : sizebefore sizeafter clean clean_list +.PHONY : printcommands sizebefore sizeafter clean clean_list diff --git a/conf/Makefile.arm-linux b/conf/Makefile.arm-linux-toolchain similarity index 95% rename from conf/Makefile.arm-linux rename to conf/Makefile.arm-linux-toolchain index f767a488be..56ef04af12 100644 --- a/conf/Makefile.arm-linux +++ b/conf/Makefile.arm-linux-toolchain @@ -35,6 +35,3 @@ GDB = $(PREFIX)-gdb # some general commands RM = rm - - -include $(PAPARAZZI_SRC)/conf/Makefile.arm-common diff --git a/conf/Makefile.lpc21 b/conf/Makefile.lpc21 index 5d2ea4acbb..be535d4193 100644 --- a/conf/Makefile.lpc21 +++ b/conf/Makefile.lpc21 @@ -37,7 +37,7 @@ Q=@ # # find compiler toolchain # -include $(PAPARAZZI_SRC)/conf/Makefile.arm-embedded +include $(PAPARAZZI_SRC)/conf/Makefile.arm-embedded-toolchain # # if the new arm-none-eabi multilib compiler was not found try the old arm-elf one @@ -68,7 +68,6 @@ ASRCARM = crt0.S # Optimization level, can be [0, 1, 2, 3, s]. # 0 = turn off optimization. s = optimize for size. -# (Note: 3 is not always the best optimization level. See avr-libc FAQ.) OPT = s #OPT=3 @@ -86,12 +85,15 @@ CFLAGS += -ffunction-sections -fdata-sections CFLAGS += -finline-limit=1200 --param inline-unit-growth=100 # flags for warnings -CFLAGS += -Wall -Wextra -CFLAGS += -Wcast-qual -Wimplicit -Wcast-align -CFLAGS += -Wpointer-arith -Wswitch -CFLAGS += -Wredundant-decls -Wreturn-type -Wshadow -Wunused -CFLAGS += -Wstrict-prototypes -Wmissing-declarations -CFLAGS += -Wmissing-prototypes -Wnested-externs +CFLAGS += -Wall -Wextra -Wunused +CFLAGS += -Wcast-qual +CFLAGS += -Wcast-align +CFLAGS += -Wpointer-arith +CFLAGS += -Wswitch-default +CFLAGS += -Wredundant-decls -Wmissing-declarations +CFLAGS += -Wstrict-prototypes -Wmissing-prototypes +CFLAGS += -Wshadow +CFLAGS += -Wnested-externs CFLAGS += $(CSTANDARD) CFLAGS += $($(TARGET).CFLAGS) $(LOCAL_CFLAGS) @@ -166,6 +168,8 @@ GENDEPFLAGS = -MD -MP -MF .dep/$(@F).d ALL_CFLAGS = -mcpu=$(MCU) $(THUMB_IW) -I. $(CFLAGS) ALL_ASFLAGS = -mcpu=$(MCU) $(THUMB_IW) -I. -x assembler-with-cpp $(ASFLAGS) +# some common informative targets +include $(PAPARAZZI_SRC)/conf/Makefile.arm-embedded-common # Default target. all: printcommands sizebefore build sizeafter diff --git a/conf/Makefile.omap b/conf/Makefile.omap index 09d4556fdc..ef4ff0cd35 100644 --- a/conf/Makefile.omap +++ b/conf/Makefile.omap @@ -24,7 +24,7 @@ # # find compiler toolchain # -include $(PAPARAZZI_SRC)/conf/Makefile.arm-linux +include $(PAPARAZZI_SRC)/conf/Makefile.arm-linux-toolchain # Define programs and commands. @@ -69,6 +69,14 @@ OBJ_C_OMAP = $(SRC_C_OMAP:%.c=$(OBJDIR)/%.o) SRC_CPP_OMAP = $($(TARGET).cpp_srcs) OBJ_CPP_OMAP = $(SRC_CPP_OMAP:%.cpp=$(OBJDIR)/%.o) +printcommands: + @echo "" + @echo "Using CC = $(CC)" +# @echo "Using LD = $(LD)" + @echo "GCC version:" + @$(CC) --version | head -1 + @echo "" + all: printcommands build build: $(OBJDIR) elf @@ -102,7 +110,7 @@ $(OBJDIR)/%.o : %.cpp $(OBJDIR)/../Makefile.ac # Listing of phony targets. -.PHONY : all build elf clean clean_list +.PHONY : printcommands all build elf # # Dependencies diff --git a/conf/Makefile.stm32 b/conf/Makefile.stm32 index ba400c1769..f29f25be69 100644 --- a/conf/Makefile.stm32 +++ b/conf/Makefile.stm32 @@ -34,7 +34,7 @@ Q=@ # # find compiler toolchain # -include $(PAPARAZZI_SRC)/conf/Makefile.arm-embedded +include $(PAPARAZZI_SRC)/conf/Makefile.arm-embedded-toolchain ifeq ($(ARCH_L),f4) @@ -103,7 +103,7 @@ endif endif CFLAGS = -I. -I./$(ARCH) -I../ext/libopencm3/include $(INCLUDES) -CFLAGS += -D__thumb2__ -Wall -O$(OPT) +CFLAGS += -D__thumb2__ -O$(OPT) ifeq ($(ARCH_L), ) CFLAGS += -msoft-float else ifeq ($(ARCH_L),f4) @@ -113,24 +113,30 @@ else CFLAGS += -mfloat-abi=hard -mfpu=fpv4-sp-d16 endif endif + +CSTANDARD = -std=gnu99 + CFLAGS += -Wl,--gc-sections CFLAGS += -mfix-cortex-m3-ldrd CFLAGS += -mcpu=$(MCU) -mthumb -ansi -CFLAGS += -std=gnu99 +CFLAGS += $(CSTANDARD) #CFLAGS += -malignment-traps CFLAGS += -fno-common CFLAGS += -g$(DEBUG) CFLAGS += -ffunction-sections -fdata-sections -CFLAGS += -Wimplicit -CFLAGS += -Wcast-align -CFLAGS += -Wpointer-arith -Wswitch -CFLAGS += -Wredundant-decls -Wreturn-type -Wshadow -Wunused CFLAGS += -Wa,-adhlns=$(OBJDIR)/$(notdir $(subst $(suffix $<),.lst,$<)) -CFLAGS += -Wnested-externs -CFLAGS += -Wmissing-prototypes -CFLAGS += -Wstrict-prototypes -CFLAGS += -Wmissing-declarations + +# flags for warnings +CFLAGS += -Wall -Wextra -Wunused +#CFLAGS += -Wcast-qual +CFLAGS += -Wcast-align +CFLAGS += -Wpointer-arith CFLAGS += -Wswitch-default +CFLAGS += -Wredundant-decls -Wmissing-declarations +CFLAGS += -Wstrict-prototypes -Wmissing-prototypes +CFLAGS += -Wshadow +CFLAGS += -Wnested-externs + ifneq ($(ARCH_L), ) ifeq ($(ARCH_L),f4) CFLAGS += -DSTM32F4 @@ -173,7 +179,8 @@ CPFLAGS_HEX = -Oihex ODFLAGS = -S - +# some common informative targets +include $(PAPARAZZI_SRC)/conf/Makefile.arm-embedded-common # Default target. all: printcommands sizebefore build sizeafter