This repository has been archived by the owner on Aug 13, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
common.mk
49 lines (44 loc) · 1.69 KB
/
common.mk
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
# Universal C Makefile for MCU targets
# Top-level template file to configure build
MAKE_COMMAND=make
# Makefile for IFI VeX Cortex Microcontroller (STM32F103VD series)
DEVICE=VexCortex
# Libraries to include in the link (use -L and -l) e.g. -lm, -lmyLib
LIBRARIES=$(wildcard $(ROOT)/firmware/*.a) -lgcc -lm
# Prefix for ARM tools (must be on the path)
MCUPREFIX=arm-none-eabi-
# Flags for the assembler
MCUAFLAGS=-mthumb -mcpu=cortex-m3 -mlittle-endian
# Flags for the compiler
MCUCFLAGS=-mthumb -mcpu=cortex-m3 -mlittle-endian -mfloat-abi=soft
# Flags for the linker
MCULFLAGS=-nostartfiles -Wl,-static -Bfirmware -Wl,-u,VectorTable -Wl,-T -Xlinker firmware/cortex.ld
# Prepares the elf file by converting it to a binary that java can write
MCUPREPARE=$(OBJCOPY) $(OUT) -O binary $(BINDIR)/$(OUTBIN)
# Advanced sizing flags
SIZEFLAGS=
# Uploads program using java
UPLOAD=@java -jar firmware/uniflash.jar vex $(BINDIR)/$(OUTBIN)
# Flashes program using the PROS CLI flash command
FLASH=pros flash -f $(BINDIR)/$(OUTBIN)
# Advanced options
ASMEXT=s
CEXT=c
CPPEXT=cpp
HEXT=h
INCLUDE=-I$(ROOT)/include -I$(ROOT)/src
OUTBIN=output.bin
OUTNAME=output.elf
# Flags for programs
AFLAGS:=$(MCUAFLAGS)
ARFLAGS:=$(MCUCFLAGS)
CCFLAGS:=-c -Wall $(MCUCFLAGS) -Os -ffunction-sections -fsigned-char -fomit-frame-pointer -fsingle-precision-constant
CFLAGS:=$(CCFLAGS) -std=gnu99 -Werror=implicit-function-declaration
CPPFLAGS:=$(CCFLAGS) -std=c++14 -fno-exceptions -fno-rtti -felide-constructors
LDFLAGS:=-Wall $(MCUCFLAGS) $(MCULFLAGS) -Wl,--gc-sections
# Tools used in program
AR:=$(MCUPREFIX)ar
AS:=$(MCUPREFIX)as
CC:=$(MCUPREFIX)gcc
CPPCC:=$(MCUPREFIX)g++
OBJCOPY:=$(MCUPREFIX)objcopy