upload android base code part6

This commit is contained in:
August 2018-08-08 17:48:24 +08:00
parent 421e214c7d
commit 4e516ec6ed
35396 changed files with 9188716 additions and 0 deletions

View file

@ -0,0 +1,160 @@
/*
* Copyright (C) 2017 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/*******************************************************************************
* ~ ~ ~ W A R N I N G ~ ~ ~
*
* The following code is used to load a nanoapp into a Qualcomm implementation
* of the CHRE API that is based on Nanohub. This is not intended as a reference
* for future platforms and is provided for backwards compatibility with this
* implementation.
*
* You may find more suitable examples of app support libraries under the
* build/app_support directory for other variants. These files are typically
* designed to perform early initialization of the CHRE nanoapp and may be
* required by some platforms but not all.
*
******************************************************************************/
#include <chre.h>
#include <stdbool.h>
#include <stdint.h>
#ifdef __cplusplus
extern "C" {
#endif
#define LEGACY_APP_HDR_MAGIC_ARRAY \
{'G', 'o', 'o', 'g', 'l', 'e', 'N', 'a', 'n', 'o', 'A', 'p', 'p'}
#define APP_HDR_VER_CUR 0
#define APP_HDR_MARKER_INTERNAL 0xFF01
#define EVT_APP_FROM_HOST 0x000000F8
#define EVT_APP_TIMER 0x000000DF
struct AppFuncs {
bool (*init)(uint32_t yourTid);
void (*end)(void);
void (*handle)(uint32_t evtType, const void *evtData);
};
// This was the old "struct AppHdr" before the binary format was refactored as
// part of b/28265099. It's what Qualcomm's implementation currently expects as
// input when registering an app.
struct LegacyAppHdr {
char magic[13];
uint8_t fmtVer; //app header format version
uint16_t marker;
uint64_t appId;
uint32_t data_start;
uint32_t data_end;
uint32_t data_data;
uint32_t bss_start;
uint32_t bss_end;
uint32_t got_start;
uint32_t got_end;
uint32_t rel_start;
uint32_t rel_end;
uint32_t appVer;
uint32_t rfu;
struct AppFuncs funcs;
};
struct TimerEvent {
uint32_t timerId;
void *data;
};
// These two functions are specific to Qualcomm's Nanohub platform
// implementation
extern void platSlpiAddInternalApp(const struct LegacyAppHdr *, bool);
extern void platSlpiRemoveInternalApp(const struct LegacyAppHdr *);
static void __appInit(void) __attribute__((constructor));
static void __appEnd(void) __attribute__((destructor));
static bool chreappStart(uint32_t tid);
static void chreappHandle(uint32_t eventTypeAndTid, const void *eventData);
#if !defined(NANOAPP_ID) || !defined(NANOAPP_VERSION)
#error NANOAPP_ID and NANOAPP_VERSION must be defined in the build environment
#endif
static const struct LegacyAppHdr mAppHdr = {
.magic = LEGACY_APP_HDR_MAGIC_ARRAY,
.fmtVer = APP_HDR_VER_CUR,
.marker = APP_HDR_MARKER_INTERNAL,
.appId = NANOAPP_ID,
.appVer = NANOAPP_VERSION,
.funcs.init = chreappStart,
.funcs.end = nanoappEnd,
.funcs.handle = chreappHandle,
};
// Note: this runs when CHRE first loads the Nanoapp. We use it to register the
// app's entry points with the runtime environment.
static void __appInit(void)
{
platSlpiAddInternalApp(&mAppHdr, false);
}
static void __appEnd(void)
{
platSlpiRemoveInternalApp(&mAppHdr);
}
static bool chreappStart(uint32_t tid)
{
return nanoappStart();
}
static void chreappHandle(uint32_t eventTypeAndTid, const void *eventData)
{
uint16_t evt = eventTypeAndTid;
uint16_t srcTid = eventTypeAndTid >> 16;
const void *data = eventData;
union EventLocalData {
struct chreMessageFromHostData msg;
} u;
switch(evt) {
case EVT_APP_TIMER:
evt = CHRE_EVENT_TIMER;
data = ((struct TimerEvent *)eventData)->data;
break;
case EVT_APP_FROM_HOST:
evt = CHRE_EVENT_MESSAGE_FROM_HOST;
data = &u.msg;
u.msg.message = (uint8_t*)eventData + 1;
// TODO: fill messageType with the correct value once available.
u.msg.messageType = 0;
u.msg.messageSize = *(uint8_t*)eventData;
break;
}
nanoappHandleEvent(srcTid, evt, data);
}
#ifdef __cplusplus
}
#endif

View file

@ -0,0 +1 @@
#error "This file is not implemented yet"

Binary file not shown.

View file

@ -0,0 +1,65 @@
#
# Build targets for a Cortex-M-based processor
#
# Cortex-M Environment Checks ##################################################
# If building for the Cortex-M target, ensure that the user has specified a path
# to the Cortex-M toolchain that they wish to use.
ifeq ($(CORTEXM_TOOLS_PREFIX),)
$(error "You must supply a CORTEXM_TOOLS_PREFIX environment variable \
containing a path to the Cortex-M toolchain. Example: \
export CORTEXM_TOOLS_PREFIX=$$HOME/bin/gcc-arm-none-eabi-5_3-2016q1")
endif
# Cortex-M Tools ###############################################################
TARGET_AR = $(CORTEXM_TOOLS_PREFIX)/bin/arm-none-eabi-ar
TARGET_CC = $(CORTEXM_TOOLS_PREFIX)/bin/arm-none-eabi-gcc
TARGET_LD = $(CORTEXM_TOOLS_PREFIX)/bin/arm-none-eabi-ld
# Cortex-M Compiler Flags ######################################################
# Add Cortex-M compiler flags.
TARGET_CFLAGS += $(CORTEXM_CFLAGS)
# TODO: Add more Cortex-M flags from the Nanohub build
# Code generation flags.
TARGET_CFLAGS += -mthumb
TARGET_CFLAGS += -mfloat-abi=softfp
TARGET_CFLAGS += -mno-thumb-interwork
TARGET_CFLAGS += -ffast-math
TARGET_CFLAGS += -fsingle-precision-constant
# Cortex-M Shared Object Linker Flags ##########################################
TARGET_SO_LDFLAGS += -shared
# Supported Cortex-M Architectures #############################################
CORTEXM_SUPPORTED_ARCHS = m4
# Environment Checks ###########################################################
# Ensure that an architecture is chosen.
ifeq ($(filter $(CORTEXM_ARCH), $(CORTEXM_SUPPORTED_ARCHS)),)
$(error "The CORTEXM_ARCH argument must be set to a supported architecture (\
$(CORTEXM_SUPPORTED_ARCHS))")
endif
# Target Architecture ##########################################################
# Set the Cortex-M architecture.
ifeq ($(CORTEXM_ARCH), m4)
TARGET_CFLAGS += -mcpu=cortex-m4
TARGET_CFLAGS += -mfpu=fpv4-sp-d16
endif
# Optimization Level ###########################################################
TARGET_CFLAGS += -O$(OPT_LEVEL)
# Variant Specific Sources #####################################################
TARGET_VARIANT_SRCS += $(CORTEXM_SRCS)

View file

