forked from jishminor/ee445l-linux
-
Notifications
You must be signed in to change notification settings - Fork 0
/
makedefs
95 lines (75 loc) · 3.39 KB
/
makedefs
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
#******************************************************************************
#
# Makefile - Rules for building the Project Zero Example.
#
# Copyright (c) 2012-2017 Texas Instruments Incorporated. All rights reserved.
# Software License Agreement
#
# Texas Instruments (TI) is supplying this software for use solely and
# exclusively on TI's microcontroller products. The software is owned by
# TI and/or its suppliers, and is protected under applicable copyright
# laws. You may not combine this software with "viral" open-source
# software in order to form a larger program.
#
# THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS.
# NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT
# NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY
# CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL
# DAMAGES, FOR ANY REASON WHATSOEVER.
#
# This is part of revision 2.1.4.178 of the EK-TM4C123GXL Firmware Package.
#
#******************************************************************************
TIVAWARE_ROOT = $(ROOT)/TivaWare
TIVA_DRIVERS = $(TIVAWARE_ROOT)/driverlib
VALVANO_ROOT = $(ROOT)/ValvanoWare
SRCS = $(wildcard $(ROOT)/shared/*.c)
SRCS += $(TIVAWARE_ROOT)/driverlib/gcc/libdriver.a
WARNING_LEVEL = -Wall -Wextra -Wpedantic -Werror -Wno-unused-parameter
OPTIMIZATION_LEVEL = -O0 # Required for debugging via GDB
LIBS = '$(shell $(CC) $(CFLAGS) -print-file-name=libm.a)'
LIBS += '$(shell $(CC) $(CFLAGS) -print-file-name=libc.a)'
LIBS += '$(shell $(CC) $(CFLAGS) -print-file-name=librdimon.a)'
LIBS += '$(shell $(CC) $(CFLAGS) -print-libgcc-file-name)'
# NOTE: GCC cannot compile the Keil assembly syntax (*.S files in Valvanoware)
# However, conversion between Keil and GCC syntax is very simple (and you probably won't
# have to do it). See startup.c functions with `__asm()` in them to see examples of
# functions that have been convereted from Keil syntax to GCC.
AFLAGS = -mthumb -mcpu=cortex-m4 -mfpu=fpv4-sp-d16 -mfloat-abi=hard -MD
CFLAGS = -mthumb -mcpu=cortex-m4 -mfpu=fpv4-sp-d16 -mfloat-abi=hard -ffunction-sections -fdata-sections -MD
CFLAGS += -std=c99 $(WARNING_LEVEL) -DPART_TM4C123GH6PM -c -specs=rdimon.specs -Wl,--gc-sections
CFLAGS += $(WARNING_LEVEL) $(OPTIMIZATION_LEVEL)
CFLAGS += -g -D DEBUG
DEFS = -DPART_TM4C123GH6PM -DTARGET_IS_TM4C123_RB1
INC_DIRS = $(addprefix -I, $(TIVAWARE_ROOT))
INC_DIRS += $(addprefix -I, $(TIVA_DRIVERS))
INC_DIRS += $(addprefix -I, $(VALVANO_ROOT))
INC_DIRS += $(addprefix -I, $(ROOT))
INC_DIRS += $(addprefix -I, $(ROOT)/shared)
LDFLAGS = -T$(ROOT)/shared/tm4c.ld --entry ResetISR
# Tool Definitions
# Either put these tools in your $PATH variable, or
# put the absolute path to the binaries here.
CC = arm-none-eabi-gcc
LD = arm-none-eabi-ld
OBJCOPY = arm-none-eabi-objcopy
GDB = arm-none-eabi-gdb
LM4FLASH = lm4flash
OPENOCD = openocd
# Implicit Rule Definitions
%.bin: %.elf
$(OBJCOPY) -O binary $< $@
%.o: %.c
$(CC) $(INC_DIRS) $(DEFS) $(CFLAGS) -Wall -c -o $@ $<
%.o: %.s
$(CC) $(INC_DIRS) $(DEFS) -c -o $@ $< $(AFLAGS)
all: $(PROJ_NAME).bin
clean:
rm -rf *.o *.d *.bin *.elf assembly_output/*.lst
flash: $(PROJ_NAME).bin
$(LM4FLASH) $<
debug: $(PROJ_NAME).elf
$(OPENOCD) -f board/ek-tm4c123gxl.cfg &
$(GDB) $<
OBJS = $(patsubst %.c, %.o, ${SRCS})