forked from SonicPotions/Penrose
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbootloader.mk
62 lines (50 loc) · 1.62 KB
/
bootloader.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
50
51
52
53
54
55
56
57
58
59
60
61
62
# Copyright 2019 Tyler Coy
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
TARGET := $(BL_ELF)
SOURCES := Bootloader/*.c
T_ELF := $(TARGET_DIR)/$(TARGET)
T_MAP := $(TARGET_DIR)/$(TARGET:.elf=.map)
TGT_CC := avr-gcc
TGT_CXX := avr-g++
TGT_DEFS := \
F_CPU=20000000UL \
__PROG_TYPES_COMPAT__ \
TGT_INCDIRS := ./Bootloader
ARCHFLAGS := -mmcu=atmega168
WARNFLAGS := -Wall -Wextra -Wundef
OPTFLAGS := \
-funsigned-char \
-funsigned-bitfields \
-ffast-math \
-freciprocal-math \
-ffunction-sections \
-fdata-sections \
-fpack-struct \
-fshort-enums \
-finline-functions-called-once \
-finline-functions \
TGT_CFLAGS := -Os -g $(ARCHFLAGS) $(OPTFLAGS) $(WARNFLAGS) -std=gnu11
TGT_CXXFLAGS := -Os -g $(ARCHFLAGS) $(OPTFLAGS) $(WARNFLAGS) -std=gnu++14 \
-fno-exceptions -fno-rtti
TGT_LDLIBS := -lm -lc -lgcc
TGT_LDFLAGS := $(ARCHFLAGS) -L$(TARGET_DIR) \
-Wl,--gc-sections \
-Wl,-Map=$(T_MAP) \
-Wl,--section-start=.text=0x3c00 \
define TGT_POSTMAKE
$(call ANALYZE,$(T_ELF))
endef
define TGT_POSTCLEAN
$(RM) $(T_MAP)
$(call CLEAN_ANALYSIS,$(T_ELF))
endef