-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
50 lines (37 loc) · 1.41 KB
/
Makefile
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
# Basic Makefile
# Reminder, GNU Make uses hard tabs not spaces
# House keeping
BUILDDIR = $(PROJECT_LOC)/build
# Compiler and settings
CC = arm-none-eabi-gcc
DEBUG = -g
OPTIM = -O0
OBJCOPY = arm-none-eabi-objcopy
LDSCRIPT = standalone.ld
OBJS = $(SOURCE:.c=.o)
CFLAGS = $(DEBUG)
# Device Specifications for the compiler
MCU_GCC_DEF = GCC_ARMCM3_STM32F30X
# Linker Flags
LINKER_FLAGS = -nostartfiles -Xlinker -oF3DisDem.axf -Xlinker -M -Xlinker -Map=f3disdem.map -Xlinker --no-gc-sections
# Project-wide Libraries needed
RTOS_SOURCE_DIR=$(PROJECT_LOC)/ExtLibraries/FreeRTOSV7.4.2/FreeRTOS/Source
STM32_DRIVER_DIR = $(PROJECT_LOC)/ExtLibraries/STM2F30x_DSP_StdPeriph_Lib_V1.0.0/Libraies/STM32F30x_StdPeriph_Driver
CMSIS_DIR = $(PROJECT_LOC)/ExtLibraries/STM2F30x_DSP_StdPeriph_Lib_V1.0.0/Libraies/CMSIS/Device/ST/STM32F30x/Include
LIBS = -I . \
-I $(CMSIS_DIR) \
-I $(RTOS_SOURCE_DIR)/include \
-I $(RTOS_SOURCE_DIR)/portable/GCC/ARM_CM3 \
-I $(STM32_DRIVER_DIR)
CFLAGS=$(DEBUG) $(LIBS) \
-D $(MCU_GCC_DEF ) -D inline= -mthumb -mcpu=cortex-m3 $(OPTIM) \
-T$(LDSCRIPT) \
-D PACK_STRUCT_END=__attribute\(\(packed\)\) -D ALIGN_STRUCT_END=__attribute\(\(aligned\(4\)\)\) \
-ffunction-sections -fdata-sections
all: main
clean:
rm -f $(BUILDDIR)/build
main: main.c Makefile
mkdir $(BUILDDIR)
$(CC) -c $(CFLAGS) -O1 main.c -o $(BUILDDIR)/build/main.o
.PHONY: all clean