diff --git a/config/make/rules.mk b/config/make/rules.mk index ce4a2cb..45e4a31 100755 --- a/config/make/rules.mk +++ b/config/make/rules.mk @@ -15,6 +15,8 @@ CFLAGS += \ $(addprefix -I, $(INCLUDES)) \ -Wall +CPPCHECK_FLAGS = --template=gcc --error-exitcode=1 --enable=all --inline-suppr + include $(ROOT_DIR)/config/make/tools.mk SRC_DIR = $(ROOT_DIR)/source diff --git a/config/make/stm32f4xx.mk b/config/make/stm32f4xx.mk index a50b17e..71a2ad2 100644 --- a/config/make/stm32f4xx.mk +++ b/config/make/stm32f4xx.mk @@ -7,7 +7,7 @@ CFLAGS += -DBOARD_STM32F4_DISCOVERY endif CROSS_COMPILE=arm-none-eabi- -INCLUDES := /opt/arm-2011.03/arm-none-eabi/include +INCLUDES := /usr/lib/arm-none-eabi/include ifeq ($(DEBUG),y) OPTIM = 0 @@ -40,11 +40,8 @@ LDFLAGS=\ ASFLAGS=-mapcs-32 -g ARFLAGS=rcs - OOCD_IMAGE=$(BINFILE) OOCD_CFG_FILE=$(EXE_DIR)/openocd.cfg PRE_PROGRAM = echo "telnet_port 4444\ninit\nreset halt\nflash write_image erase $(OOCD_IMAGE) 0x08000000 bin\nreset run\n shutdown\n" > $(OOCD_CFG_FILE) - PROGRAM = openocd -f /usr/share/openocd/scripts/board/stm32f4discovery.cfg -f $(OOCD_CFG_FILE) -#PROGRAM = st-flash write $(BINFILE) 0x8000000 diff --git a/config/make/tools.mk b/config/make/tools.mk index 029c0ec..6a48eff 100755 --- a/config/make/tools.mk +++ b/config/make/tools.mk @@ -13,3 +13,4 @@ RM = rm -f MV = mv CP = cp MKDIR = mkdir -p +CPPCHECK = cppcheck \ No newline at end of file diff --git a/source/Makefile b/source/Makefile index 8316489..e436109 100755 --- a/source/Makefile +++ b/source/Makefile @@ -45,6 +45,7 @@ $(OBJ_DIR)/%.o: $(SRC_DIR)/%.c @$(MKDIR) $(OBJ_DIR) @$(foreach folder, $(SUB_FOLDER), $(shell mkdir -p $(OBJ_DIR)/$(folder))) $(call makedep,$<,$@,$(subst .o,.d,$@)) + $(CPPCHECK) $(CPPCHECK_FLAGS) $< $(CC) $(CFLAGS) -c $< -o $@ $(OBJ_DIR)/%.o: $(SRC_DIR)/%.s