Makefile 2.82 KB
Newer Older
1
2
3
4
5
6
7
8
9
# define main target
all: all2

# include py core make definitions
include ../py/py.mk

# program for deletion
RM = /bin/rm

Damien's avatar
Damien committed
10
STMSRC=lib
11
#STMOTGSRC=lib-otg
Damien's avatar
Damien committed
12
FATFSSRC=fatfs
13
CC3KSRC=cc3k
14
DFU=../tools/dfu.py
15
TARGET=PYBOARD
Damien's avatar
Damien committed
16
17
18
19

AS = arm-none-eabi-as
CC = arm-none-eabi-gcc
LD = arm-none-eabi-ld
20
CFLAGS_CORTEX_M4 = -mthumb -mtune=cortex-m4 -mabi=aapcs-linux -mcpu=cortex-m4 -mfpu=fpv4-sp-d16 -mfloat-abi=hard -fsingle-precision-constant -Wdouble-promotion -DSTM32F40XX -DHSE_VALUE=8000000
21
CFLAGS = -I. -I$(PY_SRC) -I$(FATFSSRC) -I$(STMSRC) -Wall -ansi -std=gnu99 -Os -DNDEBUG $(CFLAGS_CORTEX_M4) -D$(TARGET)
22
#CFLAGS += -I$(STMOTGSRC) -DUSE_HOST_MODE -DUSE_OTG_MODE
23
LDFLAGS = --nostdlib -T stm32f405.ld
Damien's avatar
Damien committed
24
25
26
27
28

SRC_C = \
	main.c \
	printf.c \
	system_stm32f4xx.c \
Damien's avatar
Damien committed
29
30
31
32
33
	stm32fxxx_it.c \
	string0.c \
	malloc0.c \
	systick.c  \
	lexerstm.c \
34
	led.c \
35
	lcd.c \
36
	servo.c \
Damien's avatar
Damien committed
37
	flash.c \
38
	storage.c \
39
	mma.c \
40
	usart.c \
Damien's avatar
Damien committed
41
	usb.c \
42
	timer.c \
43
	audio.c \
Damien's avatar
Damien committed
44
	sdio.c \
45
	pybwlan.c \
46
	i2c.c \
47
	usrsw.c \
Damien's avatar
Damien committed
48
49
50

SRC_S = \
	startup_stm32f40xx.s \
51
	gchelper.s \
Damien's avatar
Damien committed
52
53
54
55
56
57
58

SRC_FATFS = \
	ff.c \
	diskio.c \

SRC_STM = \
	stm32f4xx_rcc.c \
59
	stm32f4xx_syscfg.c \
Damien's avatar
Damien committed
60
	stm_misc.c \
Damien's avatar
Damien committed
61
62
63
	stm32f4xx_flash.c \
	stm32f4xx_dma.c \
	stm32f4xx_gpio.c \
64
	stm32f4xx_exti.c \
65
	stm32f4xx_tim.c \
66
	stm32f4xx_sdio.c \
67
68
	stm32f4xx_pwr.c \
	stm32f4xx_rtc.c \
69
	stm32f4xx_usart.c \
70
	stm32f4xx_spi.c \
71
	stm32f4xx_dac.c \
Damien's avatar
Damien committed
72
	stm32f4xx_rng.c \
Damien's avatar
Damien committed
73
74
75
76
77
78
79
80
81
	usb_core.c \
	usb_dcd.c \
	usb_dcd_int.c \
	usb_bsp.c \
	usbd_core.c \
	usbd_ioreq.c \
	usbd_req.c \
	usbd_usr.c \
	usbd_desc.c \
82
	usbd_pyb_core.c \
83
	usbd_pyb_core2.c \
Damien's avatar
Damien committed
84
85
86
87
88
	usbd_cdc_vcp.c \
	usbd_msc_bot.c  \
	usbd_msc_data.c \
	usbd_msc_scsi.c \
	usbd_storage_msd.c \
89
90
	stm324x7i_eval.c \
	stm324x7i_eval_sdio_sd.c \
Damien's avatar
Damien committed
91

92
93
94
95
96
#SRC_STM_OTG = \
#	usb_hcd.c \
#	usb_hcd_int.c \
#	usb_otg.c \

97
98
99
100
101
102
103
104
105
106
107
108
SRC_CC3K = \
	cc3000_common.c \
	evnt_handler.c \
	hci.c \
	netapp.c \
	nvmem.c \
	security.c \
	socket.c \
	wlan.c \
	ccspi.c \
	pybcc3k.c \

109
OBJ = $(addprefix $(BUILD)/, $(SRC_C:.c=.o) $(SRC_S:.s=.o) $(SRC_FATFS:.c=.o) $(SRC_STM:.c=.o) $(SRC_CC3K:.c=.o)) $(PY_O)
110
#OBJ += $(addprefix $(BUILD)/, $(SRC_STM_OTG:.c=.o))
Damien's avatar
Damien committed
111

112
all2: $(BUILD) $(BUILD)/flash.dfu
Damien's avatar
Damien committed
113

114
$(BUILD)/flash.dfu: $(BUILD)/flash0.bin $(BUILD)/flash1.bin
115
	python $(DFU) -b 0x08000000:$(BUILD)/flash0.bin -b 0x08020000:$(BUILD)/flash1.bin $@
Damien's avatar
Damien committed
116

117
118
119
120
121
$(BUILD)/flash0.bin: $(BUILD)/flash.elf
	arm-none-eabi-objcopy -O binary -j .isr_vector $^ $@

$(BUILD)/flash1.bin: $(BUILD)/flash.elf
	arm-none-eabi-objcopy -O binary -j .text -j .data $^ $@
Damien's avatar
Damien committed
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138

$(BUILD)/flash.elf: $(OBJ)
	$(LD) $(LDFLAGS) -o $@ $(OBJ)
	arm-none-eabi-size $@

$(BUILD)/%.o: %.s
	$(AS) -o $@ $<

$(BUILD)/%.o: %.c
	$(CC) $(CFLAGS) -c -o $@ $<

$(BUILD)/%.o: $(FATFSSRC)/%.c
	$(CC) $(CFLAGS) -c -o $@ $<

$(BUILD)/%.o: $(STMSRC)/%.c
	$(CC) $(CFLAGS) -c -o $@ $<

139
140
141
#$(BUILD)/%.o: $(STMOTGSRC)/%.c
#	$(CC) $(CFLAGS) -c -o $@ $<

142
143
144
$(BUILD)/%.o: $(CC3KSRC)/%.c
	$(CC) $(CFLAGS) -c -o $@ $<

Damien's avatar
Damien committed
145
clean:
146
	$(RM) -rf $(BUILD)
Damien's avatar
Damien committed
147

148
.PHONY: all all2 clean