From 57f2812282916b3f30b4243c5cd8844df2869624 Mon Sep 17 00:00:00 2001 From: Robert Heller Date: Fri, 7 Aug 2020 13:52:45 -0400 Subject: [PATCH] Add linux.aarch64 target. (#413) Add 64-bit ARM Linux as a OpenMRN target. Initially supporting my Banana Pi M64 (Allwinner A64 SBC with a Raspberry Pi B+ form factor, including the Raspberry Pi 40-pin GPIO header. I'm guessing this will also support a 'Pi 4 or really any 64-bit ARM Linux SBC running a 64-bit (aarch64) Linux O/S. This is *lightly* tested -- I built and tested the hub application. Not sure how to run more detailed tests. Authored-by: Robert Heller --- .../hub/targets/linux.aarch64/Makefile | 3 ++ etc/linux.aarch64.mk | 45 +++++++++++++++++++ etc/path.mk | 11 +++++ targets/linux.aarch64/Makefile | 1 + targets/linux.aarch64/console/Makefile | 3 ++ targets/linux.aarch64/cue/Makefile | 1 + targets/linux.aarch64/dcc/Makefile | 1 + targets/linux.aarch64/executor/Makefile | 1 + targets/linux.aarch64/lib/Makefile | 1 + targets/linux.aarch64/openlcb/Makefile | 1 + targets/linux.aarch64/os/Makefile | 3 ++ targets/linux.aarch64/utils/Makefile | 1 + targets/linux.aarch64/withrottle/Makefile | 1 + 13 files changed, 73 insertions(+) create mode 100644 applications/hub/targets/linux.aarch64/Makefile create mode 100644 etc/linux.aarch64.mk create mode 100644 targets/linux.aarch64/Makefile create mode 100644 targets/linux.aarch64/console/Makefile create mode 100644 targets/linux.aarch64/cue/Makefile create mode 100644 targets/linux.aarch64/dcc/Makefile create mode 100644 targets/linux.aarch64/executor/Makefile create mode 100644 targets/linux.aarch64/lib/Makefile create mode 100644 targets/linux.aarch64/openlcb/Makefile create mode 100644 targets/linux.aarch64/os/Makefile create mode 100644 targets/linux.aarch64/utils/Makefile create mode 100644 targets/linux.aarch64/withrottle/Makefile diff --git a/applications/hub/targets/linux.aarch64/Makefile b/applications/hub/targets/linux.aarch64/Makefile new file mode 100644 index 000000000..ed0c910ab --- /dev/null +++ b/applications/hub/targets/linux.aarch64/Makefile @@ -0,0 +1,3 @@ +-include ../../config.mk +include $(OPENMRNPATH)/etc/prog.mk + diff --git a/etc/linux.aarch64.mk b/etc/linux.aarch64.mk new file mode 100644 index 000000000..fb497c9d4 --- /dev/null +++ b/etc/linux.aarch64.mk @@ -0,0 +1,45 @@ +# Get the toolchain paths for openmrn +include $(OPENMRNPATH)/etc/path.mk + + +ifndef TOOLPATH +#TOOLPATHCOMMAND := $(shell \ +#sh -c "which aarch64-linux-gnu-gcc" \ +#) +TOOLPATH := $(AARCH64LINUXGCCPATH) +endif + +$(info armv7alinux toolpath '$(TOOLPATH)') + +# Get the $(CFLAGSENV), $(CXXFLAGSENV), $(LDFLAGSENV) +include $(OPENMRNPATH)/etc/env.mk + +CC = $(TOOLPATH)/aarch64-linux-gnu-gcc +CXX = $(TOOLPATH)/aarch64-linux-gnu-g++ +AR = $(TOOLPATH)/aarch64-linux-gnu-ar +LD = $(TOOLPATH)/aarch64-linux-gnu-g++ +OBJDUMP = $(TOOLPATH)/aarch64-linux-gnu-objdump + +AROPTS=D + +HOST_TARGET := 1 + +STARTGROUP := -Wl,--start-group +ENDGROUP := -Wl,--end-group + +ARCHOPTIMIZATION = -g3 -O0 -march=armv8-a + +CSHAREDFLAGS = -c $(ARCHOPTIMIZATION) -Wall -Werror -Wno-unknown-pragmas \ + -MD -MP -fno-stack-protector -D_GNU_SOURCE + +CFLAGS = $(CSHAREDFLAGS) -std=gnu99 + +CXXFLAGS = $(CSHAREDFLAGS) -std=c++0x -D__STDC_FORMAT_MACROS \ + -D__STDC_LIMIT_MACROS -D__USE_LIBSTDCPP__ + +LDFLAGS = $(ARCHOPTIMIZATION) -Wl,-Map="$(@:%=%.map)" +SYSLIB_SUBDIRS += +SYSLIBRARIES = -lrt -lpthread + +EXTENTION = + diff --git a/etc/path.mk b/etc/path.mk index 2d6a1b05d..5bb3a6f2f 100644 --- a/etc/path.mk +++ b/etc/path.mk @@ -301,6 +301,17 @@ ARMLINUXGCCPATH:=$(TRYPATH) endif endif #ARMLINUXGCCPATH +################### AARCH64-LINUX GCC PATH ##################### +ifndef AARCH64LINUXGCCPATH +SEARCHPATH := \ + /usr/bin \ + +TRYPATH:=$(call findfirst,aarch64-linux-gnu-gcc,$(SEARCHPATH)) +ifneq ($(TRYPATH),) +AARCH64LINUXGCCPATH:=$(TRYPATH) +endif +endif #AARCH64LINUXGCCPATH + ################### TI-CC3200-SDK ##################### ifndef TICC3200SDKPATH SEARCHPATH := \ diff --git a/targets/linux.aarch64/Makefile b/targets/linux.aarch64/Makefile new file mode 100644 index 000000000..95c3e21d6 --- /dev/null +++ b/targets/linux.aarch64/Makefile @@ -0,0 +1 @@ +include $(OPENMRNPATH)/etc/core_target.mk diff --git a/targets/linux.aarch64/console/Makefile b/targets/linux.aarch64/console/Makefile new file mode 100644 index 000000000..0c54f81dd --- /dev/null +++ b/targets/linux.aarch64/console/Makefile @@ -0,0 +1,3 @@ +OPENMRNPATH ?= $(realpath ../../..) +include $(OPENMRNPATH)/etc/lib.mk + diff --git a/targets/linux.aarch64/cue/Makefile b/targets/linux.aarch64/cue/Makefile new file mode 100644 index 000000000..5e5bf973e --- /dev/null +++ b/targets/linux.aarch64/cue/Makefile @@ -0,0 +1 @@ +include $(OPENMRNPATH)/etc/lib.mk diff --git a/targets/linux.aarch64/dcc/Makefile b/targets/linux.aarch64/dcc/Makefile new file mode 100644 index 000000000..5e5bf973e --- /dev/null +++ b/targets/linux.aarch64/dcc/Makefile @@ -0,0 +1 @@ +include $(OPENMRNPATH)/etc/lib.mk diff --git a/targets/linux.aarch64/executor/Makefile b/targets/linux.aarch64/executor/Makefile new file mode 100644 index 000000000..5e5bf973e --- /dev/null +++ b/targets/linux.aarch64/executor/Makefile @@ -0,0 +1 @@ +include $(OPENMRNPATH)/etc/lib.mk diff --git a/targets/linux.aarch64/lib/Makefile b/targets/linux.aarch64/lib/Makefile new file mode 100644 index 000000000..a8d2e7abf --- /dev/null +++ b/targets/linux.aarch64/lib/Makefile @@ -0,0 +1 @@ +include $(OPENMRNPATH)/etc/target_lib.mk diff --git a/targets/linux.aarch64/openlcb/Makefile b/targets/linux.aarch64/openlcb/Makefile new file mode 100644 index 000000000..5e5bf973e --- /dev/null +++ b/targets/linux.aarch64/openlcb/Makefile @@ -0,0 +1 @@ +include $(OPENMRNPATH)/etc/lib.mk diff --git a/targets/linux.aarch64/os/Makefile b/targets/linux.aarch64/os/Makefile new file mode 100644 index 000000000..0c54f81dd --- /dev/null +++ b/targets/linux.aarch64/os/Makefile @@ -0,0 +1,3 @@ +OPENMRNPATH ?= $(realpath ../../..) +include $(OPENMRNPATH)/etc/lib.mk + diff --git a/targets/linux.aarch64/utils/Makefile b/targets/linux.aarch64/utils/Makefile new file mode 100644 index 000000000..5e5bf973e --- /dev/null +++ b/targets/linux.aarch64/utils/Makefile @@ -0,0 +1 @@ +include $(OPENMRNPATH)/etc/lib.mk diff --git a/targets/linux.aarch64/withrottle/Makefile b/targets/linux.aarch64/withrottle/Makefile new file mode 100644 index 000000000..5e5bf973e --- /dev/null +++ b/targets/linux.aarch64/withrottle/Makefile @@ -0,0 +1 @@ +include $(OPENMRNPATH)/etc/lib.mk