-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile.common
56 lines (48 loc) · 2.21 KB
/
Makefile.common
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
TOP=$(shell readlink -f "$(dir $(lastword $(MAKEFILE_LIST)))")
PROGRAM=main
BUILDDIR=$(TOP)/build
LIBDIR=$(TOP)/libs
#Adust the following line to the library in use
STMLIB=$(LIBDIR)/STM32F10x_StdPeriph_Lib_V3.5.0/Libraries
STMUTIL=$(LIBDIR)/STM32F10x_StdPeriph_Lib_V3.5.0/Utilities
#TCPREFIX = $(TOP)/../gnu-gcc-arm/gnu-toolchain/bin/
TC=arm-none-eabi-
CC=$(TC)gcc
LD=$(TC)ld
OBJCOPY=$(TC)objcopy
AR=$(TC)ar
GDB=$(TC)gdb
RE=$(TC)readelf
SIZE=$(TC)size
OD=$(TC)objdump
NM=$(TC)nm
STM32FLASH = ./stm32_flash.py
FLASHLOC = 0x08000000
# project specific
INCLUDE=-I$(TOP)/inc
# INCLUDE+=-I$(TOP)/inc/usb
INCLUDE+=-I$(TOP)/inc/eth
# includes for stmlib 3.5.0 w/o USB
INCLUDE+=-I$(STMLIB)/CMSIS/CM3/CoreSupport
INCLUDE+=-I$(STMLIB)/CMSIS/CM3/DeviceSupport/ST/STM32F10x
INCLUDE+=-I$(STMLIB)/STM32F10x_StdPeriph_Driver/inc
#INCLUDE+=-I$(STMLIB)/STM32_USB_OTG_Driver/inc
#INCLUDE+=-I$(STMLIB)/STM32_USB_Device_Library/Core/inc
#INCLUDE+=-I$(STMLIB)/STM32_USB_Device_Library/Class/cdc/inc
#Compiler optimize settings:
# -O0 no optimize, reduce compilation time and make debugging produce the expected results (default).
# -O1 optimize, reduce code size and execution time, without much increase of compilation time.
# -O2 optimize, reduce code execution time compared to ‘O1’, increase of compilation time.
# -O3 optimize, turns on all optimizations, further increase of compilation time.
# -Os optimize for size, enables all ‘-O2’ optimizations that do not typically increase code size and other code size optimizations.
# default settings for release version: COMMONFLAGS=-O3 -g -mcpu=cortex-m3 -mthumb
# default settings for debug version: COMMONFLAGS=-O0 -g -mcpu=cortex-m3 -mthumb
# option -Werror treats all warnings as errors
#COMMONFLAGS=-O3 -g -mcpu=cortex-m3 -mthumb # https://github.com/texane/stlink/issues/65 << stdlib laesst sich nicht mit optimize flags compilen fix wird im link beschrieben
COMMONFLAGS=-Os -g -mcpu=cortex-m3 -mthumb
#COMMONFLAGS=-O0 -g -mcpu=cortex-m3 -mthumb
CFLAGS+=$(COMMONFLAGS) -Wall $(INCLUDE)
#Adust the following line to the type of MCU used and stdt lib components
#Adust the following line to the type of MCU used and stdt lib components
CFLAGS+=-D STM32F10X_CL -DUSE_STDPERIPH_DRIVER
CFLAGS+=-D VECT_TAB_FLASH