@ -0,0 +1,94 @@
#
# Build targets for a Hexagon-based processor
#
# Hexagon Environment Checks ###################################################
# Ensure that the user has specified a path to the Hexagon toolchain that they
# wish to use.
ifeq ($(HEXAGON_TOOLS_PREFIX),)
$(error "You must supply a HEXAGON_TOOLS_PREFIX environment variable \
containing a path to the hexagon toolchain. Example: \
export HEXAGON_TOOLS_PREFIX=$$HOME/Qualcomm/HEXAGON_Tools/8.0.07")
endif
ifeq ($(IS_NANOAPP_BUILD),)
ifeq ($(SLPI_PREFIX),)
$(error "You must supply an SLPI_PREFIX environment variable \
containing a path to the SLPI source tree. Example: \
export SLPI_PREFIX=$$HOME/slpi_proc")
endif
endif
# Hexagon Tools ################################################################
TARGET_AR = $(HEXAGON_TOOLS_PREFIX)/Tools/bin/hexagon-ar
TARGET_CC = $(HEXAGON_TOOLS_PREFIX)/Tools/bin/hexagon-clang
TARGET_LD = $(HEXAGON_TOOLS_PREFIX)/Tools/bin/hexagon-link
# Hexagon Compiler Flags #######################################################
# Add Hexagon compiler flags
TARGET_CFLAGS += $(HEXAGON_CFLAGS)
# Enable position independence.
TARGET_CFLAGS += -fpic
# Disable splitting double registers.
TARGET_CFLAGS += -mllvm -disable-hsdr
# Enable default visibility for FastRPC entry points.
TARGET_CFLAGS += -D'__QAIC_SKEL_EXPORT=__attribute__((visibility("default")))'
# This code is loaded into a dynamic module. Define this symbol in the event
# that any Qualcomm code needs it.
TARGET_CFLAGS += -D__V_DYNAMIC__
# This flag is used by some QC-supplied code to differentiate things intended to
# run on Hexagon vs. other architectures
TARGET_CFLAGS += -DQDSP6
# Hexagon Shared Object Linker Flags ###########################################
TARGET_SO_LDFLAGS += --gc-sections
TARGET_SO_LDFLAGS += -shared
TARGET_SO_LDFLAGS += -call_shared
TARGET_SO_LDFLAGS += -Bsymbolic
TARGET_SO_LDFLAGS += --wrap=malloc
TARGET_SO_LDFLAGS += --wrap=calloc
TARGET_SO_LDFLAGS += --wrap=free
TARGET_SO_LDFLAGS += --wrap=realloc
TARGET_SO_LDFLAGS += --wrap=memalign
TARGET_SO_LDFLAGS += --wrap=__stack_chk_fail
HEXAGON_LIB_PATH = $(HEXAGON_TOOLS_PREFIX)/Tools/target/hexagon/lib
TARGET_SO_EARLY_LIBS += $(HEXAGON_LIB_PATH)/$(HEXAGON_ARCH)/G0/pic/initS.o
TARGET_SO_LATE_LIBS += $(HEXAGON_LIB_PATH)/$(HEXAGON_ARCH)/G0/pic/finiS.o
# Supported Hexagon Architectures ##############################################
HEXAGON_SUPPORTED_ARCHS = v60 v62
# Environment Checks ###########################################################
# Ensure that an architecture is chosen.
ifeq ($(filter $(HEXAGON_ARCH), $(HEXAGON_SUPPORTED_ARCHS)),)
$(error "The HEXAGON_ARCH variable must be set to a supported architecture \
($(HEXAGON_SUPPORTED_ARCHS))")
endif
# Target Architecture ##########################################################
# Set the Hexagon architecture.
TARGET_CFLAGS += -m$(strip $(HEXAGON_ARCH))
# Optimization Level ###########################################################
TARGET_CFLAGS += -O$(OPT_LEVEL)
# TODO: Consider disabling this when compiling for >-O0.
TARGET_CFLAGS += -D_DEBUG
# Variant Specific Sources #####################################################
TARGET_VARIANT_SRCS += $(HEXAGON_SRCS)

View file

@ -0,0 +1,42 @@
#
# Build targets for an x86 processor
#
# x86 Environment Checks #######################################################
ifeq ($(ANDROID_BUILD_TOP),)
$(error "You should supply an ANDROID_BUILD_TOP environment variable \
containing a path to the Android source tree. This is typically \
provided by initializing the Android build environment.")
endif
export X86_TOOLS_PREFIX=$(ANDROID_BUILD_TOP)/prebuilts/clang/host/linux-x86/clang-3859424/bin/
# x86 Tools ####################################################################
TARGET_AR = $(X86_TOOLS_PREFIX)llvm-ar
TARGET_CC = $(X86_TOOLS_PREFIX)clang++
TARGET_LD = $(X86_TOOLS_PREFIX)clang++
# x86 Compiler Flags ###########################################################
# Add x86 compiler flags.
TARGET_CFLAGS += $(X86_CFLAGS)
# x86 is purely used for testing, so always include debugging symbols
TARGET_CFLAGS += -g
# Enable position independence.
TARGET_CFLAGS += -fpic
# x86 Shared Object Linker Flags ###############################################
TARGET_SO_LDFLAGS += -shared
TARGET_SO_LDFLAGS += -Wl,-gc-sections
# Optimization Level ###########################################################
TARGET_CFLAGS += -O$(OPT_LEVEL)
# Variant Specific Sources #####################################################
TARGET_VARIANT_SRCS += $(X86_SRCS)

View file

