ARCH ?= arm CPU ?= stm32f4xx ifeq ($(CPU),stm32f4xx) CFLAGS += -DARCH_STM32F4XX endif ifeq ($(BOARD), stm32f4-discovery) CFLAGS += -DBOARD_STM32F4_DISCOVERY endif CROSS_COMPILE=arm-none-eabi- INCLUDES += \ /usr/lib/arm-none-eabi/include \ /usr/lib/gcc/arm-none-eabi/4.8/include ifeq ($(DEBUG),y) OPTIM = 0 CFLAGS += -g DBG_EXT = -dbg else OPTIM = s DBG_EXT = endif CFLAGS += \ -mthumb \ -T $(ROOT_DIR)/source/firmware/arch/stm32f4xx/linker/stm32_flash.ld \ -D USE_STDPERIPH_DRIVER\ -D VECT_TAB_FLASH\ -D GCC_ARMCM4\ -D THUMB_INTERWORK\ -D PACK_STRUCT_END=__attribute\(\(packed\)\)\ -D ALIGN_STRUCT_END=__attribute\(\(aligned\(4\)\)\)\ -mcpu=cortex-m4 \ -mfpu=fpv4-sp-d16 \ -mfloat-abi=softfp \ -fdata-sections \ -ffunction-sections # -D inline= -mthumb\ CPPCHECK_FLAGS += \ -D USE_STDPERIPH_DRIVER\ -D VECT_TAB_FLASH\ -D GCC_ARMCM4\ -D THUMB_INTERWORK\ -D PACK_STRUCT_END=__attribute\(\(packed\)\)\ -D ALIGN_STRUCT_END=__attribute\(\(aligned\(4\)\)\)\ -D __thumb__ \ --check-config LDFLAGS=\ -Wl,--gc-sections \ -Xlinker -M > $(MAP_DIR)/$(APP).map 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)