forked from cerevo/BlueNinja_BLE_EXAMPLE
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
56 lines (42 loc) · 1.62 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
TARGET=blueninja_ble_example
#Directories
TOOL_DIR ?= /opt/cross/bin/
SDK_DIR ?= /opt/TZ10xx_SUPPORT/
BLD_DIR = build/
#Commands
CC = $(TOOL_DIR)arm-none-eabi-gcc
LD = $(TOOL_DIR)arm-none-eabi-gcc
OBJCPY = $(TOOL_DIR)arm-none-eabi-objcopy
#Flags
CFLAGS = -mcpu=cortex-m4 -mthumb -mthumb-interwork -march=armv7e-m -mfloat-abi=softfp -mfpu=fpv4-sp-d16 --specs=tz10xx.specs -std=c99 -g -O0
LDFLAGS = -mcpu=cortex-m4 -mthumb -mthumb-interwork -march=armv7e-m -mfloat-abi=softfp -mfpu=fpv4-sp-d16 --specs=tz10xx.specs -T $(SDK_DIR)TOSHIBA.TZ10xx_DFP/Device/Source/GCC/gcc_TZ10xx.ld -Wl,-Map=$(BLD_DIR)$(TARGET).map
LIBS =
#Include dir, Source files.
INCLUDE = -IRTE -IRTE/Device/TZ1001MBG
SOURCES = src/main.c src/ble_tracker.c
include *.mk
#Objects
_SRCS = $(subst $(SDK_DIR), _SDK/, $(SOURCES))
OBJS = $(addprefix $(BLD_DIR), $(patsubst %.c,%.o,$(_SRCS)))
BOOTLDR = $(BLD_DIR)bootloader_TZ10xx.o
STARTUP = $(BLD_DIR)startup_TZ10xx.o
#Depends
DEPS = $(OBJS:%.o=%.d)
$(TARGET).bin: $(OBJS) $(BOOTLDR) $(STARTUP)
$(LD) $(LDFLAGS) -o $(TARGET).elf $(OBJS) $(BOOTLDR) $(STARTUP) $(LIBS)
$(OBJCPY) -O binary $(TARGET).elf $(TARGET).bin
$(BOOTLDR): $(SDK_DIR)TOSHIBA.TZ10xx_DFP/Device/Source/GCC/bootloader_TZ10xx.S
$(CC) $(CFLAGS) -c -o $@ $<
$(STARTUP): $(SDK_DIR)TOSHIBA.TZ10xx_DFP/Device/Source/GCC/startup_TZ10xx.S
$(CC) $(CFLAGS) -c -o $@ $<
$(BLD_DIR)_SDK/%.o: $(SDK_DIR)%.c
mkdir -p $(dir $@)
$(CC) -c -MMD -MP $(CFLAGS) $(INCLUDE) -o $@ $<
$(BLD_DIR)%.o: %.c
mkdir -p $(dir $@)
$(CC) -c -MMD -MP $(CFLAGS) $(INCLUDE) -o $@ $<
clean:
rm -rf $(BLD_DIR)
rm -f $(TARGET).elf $(TARGET).bin
.PHONY: clean
-include $(DEPS)