48 lines
1.1 KiB
Makefile
48 lines
1.1 KiB
Makefile
ARCH ?= stm32f4xx
|
|
ifeq ($(ARCH),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
|
|
|
|
ifeq ($(DEBUG),y)
|
|
OPTIM = 0
|
|
CFLAGS += -g
|
|
else
|
|
OPTIM = s
|
|
LDFLAGS += -s
|
|
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\
|
|
|
|
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)
|