Statistics
| Branch: | Tag: | Revision:

mongoose / examples / STM32F4_CC3100 / Makefile.build @ eaef5bd1

History | View | Annotate | Download (2.79 KB)

1
# -*- mode: makefile -*-
2
.PHONY: all clean
3

    
4
CC3100_DRV_SRCS = driver.c device.c nonos.c socket.c netapp.c wlan.c
5

    
6
CC3100_PLATFORM_SRCS = spi.c board.c cli_uart.c stm32f4xx_it.c system_stm32f4xx.c stm32f4xx_hal_msp.c
7

    
8
STM32F4_SRCS = stm32f4xx_hal_spi.c stm32f4xx_hal_gpio.c stm32f4xx_hal_cortex.c\
9
               stm32f4xx_hal.c stm32f4xx_hal_rcc.c stm32f4xx_hal_dma.c \
10
               stm32f4xx_hal_pwr_ex.c stm32f4_discovery.c stm32f4xx_hal_i2c.c \
11
               stm32f4xx_hal_uart.c stm32f4xx_hal_tim.c \
12
               stm32f4xx_hal_tim_ex.c stm32f4xx_hal_rtc_ex.c stm32f4xx_hal_rtc.c
13

    
14
SRCS = main.c mongoose.c startup_utils.c ${CC3100_DRV_SRCS} ${CC3100_PLATFORM_SRCS} ${STM32F4_SRCS}
15

    
16
REPO_ROOT=./../../
17
CC3100_SDKROOT=/opt/CC3100SDK_1.2.0/cc3100-sdk
18
STM32CUBEF4_ROOT=/opt/STM32CubeF4
19
STM32CUBEF4_DRV_PATH=${STM32CUBEF4_ROOT}/Drivers
20

    
21
CC = arm-none-eabi-gcc
22
OBJCOPY = arm-none-eabi-objcopy
23

    
24
FP_FLAGS = -mfloat-abi=hard -mfpu=fpv4-sp-d16
25
ARCH_FLAGS = -mthumb -mcpu=cortex-m4
26

    
27
BUILD_DIR=.build
28
OUT_DIR=out
29
PROJECT=example
30
BOARD=STM32F429xx
31
STARTUP_SCRIPT=startup_stm32f429xx.s
32

    
33
INCDIRS = $(addprefix -I,$(IPATH))
34

    
35
OBJS = $(addprefix $(BUILD_DIR)/,$(patsubst %.c,%.o,$(SRCS)) $(patsubst %.s,%.o,$(STARTUP_SCRIPT)))
36

    
37
VPATH = ${CC3100_SDKROOT}/simplelink/source\
38
        ${CC3100_SDKROOT}/platform/stm32discovery\
39
        ${STM32CUBEF4_ROOT}/Drivers/STM32F4xx_HAL_Driver/Src\
40
        ${STM32CUBEF4_ROOT}/Drivers/BSP/STM32F4-Discovery\
41
        ${REPO_ROOT}
42

    
43
# CC3100 SDK and STM32 SDK include headers w/out path, just like
44
# #include "simplelink.h". As result, we have to add all required directories
45
# into IPATH
46

    
47
IPATH = . ${CC3100_SDKROOT}/simplelink/include\
48
        ${CC3100_SDKROOT}/platform/stm32discovery\
49
        ${STM32CUBEF4_DRV_PATH}/BSP/STM32F4-Discovery\
50
        ${STM32CUBEF4_DRV_PATH}/STM32F4xx_HAL_Driver/Inc\
51
        ${STM32CUBEF4_DRV_PATH}/CMSIS/Include\
52
        ${STM32CUBEF4_DRV_PATH}/CMSIS/Device/ST/STM32F4xx/Include
53

    
54
LDFLAGS	= --static -nostartfiles
55
LDLIBS = -Wl,--start-group -lc -lgcc -lnosys -Wl,--end-group
56
LDSCRIPT = stm32f429xx.ld
57

    
58
INCDIRS = $(addprefix -I,$(IPATH))
59

    
60
CFLAGS = ${FP_FLAGS} ${ARCH_FLAGS} ${INCDIRS}\
61
         -D${BOARD} -DEXT_LIB_REGISTERED_GENERAL_EVENTS \
62
         -DSL_FULL\
63
         -DCS_PLATFORM=6 \
64
         -D__STM32F407xx_H \
65
         -DMG_SIMPLELINK_NO_OSI \
66
         -DMG_ENABLE_MQTT \
67
         -g -fno-common -ffunction-sections -fdata-sections \
68

    
69
ELF = ${BUILD_DIR}/${PROJECT}.elf
70
BIN = ${OUT_DIR}/${PROJECT}.bin
71

    
72
all: ${BUILD_DIR} ${OUT_DIR} ${OBJS} ${ELF} ${BIN}
73

    
74
${BUILD_DIR}:
75
	mkdir -p $@
76

    
77
${OUT_DIR}:
78
	mkdir -p $@
79

    
80
$(BUILD_DIR)/%.o: %.c
81
	$(CC) ${CFLAGS} $^ -c -o $@
82

    
83
$(BUILD_DIR)/%.o: %.s
84
	$(CC) ${CFLAGS} $^ -c -o $@
85

    
86
${ELF}: ${OBJS}
87
	$(CC) ${ARCH_FLAGS} ${FP_FLAGS} $(LDFLAGS) $(OBJS) $(LDLIBS) -T$(LDSCRIPT) -o $@
88

    
89
${BIN}: ${ELF}
90
	$(OBJCOPY) -Obinary $^ $@
91

    
92
clean:
93
	rm -rf ${BUILD_DIR} ${OUT_DIR}