@ -0,0 +1,195 @@
#
# Build Template
#
# Invoke this template with a set of variables in order to make build targets
# for a build variant that targets a specific CPU architecture.
#
include $(CHRE_PREFIX)/build/defs.mk
################################################################################
#
# Build Template
#
# Invoke this to instantiate a set of build targets. Two build targets are
# produced by this template that can be either used directly or depended on to
# perform post processing (ie: during a nanoapp build).
#
# TARGET_NAME_ar - An archive of the code compiled by this template.
# TARGET_NAME_so - A shared object of the code compiled by this template.
# TARGET_NAME - A convenience target that depends on the above archive and
# shared object targets.
#
# Argument List:
# $1 - TARGET_NAME - The name of the target being built.
# $2 - TARGET_CFLAGS - The compiler flags to use for this target.
# $3 - TARGET_CC - The C/C++ compiler for the target variant.
# $4 - TARGET_SO_LDFLAGS - The linker flags to use for this target.
# $5 - TARGET_LD - The linker for the target variant.
# $6 - TARGET_ARFLAGS - The archival flags to use for this target.
# $7 - TARGET_AR - The archival tool for the targer variant.
# $8 - TARGET_VARIANT_SRCS - Source files specific to this variant.
# $9 - TARGET_BUILD_BIN - Build a binary. Typically this means that the
# source files provided include an entry point.
# $10 - TARGET_BIN_LDFLAGS - Linker flags that are passed to the linker
# when building an executable binary.
# $11 - TARGET_SO_EARLY_LIBS - Link against a set of libraries when building
# a shared object. These are placed before the
# objects produced by this build.
# $12 - TARGET_SO_LATE_LIBS - Link against a set of libraries when building
# a shared object. These are placed after the
# objects produced by this build.
#
################################################################################
ifndef BUILD_TEMPLATE
define BUILD_TEMPLATE
# Target Objects ###############################################################
# Source files.
$$(1)_CXX_SRCS = $$(filter %.cc, $(COMMON_SRCS) $(8))
$$(1)_C_SRCS = $$(filter %.c, $(COMMON_SRCS) $(8))
# Object files.
$$(1)_OBJS_DIR = $(1)_objs
$$(1)_CXX_OBJS = $$(patsubst %.cc, $(OUT)/$$($$(1)_OBJS_DIR)/%.o, \
$$($$(1)_CXX_SRCS))
$$(1)_C_OBJS = $$(patsubst %.c, $(OUT)/$$($$(1)_OBJS_DIR)/%.o, \
$$($$(1)_C_SRCS))
# Automatic dependency resolution Makefiles.
$$(1)_CXX_DEPS = $$(patsubst %.cc, $(OUT)/$$($$(1)_OBJS_DIR)/%.d, \
$$($$(1)_CXX_SRCS))
$$(1)_C_DEPS = $$(patsubst %.c, $(OUT)/$$($$(1)_OBJS_DIR)/%.d, \
$$($$(1)_C_SRCS))
# Add object file directories.
$$$(1)_DIRS = $$(sort $$(dir $$($$(1)_CXX_OBJS) $$($$(1)_C_OBJS)))
# Outputs ######################################################################
# Shared Object
$$(1)_SO = $(OUT)/$$$(1)/$(OUTPUT_NAME).so
# Static Archive
$$(1)_AR = $(OUT)/$$$(1)/$(OUTPUT_NAME).a
# Optional Binary
$$(1)_BIN = $$(if $(9), $(OUT)/$$$(1)/$(OUTPUT_NAME), )
# Top-level Build Rule #########################################################
# Define the phony target.
.PHONY: $(1)_ar
$(1)_ar: $$($$(1)_AR)
.PHONY: $(1)_so
$(1)_so: $$($$(1)_SO)
.PHONY: $(1)_bin
$(1)_bin: $$($$(1)_BIN)
.PHONY: $(1)
$(1): $(1)_ar $(1)_so $(1)_bin
# If building the runtime, simply add the archive and shared object to the all
# target. When building CHRE, it is expected that this runtime just be linked
# into another build system (or the entire runtime is built using another build
# system).
ifeq ($(IS_NANOAPP_BUILD),)
all: $(1)
endif
# Compile ######################################################################
$$($$(1)_CXX_OBJS): $(OUT)/$$($$(1)_OBJS_DIR)/%.o: %.cc
$(3) $(COMMON_CXX_CFLAGS) -DCHRE_FILENAME=\"$$(notdir $$<)\" $(2) -c $$< \
-o $$@
$$($$(1)_C_OBJS): $(OUT)/$$($$(1)_OBJS_DIR)/%.o: %.c
$(3) $(COMMON_C_CFLAGS) -DCHRE_FILENAME=\"$$(notdir $$<)\" $(2) -c $$< \
-o $$@
# Archive ######################################################################
# Add common and target-specific archive flags.
$$$(1)_ARFLAGS = $(COMMON_ARFLAGS) \
$(6)
$$($$(1)_AR): $$(OUT)/$$$(1) $$($$$(1)_DIRS) $$($$(1)_CXX_OBJS) $$($$(1)_C_OBJS)
$(7) $$($$$(1)_ARFLAGS) $$@ $$(filter %.o, $$^)
# Link #########################################################################
$$($$(1)_SO): $$(OUT)/$$$(1) $$($$$(1)_DIRS) $$($$(1)_CXX_DEPS) \
$$($$(1)_C_DEPS) $$($$(1)_CXX_OBJS) $$($$(1)_C_OBJS)
$(5) $(4) -o $$@ $(11) $$(filter %.o, $$^) $(12)
$$($$(1)_BIN): $$(OUT)/$$$(1) $$($$$(1)_DIRS) $$($$(1)_CXX_DEPS) \
$$($$(1)_C_DEPS) $$($$(1)_CXX_OBJS) $$($$(1)_C_OBJS)
$(3) -o $$@ $$(filter %.o, $$^) $(10)
# Output Directories ###########################################################
$$($$$(1)_DIRS):
mkdir -p $$@
$$(OUT)/$$$(1):
mkdir -p $$@
# Automatic Dependency Resolution ##############################################
$$($$(1)_CXX_DEPS): $(OUT)/$$($$(1)_OBJS_DIR)/%.d: %.cc
mkdir -p $$(dir $$@)
$(3) $(DEP_CFLAGS) $(COMMON_CXX_CFLAGS) \
-DCHRE_FILENAME=\"$$(notdir $$<)\" $(2) -c $$< -o $$@
$(DEP_POST_COMPILE)
$$($$(1)_C_DEPS): $(OUT)/$$($$(1)_OBJS_DIR)/%.d: %.c
mkdir -p $$(dir $$@)
$(3) $(DEP_CFLAGS) $(COMMON_C_CFLAGS) \
-DCHRE_FILENAME=\"$$(notdir $$<)\" $(2) -c $$< -o $$@
$(DEP_POST_COMPILE)
# Include generated dependency files if they are in the requested build target.
# This avoids dependency generation from occuring for a debug target when a
# non-debug target is requested.
ifneq ($(filter $(1) all, $(MAKECMDGOALS)),)
include $$(patsubst %.o, %.d, $$($$(1)_CXX_DEPS))
include $$(patsubst %.o, %.d, $$($$(1)_C_DEPS))
endif
endef
endif
# Template Invocation ##########################################################
$(eval $(call BUILD_TEMPLATE, $(TARGET_NAME), \
$(COMMON_CFLAGS) $(TARGET_CFLAGS), \
$(TARGET_CC), \
$(TARGET_SO_LDFLAGS), \
$(TARGET_LD), \
$(TARGET_ARFLAGS), \
$(TARGET_AR), \
$(TARGET_VARIANT_SRCS), \
$(TARGET_BUILD_BIN), \
$(TARGET_BIN_LDFLAGS), \
$(TARGET_SO_EARLY_LIBS), \
$(TARGET_SO_LATE_LIBS)))
# Debug Template Invocation ####################################################
$(eval $(call BUILD_TEMPLATE, $(TARGET_NAME)_debug, \
$(COMMON_CFLAGS) $(COMMON_DEBUG_CFLAGS) \
$(TARGET_CFLAGS) $(TARGET_DEBUG_CFLAGS), \
$(TARGET_CC), \
$(TARGET_SO_LDFLAGS), \
$(TARGET_LD), \
$(TARGET_ARFLAGS), \
$(TARGET_AR), \
$(TARGET_VARIANT_SRCS), \
$(TARGET_BUILD_BIN), \
$(TARGET_BIN_LDFLAGS), \
$(TARGET_SO_EARLY_LIBS), \
$(TARGET_SO_LATE_LIBS)))

View file

@ -0,0 +1,13 @@
#
# Clean Makefile
#
# Makefile Includes ############################################################
include $(CHRE_PREFIX)/build/defs.mk
# Clean Target #################################################################
.PHONY: clean
clean:
rm -rf $(OUT)

View file

@ -0,0 +1,17 @@
#
# Clears Build Template Configuration Variables
#
TARGET_NAME =
TARGET_CFLAGS =
TARGET_DEBUG_CFLAGS =
TARGET_CC =
TARGET_SO_LDFLAGS =
TARGET_LD =
TARGET_ARFLAGS =
TARGET_AR =
TARGET_VARIANT_SRCS =
TARGET_BUILD_BIN =
TARGET_BIN_LDFLAGS =
TARGET_SO_EARLY_LIBS =
TARGET_SO_LATE_LIBS =

View file

