-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
50 lines (34 loc) · 1.26 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
# Makefile for Raspberry Pi 3
# Updated by Wagner Morais Aug 22
MAINFILE = a3p1
OBJS = lib/expstruct.o lib/piface.o lib/led.o
OBJS += lib/uart.o lib/rpi-armtimer.o lib/rpi-gpio.o lib/rpi-interrupts.o lib/rpi-systimer.o
OBJS += lib/tinythreads.o
OBJS += lib/startup.o lib/syscalls.o
OBJS += $(MAINFILE).o
ELF = $(MAINFILE).elf
MAIN = $(MAINFILE).img
CROSS = arm-none-eabi-
CC = $(CROSS)gcc
AS = $(CROSS)as
SIZE = $(CROSS)size
OCOPY = $(CROSS)objcopy
# CFLAGS = -march=armv8-a -mcpu=cortex-a53 -mfpu=vfp -mfloat-abi=soft -ffunction-sections -fdata-sections -fno-common -g -std=gnu99 -Wall -Wextra -Os -Ilib -DRPI3=1 -DIOBPLUS=1
CFLAGS = -march=armv8-a+crc -mtune=cortex-a53 -mfpu=vfp -mfloat-abi=soft -ffunction-sections -fdata-sections -fno-common -g -std=gnu99 -Wall -Wextra -Os -Ilib -DRPI3=1 -DIOBPLUS=1
LFLAGS = -static -nostartfiles -lc -lgcc -specs=nano.specs -Wl,--gc-sections -lm
LSCRIPT = lib/rpi3.ld
LDFLAGS += -u _printf_float
.PHONY: all clean run
all: $(MAIN)
%.o: %.c
$(CC) $(CFLAGS) -c -o $@ $^
$(ELF): $(OBJS)
$(CC) -T $(LSCRIPT) $(CFLAGS) $(LFLAGS) $(LDFLAGS) -o $@ $^
$(SIZE) $@
$(MAIN): $(ELF)
$(OCOPY) $< -O binary $@
clean:
# OS dependent. Change accordingly
# del /Q /F $(MAIN) $(ELF) $(OBJS)
# rm -f $(MAIN) $(ELF) $(OBJS)
run: $(MAIN)