-
Notifications
You must be signed in to change notification settings - Fork 1
/
makefile.conf
45 lines (33 loc) · 1.17 KB
/
makefile.conf
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
# Selecting Core
CORTEX_M=3
# Use newlib-nano. To disable it, specify USE_NANO=
USE_NANO=--specs=nano.specs
# Use seimhosting or not
USE_SEMIHOST=--specs=rdimon.specs -lc -lc -lrdimon
USE_NOHOST=-lm -lc -lnosys
CORE=CM$(CORTEX_M)
BASE=.
ObjDir=obj
BinDir=bin
# Compiler & Linker
CC=arm-none-eabi-gcc
AS=arm-none-eabi-as
LD=arm-none-eabi-ld
# Options for specific architecture
ARCH_FLAGS=-mthumb -mcpu=cortex-m$(CORTEX_M)
# Startup code
STARTUP=$(BASE)/startup/startup_$(SERIES).S
STARTUP_DEFS=-D__STARTUP_CLEAR_BSS -D__START=main
OPTIMIZATION=0
DEBUG=-ggdb2
#LISTING=-ahls
# -Os -flto -ffunction-sections -fdata-sections to compile for code size
CFLAGS=$(ARCH_FLAGS) $(STARTUP_DEFS) -Os -flto -ffunction-sections -fdata-sections -std=c99 -Wall -Wextra -Wstrict-prototypes -Wno-switch -O$(OPTIMIZATION) $(DEBUG)
ASFLAGS=$(LISTING) -mcpu=cortex-m$(CORTEX_M)
LDSCRIPTS=-L. -L$(BASE)/ldscripts -T mem_$(DEVICE).ld -T sections-nokeep.ld
LFLAGS=$(USE_NANO) $(USE_NOHOST) $(LDSCRIPTS) $(GC) $(MAP)
#LDFLAGS=$(ARCH_FLAGS) -O$(OPTIMIZATION) -nostartfiles -Wl,-Map=$(BinDir)/$(PROJECT).map -T$(LSCRIPT)
# Link for code size
GC=-Wl,--gc-sections
# Create map file
MAP=-Wl,-Map=$(BinDir)/$(PROJECT).map