1#
2# Google Reference CHRE Implementation for MTK riscv (v55e03) Tinysys
3#
4
5include $(CHRE_PREFIX)/build/clean_build_template_args.mk
6
7TARGET_NAME = aosp_riscv55e03_tinysys
8ifneq ($(filter $(TARGET_NAME)% all, $(MAKECMDGOALS)),)
9
10ifeq ($(RISCV_TINYSYS_PREFIX),)
11$(error "The tinysys code directory needs to be exported as the RISCV_TINYSYS_PREFIX \
12         environment variable")
13endif
14
15TARGET_CFLAGS = $(TINYSYS_CFLAGS)
16TARGET_VARIANT_SRCS = $(TINYSYS_SRCS)
17TARGET_BIN_LDFLAGS = $(AOSP_RISCV_TINYSYS_BIN_LDFLAGS)
18TARGET_SO_EARLY_LIBS = $(AOSP_RISCV_TINYSYS_EARLY_LIBS)
19TARGET_SO_LATE_LIBS = $(AOSP_RISCV_TINYSYS_LATE_LIBS)
20TARGET_PLATFORM_ID = 0x476f6f676c003000
21
22# Macros #######################################################################
23
24TINYSYS_CFLAGS += -D__riscv
25TINYSYS_CFLAGS += -DMRV55
26TINYSYS_CFLAGS += -D_LIBCPP_HAS_NO_LONG_LONG
27
28TINYSYS_CFLAGS += --target=riscv32-unknown-elf
29TINYSYS_CFLAGS += -march=rv32imafcv
30TINYSYS_CFLAGS += -mcpu=MRV55E03
31
32# Word size for this architecture
33TARGET_CFLAGS += -DCHRE_32_BIT_WORD_SIZE
34
35# chre platform
36TARGET_CFLAGS += -DCHRE_FIRST_SUPPORTED_API_VERSION=CHRE_API_VERSION_1_7
37TARGET_CFLAGS += -DCHRE_MESSAGE_TO_HOST_MAX_SIZE=4096
38TARGET_CFLAGS += -DCHRE_USE_BUFFERED_LOGGING
39# enable static allocation in freertos
40TINYSYS_CFLAGS += -DCFG_STATIC_ALLOCATE
41
42# Compiling flags ##############################################################
43
44# -fpic and -shared are only needed for dynamic linking
45ifeq ($(IS_ARCHIVE_ONLY_BUILD),)
46TARGET_SO_LDFLAGS += -shared
47TARGET_CFLAGS += -fpic
48
49# Enable compiler-rt dependencies
50LLVM_RTLIB=$(RISCV_TOOLCHAIN_PATH)/lib/clang/9.0.1/libpic/riscv32/MRV55E03
51TARGET_SO_LDFLAGS += -L$(LLVM_RTLIB)
52TARGET_SO_LDFLAGS += -lclang_rt.builtins-riscv32
53endif
54
55ifneq ($(IS_NANOAPP_BUILD),)
56# Used to expose libc headers to nanoapps that aren't supported on the given platform
57TARGET_CFLAGS += -I$(CHRE_PREFIX)/platform/shared/include/chre/platform/shared/libc
58
59TARGET_VARIANT_SRCS += $(DSO_SUPPORT_LIB_SRCS)
60TARGET_CFLAGS += $(DSO_SUPPORT_LIB_CFLAGS)
61
62ifeq ($(CHRE_TCM_ENABLED),true)
63TARGET_CFLAGS += -DCHRE_TCM_ENABLED
64# Flags:
65# Signed                 = 0x00000001
66# TCM-capable            = 0x00000004
67TARGET_NANOAPP_FLAGS = 0x00000005
68endif
69endif
70
71# Other makefiles ##############################################################
72
73include $(CHRE_PREFIX)/platform/shared/mbedtls/mbedtls.mk
74include $(CHRE_PREFIX)/build/arch/riscv.mk
75include $(CHRE_PREFIX)/build/build_template.mk
76endif
77
78