@ -0,0 +1,42 @@
#
# Common Makefile Rules
#
# Environment Checks ###########################################################
ifeq ($(OPT_LEVEL),)
$(warning The OPT_LEVEL variable is unset. Defaulting to 0.)
OPT_LEVEL = 0
endif
ifeq ($(OUTPUT_NAME),)
$(error "The OUTPUT_NAME variable must be set to the name of the desired \
binary. Example: OUTPUT_NAME = my_nanoapp")
endif
# Define all ###################################################################
# All is defined here as the first target which causes make to build all by
# default when no targets are supplied.
.PHONY: all
all:
# If no make command goals are specified, default to all. At least one target
# is required for environment checks. Building all will require toolchains for
# all supported architectures which may not be desirable.
ifeq ($(MAKECMDGOALS),)
MAKECMDGOALS = all
endif
# Variant-specific Support Source Files ########################################
SYS_SUPPORT_PATH = $(CHRE_PREFIX)/build/sys_support
# Makefile Includes ############################################################
# Common Includes
include $(CHRE_PREFIX)/build/clean.mk
include $(CHRE_PREFIX)/build/tools_config.mk
# NanoPB Source Generation
include $(CHRE_PREFIX)/build/nanopb.mk

View file

@ -0,0 +1,7 @@
#
# Common global constants used as part of the build.
#
# Output Directory Name ########################################################
OUT = out

View file

@ -0,0 +1,106 @@
#
# Nanoapp Makefile
#
# Include this file in your nanoapp Makefile to produce binary nanoapps to
# target a variety of architectures.
#
# Nanoapp Build Configuration Checks ###########################################
ifeq ($(NANOAPP_NAME),)
$(error "The NANOAPP_NAME variable must be set to the name of the nanoapp. \
This should be assigned by the Makefile that includes app.mk.")
endif
ifeq ($(NANOAPP_ID),)
$(error "The NANOAPP_ID variable must be set to the ID of the nanoapp. \
This should be assigned by the Makefile that includes app.mk.")
endif
ifeq ($(NANOAPP_VERSION),)
$(error "The NANOAPP_VERSION variable must be set to the version of the nanoapp. \
This should be assigned by the Makefile that includes app.mk.")
endif
ifeq ($(NANOAPP_NAME_STRING),)
$(error The NANOAPP_NAME_STRING variable must be set to the friendly name of \
the nanoapp. This should be assigned by the Makefile that includes \
app.mk.)
endif
ifeq ($(NANOAPP_VENDOR_STRING),)
$(info NANOAPP_VENDOR_STRING not supplied, defaulting to "Google".)
NANOAPP_VENDOR_STRING = \"Google\"
endif
ifeq ($(NANOAPP_IS_SYSTEM_NANOAPP),)
$(info NANOAPP_IS_SYSTEM_NANOAPP not supplied, defaulting to 0.)
NANOAPP_IS_SYSTEM_NANOAPP = 0
endif
ifeq ($(CHRE_PREFIX),)
ifeq ($(ANDROID_BUILD_TOP),)
$(error You must run lunch, or specify an explicit CHRE_PREFIX environment \
variable)
else
CHRE_PREFIX = $(ANDROID_BUILD_TOP)/system/chre
endif
endif
# Nanoapp Build ################################################################
# This variable indicates to the variants that some post-processing may be
# required as the target is a nanoapp.
IS_NANOAPP_BUILD = true
# Common App Build Configuration ###############################################
OUTPUT_NAME = $(NANOAPP_NAME)
# Common Compiler Flags ########################################################
# Add the CHRE API to the include search path.
COMMON_CFLAGS += -I$(CHRE_PREFIX)/chre_api/include/chre_api
# Add util and platform/shared to the include search path.
COMMON_CFLAGS += -I$(CHRE_PREFIX)/util/include
COMMON_CFLAGS += -I$(CHRE_PREFIX)/platform/shared/include
# Allows a nanoapp to know that is compiled separately from the CHRE system.
COMMON_CFLAGS += -DCHRE_IS_NANOAPP_BUILD
# Compile FlatBuffers in a portable way.
COMMON_CFLAGS += -DFLATBUFFERS_CHRE
# Nanoapp configuration flags.
COMMON_CFLAGS += -DNANOAPP_ID=$(NANOAPP_ID)
COMMON_CFLAGS += -DNANOAPP_VERSION=$(NANOAPP_VERSION)
COMMON_CFLAGS += -DNANOAPP_VENDOR_STRING=$(NANOAPP_VENDOR_STRING)
COMMON_CFLAGS += -DNANOAPP_NAME_STRING=$(NANOAPP_NAME_STRING)
COMMON_CFLAGS += -DNANOAPP_IS_SYSTEM_NANOAPP=$(NANOAPP_IS_SYSTEM_NANOAPP)
# Variant-specific Nanoapp Support Source Files ################################
APP_SUPPORT_PATH = $(CHRE_PREFIX)/build/app_support
DSO_SUPPORT_LIB_PATH = $(CHRE_PREFIX)/platform/shared/nanoapp
GOOGLE_HEXAGONV60_SLPI_SRCS += $(DSO_SUPPORT_LIB_PATH)/nanoapp_support_lib_dso.c
GOOGLE_HEXAGONV62_SLPI_SRCS += $(DSO_SUPPORT_LIB_PATH)/nanoapp_support_lib_dso.c
GOOGLE_HEXAGONV62_SLPI-UIMG_SRCS += $(DSO_SUPPORT_LIB_PATH)/nanoapp_support_lib_dso.c
GOOGLE_X86_LINUX_SRCS += $(DSO_SUPPORT_LIB_PATH)/nanoapp_support_lib_dso.c
QCOM_HEXAGONV60_NANOHUB_SRCS += $(APP_SUPPORT_PATH)/qcom_nanohub/app_support.cc
QCOM_HEXAGONV60_NANOHUB-UIMG_SRCS += $(APP_SUPPORT_PATH)/qcom_nanohub/app_support_uimg.cc
# Makefile Includes ############################################################
# Common includes
include $(CHRE_PREFIX)/build/common.mk
# Supported variants includes
include $(CHRE_PREFIX)/build/variant/google_cm4_nanohub.mk
include $(CHRE_PREFIX)/build/variant/google_hexagonv60_slpi.mk
include $(CHRE_PREFIX)/build/variant/google_hexagonv62_slpi.mk
include $(CHRE_PREFIX)/build/variant/google_hexagonv62_slpi-uimg.mk
include $(CHRE_PREFIX)/build/variant/google_x86_linux.mk
include $(CHRE_PREFIX)/build/variant/qcom_hexagonv60_nanohub.mk
include $(CHRE_PREFIX)/build/variant/qcom_hexagonv60_nanohub-uimg.mk

View file

@ -0,0 +1,31 @@
#
# Nanoapp Build Rules for Google CHRE on Linux
#
################################################################################
#
# Google Generic CHRE on Linux Nanoapp Build Template
#
# Invoke this to instantiate a set of Nanoapp post processing build targets.
#
# TARGET_NAME_nanoapp - The resulting nanoapp output.
#
# Argument List:
# $1 - TARGET_NAME - The name of the target being built.
#
################################################################################
ifndef GOOGLE_LINUX_NANOAPP_BUILD_TEMPLATE
define GOOGLE_LINUX_NANOAPP_BUILD_TEMPLATE
.PHONY: $(1)_nanoapp
all: $(1)_nanoapp
$(1)_nanoapp: $(1)
endef
endif
# Template Invocation ##########################################################
$(eval $(call GOOGLE_LINUX_NANOAPP_BUILD_TEMPLATE, $(TARGET_NAME)))

