2018-05-22 17:04:38 +00:00
|
|
|
# To show build commands: make V=1
|
2018-05-20 21:01:18 +00:00
|
|
|
ifneq ($(V),1)
|
|
|
|
Q := @
|
|
|
|
endif
|
|
|
|
|
2020-06-02 14:17:13 +00:00
|
|
|
#use RASPPI = 1BRev1 for Raspberry Pi 1B Rev 1 (26 IOports) (GPIO0/1/21)
|
|
|
|
#use RASPPI = 1BRev2 for Raspberry Pi 1B Rev 2 (26 IOports) (GPIO2/3/27)
|
|
|
|
#use RASPPI = 1BPlus for Raspberry Pi 1B+ (40 I/OPorts)
|
2020-01-25 06:56:52 +00:00
|
|
|
|
2020-12-27 02:45:12 +00:00
|
|
|
RASPPI ?= 3
|
2018-05-20 21:01:18 +00:00
|
|
|
PREFIX ?= arm-none-eabi-
|
|
|
|
|
|
|
|
CC = $(PREFIX)gcc
|
|
|
|
CPP = $(PREFIX)g++
|
2020-12-10 22:53:16 +00:00
|
|
|
CXX = $(PREFIX)g++
|
2018-05-20 21:01:18 +00:00
|
|
|
AS = $(CC)
|
|
|
|
LD = $(PREFIX)ld
|
|
|
|
AR = $(PREFIX)ar
|
|
|
|
|
|
|
|
ifeq ($(strip $(RASPPI)),0)
|
2020-04-16 00:34:04 +00:00
|
|
|
ARCH ?= -march=armv6zk -mtune=arm1176jzf-s -mfpu=vfp -mfloat-abi=hard -DRPIZERO=1 -DEXPERIMENTALZERO=1
|
|
|
|
CFLAGS += -DRPIZERO=1 -DRASPPI=1
|
2020-06-02 14:17:13 +00:00
|
|
|
else ifeq ($(strip $(RASPPI)),1BRev1)
|
|
|
|
ARCH ?= -march=armv6zk -mtune=arm1176jzf-s -mfpu=vfp -mfloat-abi=hard -DRPI1BREV1=1 -DEXPERIMENTALZERO=1
|
|
|
|
CFLAGS += -DRPI1BREV1=1 -DRASPPI=1
|
|
|
|
else ifeq ($(strip $(RASPPI)),1BRev2)
|
|
|
|
ARCH ?= -march=armv6zk -mtune=arm1176jzf-s -mfpu=vfp -mfloat-abi=hard -DRPI1BREV2=1 -DEXPERIMENTALZERO=1
|
|
|
|
CFLAGS += -DRPI1BREV2=1 -DRASPPI=1
|
2020-04-16 00:34:04 +00:00
|
|
|
else ifeq ($(strip $(RASPPI)),1BPlus)
|
2020-06-02 14:17:13 +00:00
|
|
|
ARCH ?= -march=armv6zk -mtune=arm1176jzf-s -mfpu=vfp -mfloat-abi=hard -DRPI1BPLUS=1 -DEXPERIMENTALZERO=1
|
|
|
|
CFLAGS += -DRPI1BPLUS=1 -DRASPPI=1
|
2018-05-20 21:01:18 +00:00
|
|
|
else ifeq ($(strip $(RASPPI)),2)
|
2020-04-16 00:34:04 +00:00
|
|
|
ARCH ?= -march=armv7-a -mtune=cortex-a7 -mfpu=neon-vfpv4 -mfloat-abi=hard -marm -DRPI2=1 -DEXPERIMENTALZERO=1
|
|
|
|
CFLAGS += -DRPI2=1
|
2018-05-20 21:01:18 +00:00
|
|
|
else ifeq ($(strip $(RASPPI)),3)
|
2020-04-16 00:34:04 +00:00
|
|
|
ARCH ?= -march=armv8-a+crc -mtune=cortex-a53 -mfpu=crypto-neon-fp-armv8 -mfloat-abi=hard -marm -DRPI3=1
|
|
|
|
CFLAGS += -DRPI3=1
|
2018-05-20 21:01:18 +00:00
|
|
|
else
|
2020-06-02 14:17:13 +00:00
|
|
|
$(error RASPPI must be one of: 0, 1BRev1, 1BRev2, 1BPlus, 2, 3)
|
2018-05-20 21:01:18 +00:00
|
|
|
endif
|
|
|
|
|
|
|
|
AFLAGS += $(ARCH)
|
2020-12-10 22:53:16 +00:00
|
|
|
CFLAGS += $(ARCH) -MMD -MP -Wall -Wno-unused-variable -Wno-unused-but-set-variable -Wno-psabi -fsigned-char -fno-builtin -Ofast -DNDEBUG
|
2018-05-26 22:48:49 +00:00
|
|
|
CPPFLAGS := $(CFLAGS) $(CPPFLAGS) -fno-exceptions -fno-rtti -std=c++0x -Wno-write-strings
|
|
|
|
CFLAGS += -fno-delete-null-pointer-checks -fdata-sections -ffunction-sections -u _printf_float -std=gnu99
|
2018-05-20 21:01:18 +00:00
|
|
|
|
2020-12-10 22:53:16 +00:00
|
|
|
DEPENDS := $(patsubst %.o,%.d,$(OBJS))
|
|
|
|
-include $(DEPENDS)
|
|
|
|
|
2018-05-20 21:01:18 +00:00
|
|
|
.PHONY: clean
|
|
|
|
|
|
|
|
%.o: %.S
|
|
|
|
@echo " AS $@"
|
|
|
|
$(Q)$(AS) $(AFLAGS) $(INCLUDE) -c -o $@ $<
|
|
|
|
|
|
|
|
%.o: %.c
|
|
|
|
@echo " CC $@"
|
|
|
|
$(Q)$(CC) $(CFLAGS) $(INCLUDE) -c -o $@ $<
|
|
|
|
|
|
|
|
%.o: %.cpp
|
|
|
|
@echo " CPP $@"
|
2018-06-15 03:31:01 +00:00
|
|
|
$(Q)$(CPP) $(CPPFLAGS) $(INCLUDE) -c -o $@ $<
|