diff options
author | DaveHodder67 <dave.hodder@focusrite.com> | 2015-07-01 16:00:05 +0100 |
---|---|---|
committer | DaveHodder67 <dave.hodder@focusrite.com> | 2015-07-01 16:00:05 +0100 |
commit | b9bac4f039aaeb8fee4b2f49bef148818408ef74 (patch) | |
tree | e4c2e51b254ce66d0356ff63f6b557e71ebb424e /Makefile | |
parent | d30110407eb706b9ac84d7c5465b95560834d947 (diff) | |
download | launchpad-polymaker-b9bac4f039aaeb8fee4b2f49bef148818408ef74.tar.gz launchpad-polymaker-b9bac4f039aaeb8fee4b2f49bef148818408ef74.zip |
importing the real code (!)
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 58 |
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 @@ | |||
1 | BUILDDIR = build | ||
2 | |||
3 | TOOLS = tools | ||
4 | |||
5 | SOURCES += src/app.c | ||
6 | |||
7 | OBJECTS = $(addprefix $(BUILDDIR)/, $(addsuffix .o, $(basename $(SOURCES)))) | ||
8 | |||
9 | INCLUDES += -Iinclude \ | ||
10 | -I\ | ||
11 | |||
12 | SYX = $(BUILDDIR)/launchpad_pro.syx | ||
13 | LIB = lib/launchpad_pro.a | ||
14 | ELF = $(BUILDDIR)/launchpad_pro.elf | ||
15 | HEX = $(BUILDDIR)/launchpad_pro.hex | ||
16 | HEXTOSYX = $(BUILDDIR)/hextosyx | ||
17 | |||
18 | HOST_CC = g++ | ||
19 | CC = arm-none-eabi-gcc | ||
20 | LD = arm-none-eabi-gcc | ||
21 | OBJCOPY = arm-none-eabi-objcopy | ||
22 | |||
23 | CFLAGS = -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 | |||
29 | LDSCRIPT = stm32_flash.ld | ||
30 | |||
31 | LDFLAGS += -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 | |||
33 | all: $(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 | |||
57 | clean: | ||
58 | rm -rf $(BUILDDIR) | ||