View file

@ -0,0 +1,34 @@
#
# Nanoapp Build Rules for Nanohub
#
################################################################################
#
# Nanohub Nanoapp Build Template
#
# Invoke this to instantiate a set of Nanoapp post processing build targets.
#
# TARGET_NAME_nanoapp - The resulting nanoapp output.
#
# Argument List:
# $1 - TARGET_NAME - The name of the target being built.
#
################################################################################
ifndef NANOHUB_NANOAPP_BUILD_TEMPLATE
define NANOHUB_NANOAPP_BUILD_TEMPLATE
# TODO: Invoke nanoapp post-processing tools. This simply adds the underlying
# shared object and archive to the nanoapp target.
.PHONY: $(1)_nanoapp
all: $(1)_nanoapp
$(1)_nanoapp: $(1)
endef
endif
# Template Invocation ##########################################################
$(eval $(call NANOHUB_NANOAPP_BUILD_TEMPLATE, $(TARGET_NAME)))

View file

@ -0,0 +1,34 @@
#
# Nanoapp Build Rules for Google Generic CHRE on SLPI
#
################################################################################
#
# Google Generic CHRE on SLPI Nanoapp Build Template
#
# Invoke this to instantiate a set of Nanoapp post processing build targets.
#
# TARGET_NAME_nanoapp - The resulting nanoapp output.
#
# Argument List:
# $1 - TARGET_NAME - The name of the target being built.
#
################################################################################
ifndef GOOGLE_SLPI_NANOAPP_BUILD_TEMPLATE
define GOOGLE_SLPI_NANOAPP_BUILD_TEMPLATE
# TODO: Invoke signing/formatting post-processing tools. This simply adds the
# underlying shared object and archive to the nanoapp target.
.PHONY: $(1)_nanoapp
all: $(1)_nanoapp
$(1)_nanoapp: $(1)
endef
endif
# Template Invocation ##########################################################
$(eval $(call GOOGLE_SLPI_NANOAPP_BUILD_TEMPLATE, $(TARGET_NAME)))

View file

@ -0,0 +1,37 @@
#
# Qualcomm Nanoapp Build Rules for CHRE based on Nanohub
#
################################################################################
#
# Qualcomm CHRE Nanoapp Build Template
#
# Invoke this to instantiate a set of Nanoapp post processing build targets.
#
# TARGET_NAME_nanoapp - The resulting nanoapp output.
#
# Argument List:
# $1 - TARGET_NAME - The name of the target being built.
#
################################################################################
TARGET_CFLAGS += -DNANOAPP_ID=$(NANOAPP_ID)
TARGET_CFLAGS += -DNANOAPP_VERSION=$(NANOAPP_VERSION)
ifndef QCOM_CHRE_NANOHUB_NANOAPP_BUILD_TEMPLATE
define QCOM_CHRE_NANOHUB_NANOAPP_BUILD_TEMPLATE
# TODO: Invoke nanoapp post-processing tools. This simply adds the underlying
# shared object and archive to the nanoapp target.
.PHONY: $(1)_nanoapp
all: $(1)_nanoapp
$(1)_nanoapp: $(1)
endef
endif
# Template Invocation ##########################################################
$(eval $(call QCOM_CHRE_NANOHUB_NANOAPP_BUILD_TEMPLATE, $(TARGET_NAME)))

View file

@ -0,0 +1,62 @@
#
# Nanoapp NanoPB Makefile
#
# Include this file in your nanoapp Makefile to produce pb.c and pb.h for .proto
# files specified in the NANOPB_SRCS variable. The produced pb.c files are
# automatically be added to the COMMON_SRCS variable for the nanoapp build.
include $(CHRE_PREFIX)/build/defs.mk
# Environment Checks ###########################################################
ifneq ($(NANOPB_SRCS),)
ifeq ($(NANOPB_PREFIX),)
$(error "NANOPB_SRCS is non-empty. You must supply a NANOPB_PREFIX environment \
variable containing a path to the nanopb project. Example: \
export NANOPB_PREFIX=$$HOME/path/to/nanopb/nanopb-c")
endif
endif
# Generated Source Files #######################################################
NANOPB_GEN_PATH = $(OUT)/nanopb_gen
NANOPB_GEN_SRCS += $(patsubst %.proto, $(NANOPB_GEN_PATH)/%.pb.c, \
$(NANOPB_SRCS))
ifneq ($(NANOPB_GEN_SRCS),)
COMMON_CFLAGS += -I$(NANOPB_PREFIX)
COMMON_CFLAGS += -I$(NANOPB_GEN_PATH)
COMMON_CFLAGS += $(addprefix -I$(NANOPB_GEN_PATH)/, $(NANOPB_INCLUDES))
COMMON_SRCS += $(NANOPB_PREFIX)/pb_common.c
COMMON_SRCS += $(NANOPB_PREFIX)/pb_decode.c
COMMON_SRCS += $(NANOPB_PREFIX)/pb_encode.c
endif
# NanoPB Compiler Flags ########################################################
ifneq ($(NANOPB_GEN_SRCS),)
COMMON_CFLAGS += -DPB_NO_PACKED_STRUCTS=1
endif
# NanoPB Generator Setup #######################################################
NANOPB_GENERATOR_SRCS = $(NANOPB_PREFIX)/generator/proto/nanopb_pb2.py
NANOPB_GENERATOR_SRCS += $(NANOPB_PREFIX)/generator/proto/plugin_pb2.py
$(NANOPB_GENERATOR_SRCS):
cd $(NANOPB_PREFIX)/generator/proto && make
# Generate NanoPB Sources ######################################################
COMMON_SRCS += $(NANOPB_GEN_SRCS)
NANOPB_PROTOC = $(NANOPB_PREFIX)/generator/protoc-gen-nanopb
$(NANOPB_GEN_PATH)/%.pb.c $(NANOPB_GEN_PATH)/%.pb.h: %.proto \
$(wildcard %.options) \
$(NANOPB_GENERATOR_SRCS)
mkdir -p $(dir $@)
protoc --plugin=protoc-gen-nanopb=$(NANOPB_PROTOC) \
--nanopb_out=$(NANOPB_GEN_PATH) $<

View file

