2016-07-29 06:51:56 +00:00
|
|
|
ARCH ?= arm
|
|
|
|
CPU ?= stm32f4xx
|
2016-07-23 05:59:54 +00:00
|
|
|
ifeq ($(ARCH),stm32f4xx)
|
|
|
|
CFLAGS += -DARCH_STM32F4XX
|
|
|
|
endif
|
|
|
|
ifeq ($(BOARD), stm32f4-discovery)
|
|
|
|
CFLAGS += -DBOARD_STM32F4_DISCOVERY
|
|
|
|
endif
|
|
|
|
CROSS_COMPILE=arm-none-eabi-
|
|
|
|
|
2016-07-26 20:35:17 +00:00
|
|
|
INCLUDES += \
|
2016-08-11 13:30:55 +00:00
|
|
|
/opt/arm-2011.09/arm-none-eabi/include \
|
|
|
|
/opt/arm-2011.09/lib/gcc/arm-none-eabi/4.6.1/include
|
2016-07-23 05:59:54 +00:00
|
|
|
|
|
|
|
ifeq ($(DEBUG),y)
|
|
|
|
OPTIM = 0
|
|
|
|
CFLAGS += -g
|
2016-07-29 06:51:56 +00:00
|
|
|
DBG_EXT = -dbg
|
2016-07-23 05:59:54 +00:00
|
|
|
else
|
|
|
|
OPTIM = s
|
|
|
|
LDFLAGS += -s
|
2016-07-29 06:51:56 +00:00
|
|
|
DBG_EXT =
|
2016-07-23 05:59:54 +00:00
|
|
|
endif
|
|
|
|
|
|
|
|
CFLAGS += \
|
|
|
|
-mthumb \
|
2016-07-28 15:01:49 +00:00
|
|
|
-T $(ROOT_DIR)/config/linker/stm32_flash.ld \
|
2016-07-23 05:59:54 +00:00
|
|
|
-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\
|
|
|
|
|
2016-07-26 20:35:17 +00:00
|
|
|
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
|
|
|
|
|
2016-07-23 05:59:54 +00:00
|
|
|
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)
|