summaryrefslogtreecommitdiffstats
path: root/Makefile
diff options
context:
space:
mode:
authorDaveHodder67 <dave.hodder@focusrite.com>2015-07-01 16:00:05 +0100
committerDaveHodder67 <dave.hodder@focusrite.com>2015-07-01 16:00:05 +0100
commitb9bac4f039aaeb8fee4b2f49bef148818408ef74 (patch)
treee4c2e51b254ce66d0356ff63f6b557e71ebb424e /Makefile
parentd30110407eb706b9ac84d7c5465b95560834d947 (diff)
downloadlaunchpad-polymaker-b9bac4f039aaeb8fee4b2f49bef148818408ef74.tar.gz
launchpad-polymaker-b9bac4f039aaeb8fee4b2f49bef148818408ef74.zip
importing the real code (!)
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile58
1 files changed, 58 insertions, 0 deletions
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..8c91f24
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,58 @@
1BUILDDIR = build
2
3TOOLS = tools
4
5SOURCES += src/app.c
6
7OBJECTS = $(addprefix $(BUILDDIR)/, $(addsuffix .o, $(basename $(SOURCES))))
8
9INCLUDES += -Iinclude \
10-I\
11
12SYX = $(BUILDDIR)/launchpad_pro.syx
13LIB = lib/launchpad_pro.a
14ELF = $(BUILDDIR)/launchpad_pro.elf
15HEX = $(BUILDDIR)/launchpad_pro.hex
16HEXTOSYX = $(BUILDDIR)/hextosyx
17
18HOST_CC = g++
19CC = arm-none-eabi-gcc
20LD = arm-none-eabi-gcc
21OBJCOPY = arm-none-eabi-objcopy
22
23CFLAGS = -Os -g -Wall -I.\
24-D_STM32F103RBT6_ -D_STM3x_ -D_STM32x_ -mthumb -mcpu=cortex-m3 \
25-fsigned-char -DSTM32F10X_MD -DUSE_STDPERIPH_DRIVER -DHSE_VALUE=6000000UL \
26-DCMSIS -DUSE_GLOBAL_CONFIG -g3 -ffunction-sections -std=c99 -mlittle-endian \
27$(INCLUDES) -o
28
29LDSCRIPT = stm32_flash.ld
30
31LDFLAGS += -T$(LDSCRIPT) -u _start -u _Minimum_Stack_Size -mcpu=cortex-m3 -mthumb -specs=nano.specs -specs=nosys.specs -nostdlib -Wl,-static -g3 -N -nostartfiles -Wl,--gc-sections
32
33all: $(SYX)
34
35# build the final sysex file from the ELF
36$(SYX): $(HEX) $(HEXTOSYX)
37 ./$(HEXTOSYX) $(HEX) $(SYX)
38
39# build the tool for conversion of ELF files to sysex ready for upload to the unit
40$(HEXTOSYX):
41 $(HOST_CC) -Ofast -std=c++0x -I./$(TOOLS)/libintelhex/include ./$(TOOLS)/libintelhex/src/intelhex.cc $(TOOLS)/hextosyx.cpp -o $(HEXTOSYX)
42
43$(HEX): $(ELF)
44 $(OBJCOPY) -O ihex $< $@
45
46$(ELF): $(OBJECTS)
47 $(LD) $(LDFLAGS) -o $@ $(OBJECTS) $(LIB)
48
49$(BUILDDIR)/%.o: %.c
50 mkdir -p $(dir $@)
51 $(CC) -c $(CFLAGS) $< -o $@
52
53$(BUILDDIR)/%.o: %.s
54 mkdir -p $(dir $@)
55 $(CC) -c $(CFLAGS) $< -o $@
56
57clean:
58 rm -rf $(BUILDDIR)