@ -0,0 +1,205 @@
/*
Copyright (c) 2017, The Linux Foundation. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following
disclaimer in the documentation and/or other materials provided
with the distribution.
* Neither the name of The Linux Foundation nor the names of its
contributors may be used to endorse or promote products derived
from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
OUTPUT_FORMAT("elf32-littlehexagon", "elf32-bighexagon",
"elf32-littlehexagon")
OUTPUT_ARCH(hexagon)
PHDRS {
phdr1 PT_LOAD;
phdr2 PT_LOAD;
dynamic1 PT_DYNAMIC;
note1 PT_NOTE;
}
ENTRY(start)
SECTIONS
{
.interp : { *(.interp) }
.note.qti.uimg.dl.ver : { *(.note.qti.uimg.dl.ver) } : phdr1 : note1
.dynsym : { *(.dynsym) } : phdr1
.dynstr : { *(.dynstr) }
.hash : { *(.hash) }
.rela.dyn :
{
*(.rela.text .rela.text.* .rela.gnu.linkonce.t.*)
*(.rela.fini)
*(.rela.rodata .rela.rodata.* .rela.gnu.linkonce.r.*)
*(.rela.data .rela.data.* .rela.gnu.linkonce.d.*)
*(.rela.tdata .rela.tdata.* .rela.gnu.linkonce.td.*)
*(.rela.tbss .rela.tbss.* .rela.gnu.linkonce.tb.*)
*(.rela.ctors)
*(.rela.dtors)
*(.rela.got)
*(.rela.sdata .rela.lit[a48] .rela.sdata.* .rela.lit[a48].* .rela.gnu.linkonce.s.* .rela.gnu.linkonce.l[a48].*)
*(.rela.sbss .rela.sbss.* .rela.gnu.linkonce.sb.*)
*(.rela.sdata2 .rela.sdata2.* .rela.gnu.linkonce.s2.*)
*(.rela.sbss2 .rela.sbss2.* .rela.gnu.linkonce.sb2.*)
*(.rela.bss .rela.bss.* .rela.gnu.linkonce.b.*)
}
.rela.plt :
{
*(.rela.plt)
} : phdr1
. = ALIGN(64);
/* Code starts. */
.start :
{
KEEP (*(.start))
} =0x00c0007f
. = ALIGN(64);
.init :
{
KEEP (*(.init))
} =0x00c0007f
.plt : { *(.plt) }
. = ALIGN (64);
.text :
{
*(.text.unlikely .text.*_unlikely)
*(.text.hot .text.hot.* .gnu.linkonce.t.hot.*)
*(.text .stub .text.* .gnu.linkonce.t.*)
} =0x00c0007f
.fini :
{
KEEP (*(.fini))
} =0x00c0007f
PROVIDE (__etext = .);
PROVIDE (_etext = .);
PROVIDE (etext = .);
. = ALIGN(64);
/* Constants start. */
.rodata :
{
*(.rodata.hot .rodata.hot.* .gnu.linkonce.r.hot.*)
*(.rodata .rodata.* .gnu.linkonce.r.*)
}
.eh_frame_hdr : { *(.eh_frame_hdr) }
.eh_frame : { KEEP (*(.eh_frame)) }
.gcc_except_table : { *(.gcc_except_table .gcc_except_table.*) }
_DYNAMIC = .;
.dynamic : { *(.dynamic) } : phdr1 : dynamic1
.got : { *(.got) *(.igot) } : phdr1
.got.plt : { *(.got.plt) *(.igot.plt) }
. = ALIGN(64);
.ctors :
{
KEEP (*crtbegin.o(.ctors))
KEEP (*crtbegin?.o(.ctors))
KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o fini.o) .ctors))
KEEP (*(SORT(.ctors.*)))
KEEP (*(.ctors))
}
.dtors :
{
KEEP (*crtbegin.o(.dtors))
KEEP (*crtbegin?.o(.dtors))
KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o fini.o) .dtors))
KEEP (*(SORT(.dtors.*)))
KEEP (*(.dtors))
}
/*. = ALIGN (CONSTANT (MAXPAGESIZE)) - ((CONSTANT (MAXPAGESIZE) - .) & (CONSTANT (MAXPAGESIZE) - 1)); . = DATA_SEGMENT_ALIGN (CONSTANT (MAXPAGESIZE), CONSTANT (COMMONPAGESIZE));
. = ALIGN (DEFINED (DATAALIGN) ? (DATAALIGN * 1K) : CONSTANT (MAXPAGESIZE));*/
. = DATA_SEGMENT_RELRO_END (16, .);
. = ALIGN (4K);
.data :
{
*(.data.hot .data.hot.* .gnu.linkonce.d.hot.*)
*(.data .data.* .gnu.linkonce.d.*)
SORT(CONSTRUCTORS)
} : phdr2
_edata = .; PROVIDE (edata = .);
. = ALIGN (64);
/* Small data start. */
. = ALIGN(64);
.sdata :
{
PROVIDE (_SDA_BASE_ = .);
*(.sdata.1 .sdata.1.* .gnu.linkonce.s.1.*)
*(.sbss.1 .sbss.1.* .gnu.linkonce.sb.1.*)
*(.scommon.1 .scommon.1.*)
*(.sdata.2 .sdata.2.* .gnu.linkonce.s.2.*)
*(.sbss.2 .sbss.2.* .gnu.linkonce.sb.2.*)
*(.scommon.2 .scommon.2.*)
*(.sdata.4 .sdata.4.* .gnu.linkonce.s.4.*)
*(.sbss.4 .sbss.4.* .gnu.linkonce.sb.4.*)
*(.scommon.4 .scommon.4.*)
*(.lit[a4] .lit[a4].* .gnu.linkonce.l[a4].*)
*(.sdata.8 .sdata.8.* .gnu.linkonce.s.8.*)
*(.sbss.8 .sbss.8.* .gnu.linkonce.sb.8.*)
*(.scommon.8 .scommon.8.*)
*(.lit8 .lit8.* .gnu.linkonce.l8.*)
*(.sdata.hot .sdata.hot.* .gnu.linkonce.s.hot.*)
*(.sdata .sdata.* .gnu.linkonce.s.*)
}
.sbss :
{
PROVIDE (__sbss_start = .);
PROVIDE (___sbss_start = .);
*(.dynsbss)
*(.sbss.hot .sbss.hot.* .gnu.linkonce.sb.hot.*)
*(.sbss .sbss.* .gnu.linkonce.sb.*)
*(.scommon .scommon.*)
. = ALIGN (. != 0 ? 64 : 1);
PROVIDE (__sbss_end = .);
PROVIDE (___sbss_end = .);
}
. = ALIGN (64);
__bss_start = .;
.bss :
{
*(.dynbss)
*(.bss.hot .bss.hot.* .gnu.linkonce.b.hot.*)
*(.bss .bss.* .gnu.linkonce.b.*)
*(COMMON)
}
. = ALIGN (64);
_end = .;
PROVIDE (end = .);
.comment 0 : { *(.comment) }
/* DWARF debug sections.
Symbols in the DWARF debugging sections are relative to the beginning
of the section so we begin them at 0. */
/* DWARF 1 */
.debug 0 : { *(.debug) }
.line 0 : { *(.line) }
.debug_aranges 0 : { *(.debug_aranges) }
.debug_pubnames 0 : { *(.debug_pubnames) }
/* DWARF 2 */
.debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) }
.debug_abbrev 0 : { *(.debug_abbrev) }
.debug_line 0 : { *(.debug_line) }
.debug_frame 0 : { *(.debug_frame) }
.debug_str 0 : { *(.debug_str) }
.debug_loc 0 : { *(.debug_loc) }
/* DWARF 3 */
.debug_pubtypes 0 : { *(.debug_pubtypes) }
.debug_ranges 0 : { *(.debug_ranges) }
/DISCARD/ : { *(.note.GNU-stack) *(.gnu_debuglink) }
}

View file

