-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMakefile
More file actions
86 lines (59 loc) · 2.17 KB
/
Makefile
File metadata and controls
86 lines (59 loc) · 2.17 KB
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
BUILDDIR = build
INCLUDES += -Iinclude -I
LIB = lib/launchpad_pro.a
ISSHO_LIB = $(BUILDDIR)/src/issho.o
ISSHO_SOURCE = src/issho.c
#SOURCES += src/flow.c src/issho.c
#OBJECTS = $(addprefix $(BUILDDIR)/, $(addsuffix .o, $(basename $(SOURCES))))
OUTPUT_PREFIX = $(BUILDDIR)/issho_launchpad_
# tools
TOOLS = tools
HEXTOSYX = $(BUILDDIR)/hextosyx
SIMULATOR = $(BUILDDIR)/simulator
HOST_GPP = g++
HOST_GCC = gcc
CC = arm-none-eabi-gcc
LD = arm-none-eabi-gcc
OBJCOPY = arm-none-eabi-objcopy
CFLAGS = -Os -Wall -I.\
-D_STM32F103RBT6_ -D_STM3x_ -D_STM32x_ -mthumb -mcpu=cortex-m3 \
-fsigned-char -DSTM32F10X_MD -DUSE_STDPERIPH_DRIVER -DHSE_VALUE=6000000UL \
-DCMSIS -DUSE_GLOBAL_CONFIG -ffunction-sections -std=c99 -mlittle-endian \
$(INCLUDES) -o
LDSCRIPT = stm32_flash.ld
LDFLAGS += -T$(LDSCRIPT) -u _start -u _Minimum_Stack_Size -mcpu=cortex-m3 -mthumb -specs=nano.specs -specs=nosys.specs -nostdlib -Wl,-static -N -nostartfiles -Wl,--gc-sections
.SECONDARY: $(wildcard *.elf) $(wildcard *.hex)
all: flow
flow: $(OUTPUT_PREFIX)flow.syx
poke: $(OUTPUT_PREFIX)poke.syx
# build the tool for conversion of ELF files to sysex, ready for upload to the unit
$(HEXTOSYX):
$(HOST_GPP) -Ofast -std=c++0x -I./$(TOOLS)/libintelhex/include ./$(TOOLS)/libintelhex/src/intelhex.cc $(TOOLS)/hextosyx.cpp -o $(HEXTOSYX)
# simulate a source
$(BUILDDIR)/%.simulator: src/%.c
$(HOST_GCC) -g3 -O0 -std=c99 -Iinclude $(TOOLS)/simulator.c $(ISSHO_SOURCE) $< -o $@
$@
# build a .syx from a .hex
$(OUTPUT_PREFIX)%.syx: $(OUTPUT_PREFIX)%.hex $(HEXTOSYX) $(BUILDDIR)/%.simulator
./$(HEXTOSYX) $< $@
# build a .hex from a .elf
%.hex: %.elf
$(OBJCOPY) -O ihex $< $@
# build the elf file for flow
$(OUTPUT_PREFIX)flow.elf: $(BUILDDIR)/src/flow.o $(LIB) $(ISSHO_LIB)
$(LD) $(LDFLAGS) -o $@ $?
# build the elf file for poke
$(OUTPUT_PREFIX)poke.elf: $(BUILDDIR)/src/poke.o $(LIB) $(ISSHO_LIB)
$(LD) $(LDFLAGS) -o $@ $?
# build a .elf file from a .o
#$(OUTPUT_PREFIX)%.elf: $(BUILDDIR)/src/%.o
# $(LD) $(LDFLAGS) -o $@ $< $(LIB)
#DEPENDS := $(OBJECTS:.o=.d)
#
#-include $(DEPENDS)
# build a .o from a .c
$(BUILDDIR)/%.o: %.c
mkdir -p $(dir $@)
$(CC) -c $(CFLAGS) -MMD -o $@ $<
clean:
rm -rf $(BUILDDIR)