@ -0,0 +1,69 @@
/*
Copyright (c) 2017, The Linux Foundation. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following
disclaimer in the documentation and/or other materials provided
with the distribution.
* Neither the name of The Linux Foundation nor the names of its
contributors may be used to endorse or promote products derived
from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef UIMG_DL_VER_MAJOR
#define UIMG_DL_VER_MAJOR 1
#endif
#ifndef UIMG_DL_VER_MINOR
#define UIMG_DL_VER_MINOR 0
#endif
#ifndef UIMG_DL_VER_MAINT
#define UIMG_DL_VER_MAINT 0
#endif
#define __TOSTR(_x) #_x
#define _TOSTR(_x) __TOSTR(_x)
typedef struct note_type{
int sizename;
int sizedesc;
int type;
char name[24];
int desc[3];
} note_type;
#ifdef __llvm__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
const note_type uimg_dl_ver __attribute__ ((section (".note.qti.uimg.dl.ver")))
__attribute__ ((visibility ("default"))) = {
24,
12,
0,
"uimg.dl.ver." _TOSTR(UIMG_DL_VER_MAJOR) "." _TOSTR(UIMG_DL_VER_MINOR) "." _TOSTR(UIMG_DL_VER_MAINT),
{UIMG_DL_VER_MAJOR, UIMG_DL_VER_MINOR, UIMG_DL_VER_MAINT}
};
#ifdef __llvm__
#pragma clang diagnostic pop
#endif

View file

@ -0,0 +1,43 @@
#
# Common global compiler configuration
#
# Common Compiler Flags ########################################################
# CHRE requires C++11 and C99 support.
COMMON_CXX_CFLAGS += -std=c++11
COMMON_C_CFLAGS += -x c
COMMON_C_CFLAGS += -std=c99
# Configure 'all' and 'extra' warnings and promote warnings to errors.
COMMON_CFLAGS += -Wall
COMMON_CFLAGS += -Wextra
COMMON_CFLAGS += -Werror
# Disabled warnings. You better have a good reason to add more here.
COMMON_CFLAGS += -Wno-unused-parameter
# Additional warnings. Even more! :]
COMMON_CFLAGS += -Wshadow
# Disable exceptions and RTTI.
COMMON_CFLAGS += -fno-exceptions
COMMON_CFLAGS += -fno-rtti
# Enable the linker to garbage collect unused code and variables.
COMMON_CFLAGS += -fdata-sections
COMMON_CFLAGS += -ffunction-sections
# Enable debugging symbols for debug builds.
COMMON_DEBUG_CFLAGS += -g
# Dependency Resolution
DEP_CFLAGS = -MM -MG -MP -MF $$(basename $$@).Td
DEP_POST_COMPILE = @mv -f $$(basename $$@).Td $$(basename $$@).d && touch $$@
# Compile with hidden visibility by default.
COMMON_CFLAGS += -fvisibility=hidden
# Common Archive Flags #########################################################
COMMON_ARFLAGS += rsc

View file

@ -0,0 +1,21 @@
#
# Nanohub CHRE Implementation for Cortex-M4 Architecture
#
include $(CHRE_PREFIX)/build/clean_build_template_args.mk
TARGET_NAME = google_cm4_nanohub
TARGET_CFLAGS = -DCHRE_MESSAGE_TO_HOST_MAX_SIZE=128
TARGET_CFLAGS += $(GOOGLE_CM4_NANOHUB_CFLAGS)
TARGET_VARIANT_SRCS = $(GOOGLE_CM4_NANOHUB_SRCS)
TARGET_SO_LATE_LIBS = $(GOOGLE_CM4_NANOHUB_LATE_LIBS)
CORTEXM_ARCH = m4
ifneq ($(filter $(TARGET_NAME)% all, $(MAKECMDGOALS)),)
include $(CHRE_PREFIX)/build/arch/cortexm.mk
include $(CHRE_PREFIX)/build/build_template.mk
ifneq ($(IS_NANOAPP_BUILD),)
include $(CHRE_PREFIX)/build/nanoapp/google_nanohub.mk
endif
endif

View file

@ -0,0 +1,22 @@
#
# Google CHRE Reference Implementation for Hexagon v60 Architecture on SLPI
#
include $(CHRE_PREFIX)/build/clean_build_template_args.mk
TARGET_NAME = google_hexagonv60_slpi
TARGET_CFLAGS = -DCHRE_MESSAGE_TO_HOST_MAX_SIZE=2048
TARGET_CFLAGS += $(GOOGLE_HEXAGONV60_SLPI_CFLAGS)
TARGET_VARIANT_SRCS = $(GOOGLE_HEXAGONV60_SLPI_SRCS)
TARGET_SO_LATE_LIBS = $(GOOGLE_HEXAGONV60_SLPI_LATE_LIBS)
HEXAGON_ARCH = v60
ifneq ($(filter $(TARGET_NAME)% all, $(MAKECMDGOALS)),)
ifneq ($(IS_NANOAPP_BUILD),)
TARGET_SO_LATE_LIBS += $(CHRE_PREFIX)/build/app_support/google_slpi/libchre_slpi_skel.so
include $(CHRE_PREFIX)/build/nanoapp/google_slpi.mk
endif
include $(CHRE_PREFIX)/build/arch/hexagon.mk
include $(CHRE_PREFIX)/build/build_template.mk
endif

View file

@ -0,0 +1,31 @@
#
# Google CHRE Reference Implementation for Hexagon v62 Architecture on SLPI
#
include $(CHRE_PREFIX)/build/clean_build_template_args.mk
TARGET_NAME = google_hexagonv62_slpi-uimg
# Sized based on the buffer allocated in the host daemon (4096 bytes), minus
# FlatBuffer overhead (max 80 bytes), minus some extra space to make a nice
# round number and allow for addition of new fields to the FlatBuffer
TARGET_CFLAGS = -DCHRE_MESSAGE_TO_HOST_MAX_SIZE=4000
TARGET_CFLAGS += -mno-pic-data-is-text-relative
TARGET_CFLAGS += -DCHRE_SLPI_UIMG_ENABLED
TARGET_CFLAGS += $(GOOGLE_HEXAGONV62_SLPI-UIMG_CFLAGS)
TARGET_VARIANT_SRCS = $(GOOGLE_HEXAGONV62_SLPI-UIMG_SRCS)
TARGET_SO_LATE_LIBS = $(GOOGLE_HEXAGONV62_SLPI-UIMG_LATE_LIBS)
HEXAGON_ARCH = v62
# Enable uImage support.
TARGET_VARIANT_SRCS += $(SYS_SUPPORT_PATH)/qcom/uimg_dl_ver.c
TARGET_SO_LDFLAGS += --script=$(SYS_SUPPORT_PATH)/qcom/uimage.lcs.toolv80
ifneq ($(filter $(TARGET_NAME)% all, $(MAKECMDGOALS)),)
ifneq ($(IS_NANOAPP_BUILD),)
TARGET_SO_LATE_LIBS += $(CHRE_PREFIX)/build/app_support/google_slpi/libchre_slpi_skel.so
include $(CHRE_PREFIX)/build/nanoapp/google_slpi.mk
endif
include $(CHRE_PREFIX)/build/arch/hexagon.mk
include $(CHRE_PREFIX)/build/build_template.mk
endif

View file

@ -0,0 +1,25 @@
#
# Google CHRE Reference Implementation for Hexagon v62 Architecture on SLPI
#
include $(CHRE_PREFIX)/build/clean_build_template_args.mk
TARGET_NAME = google_hexagonv62_slpi
# Sized based on the buffer allocated in the host daemon (4096 bytes), minus
# FlatBuffer overhead (max 80 bytes), minus some extra space to make a nice
# round number and allow for addition of new fields to the FlatBuffer
TARGET_CFLAGS = -DCHRE_MESSAGE_TO_HOST_MAX_SIZE=4000
TARGET_CFLAGS += $(GOOGLE_HEXAGONV62_SLPI_CFLAGS)
TARGET_VARIANT_SRCS = $(GOOGLE_HEXAGONV62_SLPI_SRCS)
TARGET_SO_LATE_LIBS = $(GOOGLE_HEXAGONV62_SLPI_LATE_LIBS)
HEXAGON_ARCH = v62
ifneq ($(filter $(TARGET_NAME)% all, $(MAKECMDGOALS)),)
ifneq ($(IS_NANOAPP_BUILD),)
TARGET_SO_LATE_LIBS += $(CHRE_PREFIX)/build/app_support/google_slpi/libchre_slpi_skel.so
include $(CHRE_PREFIX)/build/nanoapp/google_slpi.mk
endif
include $(CHRE_PREFIX)/build/arch/hexagon.mk
include $(CHRE_PREFIX)/build/build_template.mk
endif

View file

@ -0,0 +1,42 @@
#
# CHRE GoogleTest Build Variant
#
include $(CHRE_PREFIX)/build/clean_build_template_args.mk
TARGET_NAME = google_x86_googletest
TARGET_CFLAGS = -DCHRE_MESSAGE_TO_HOST_MAX_SIZE=2048
TARGET_VARIANT_SRCS = $(GOOGLE_X86_GOOGLETEST_SRCS)
TARGET_VARIANT_SRCS += $(GOOGLETEST_SRCS)
# Add a symbol to determine when building for a test.
TARGET_CFLAGS += -DGTEST
# Ignore sign comparison warnings triggered by EXPECT/ASSERT macros in tests
# (typically, unsigned value vs. implicitly signed literal)
TARGET_CFLAGS += -Wno-sign-compare
TARGET_SO_LATE_LIBS = $(GOOGLE_X86_GOOGLETEST_LATE_LIBS)
ifneq ($(filter $(TARGET_NAME)% all, $(MAKECMDGOALS)),)
ifeq ($(ANDROID_BUILD_TOP),)
$(error "You should supply an ANDROID_BUILD_TOP environment variable \
containing a path to the Android source tree. This is typically \
provided by initializing the Android build environment.")
endif
export GOOGLETEST_PREFIX=$(ANDROID_BUILD_TOP)/external/googletest
include $(CHRE_PREFIX)/build/arch/x86.mk
TARGET_CFLAGS += $(GOOGLETEST_CFLAGS)
TARGET_CFLAGS += $(GOOGLE_X86_GOOGLETEST_CFLAGS)
# Instruct the build to link a final executable.
TARGET_BUILD_BIN = true
# Link in libraries for the final executable.
TARGET_BIN_LDFLAGS += -lrt -ldl
TARGET_BIN_LDFLAGS += -lpthread
include $(CHRE_PREFIX)/build/build_template.mk
endif

View file

@ -0,0 +1,36 @@
#
# Google Reference CHRE Implementation for Linux on x86
#
include $(CHRE_PREFIX)/build/clean_build_template_args.mk
TARGET_NAME = google_x86_linux
TARGET_CFLAGS = -DCHRE_MESSAGE_TO_HOST_MAX_SIZE=2048
TARGET_VARIANT_SRCS = $(GOOGLE_X86_LINUX_SRCS)
TARGET_SO_LATE_LIBS = $(GOOGLE_X86_LINUX_LATE_LIBS)
# Enable conversion warnings for the simulator. Since this is a platform 100%
# within our control we expect that there will be no conversion issues. It would
# be nice to enable this globally in the tools_config.mk but some vendor header
# files do not compile cleanly with it.
TARGET_CFLAGS += -Wconversion
# Add the target CFLAGS after the -Wconversion warning to allow targets to
# disable it.
TARGET_CFLAGS += $(GOOGLE_X86_LINUX_CFLAGS)
ifneq ($(filter $(TARGET_NAME)% all, $(MAKECMDGOALS)),)
ifneq ($(IS_NANOAPP_BUILD),)
include $(CHRE_PREFIX)/build/nanoapp/google_linux.mk
else
# Instruct the build to link a final executable.
TARGET_BUILD_BIN = true
# Link in libraries for the final executable and export symbols to dynamically
# loaded objects.
TARGET_BIN_LDFLAGS += -lrt -ldl -Wl,--export-dynamic
endif
include $(CHRE_PREFIX)/build/arch/x86.mk
include $(CHRE_PREFIX)/build/build_template.mk
endif

View file

@ -0,0 +1,28 @@
#
# Qualcomm CHRE Implementation for Hexagon v60, based on Nanohub
#
include $(CHRE_PREFIX)/build/clean_build_template_args.mk
TARGET_NAME = qcom_hexagonv60_nanohub-uimg
TARGET_CFLAGS = -DCHRE_MESSAGE_TO_HOST_MAX_SIZE=4080
TARGET_CFLAGS += -mno-pic-data-is-text-relative
TARGET_CFLAGS += $(QCOM_HEXAGONV60_NANOHUB-UIMG_CFLAGS)
TARGET_VARIANT_SRCS = $(QCOM_HEXAGONV60_NANOHUB-UIMG_SRCS)
TARGET_SO_LATE_LIBS = $(QCOM_HEXAGONV60_NANOHUB-UIMG_LATE_LIBS)
HEXAGON_ARCH = v60
# Enable uImage support.
TARGET_VARIANT_SRCS += $(SYS_SUPPORT_PATH)/qcom/uimg_dl_ver.c
TARGET_SO_LDFLAGS += --script=$(SYS_SUPPORT_PATH)/qcom/uimage.lcs.toolv80
ifneq ($(filter $(TARGET_NAME)% all, $(MAKECMDGOALS)),)
ifneq ($(IS_NANOAPP_BUILD),)
TARGET_SO_LATE_LIBS += $(CHRE_PREFIX)/build/app_support/qcom_nanohub/chre.so
TARGET_SO_LATE_LIBS += $(CHRE_PREFIX)/build/app_support/qcom_nanohub/chre_platform.so
include $(CHRE_PREFIX)/build/nanoapp/qcom_nanohub.mk
endif
include $(CHRE_PREFIX)/build/arch/hexagon.mk
include $(CHRE_PREFIX)/build/build_template.mk
endif

View file

@ -0,0 +1,23 @@
#
# Qualcomm CHRE Implementation for Hexagon v60, based on Nanohub
#
include $(CHRE_PREFIX)/build/clean_build_template_args.mk
TARGET_NAME = qcom_hexagonv60_nanohub
TARGET_CFLAGS = -DCHRE_MESSAGE_TO_HOST_MAX_SIZE=4080
TARGET_CFLAGS += $(QCOM_HEXAGONV60_NANOHUB_CFLAGS)
TARGET_VARIANT_SRCS = $(QCOM_HEXAGONV60_NANOHUB_SRCS)
TARGET_SO_LATE_LIBS = $(QCOM_HEXAGONV60_NANOHUB_LATE_LIBS)
HEXAGON_ARCH = v60
ifneq ($(filter $(TARGET_NAME)% all, $(MAKECMDGOALS)),)
ifneq ($(IS_NANOAPP_BUILD),)
TARGET_SO_LATE_LIBS += $(CHRE_PREFIX)/build/app_support/qcom_nanohub/chre.so
TARGET_SO_LATE_LIBS += $(CHRE_PREFIX)/build/app_support/qcom_nanohub/chre_platform.so
include $(CHRE_PREFIX)/build/nanoapp/qcom_nanohub.mk
endif
include $(CHRE_PREFIX)/build/arch/hexagon.mk
include $(CHRE_PREFIX)/build/build_template.mk
endif