################################################################################
#
# MobiCore TAD Trustlet
#
################################################################################


### this is our home dir
TRUSTLET_DIR := $(COMP_PATH_BASE)/$(MODULE_NAME)/tltad/src

$(info TRUSTLET_DIR:$(TRUSTLET_DIR))

#-------------------------------------------------------------------------------
# Output
#-------------------------------------------------------------------------------
### output name without path or extension
#TODO: need to change
OUTPUT_NAME := tlauthnr
TRUSTLET_UUID := ffffffff000000000000000000000081

#default config. it may change each chipset.
TRUSTLET_KEYFILE := ./pairVendorTltSig.pem
TBASE_API_LEVEL := 7
TRUSTLET_SERVICE_TYPE := 3
TRUSTLET_NO_OF_THREADS := 1
TRUSTLET_INSTANCES := 1
TRUSTLET_MEMTYPE := 2
TRUSTLET_FLAGS := 8
HEAP_SIZE_INIT := 131072 #128Kb
HEAP_SIZE_MAX := 4194304 #4Mb

### Add feature flags here
ARMCC_COMPILATION_FLAGS += -DUSE_MOBICORE
ARMCC_COMPILATION_FLAGS += -DUSE_$(shell echo $(SOC_NAME) | tr a-z A-Z)

#need to add below string to sign script from trustlet.mk as "-conf_str $(TA_CONF_STR)"
TA_CONF_STR := "-s $(TRUSTLET_SERVICE_TYPE)\
              -n $(TRUSTLET_NO_OF_THREADS)\
              -i $(TRUSTLET_INSTANCES)\
              -m $(TRUSTLET_MEMTYPE)\
              -f $(TRUSTLET_FLAGS)\
              -sh $(HEAP_SIZE_INIT)\
              -mh $(HEAP_SIZE_MAX)"

#-------------------------------------------------------------------------------
# Files and include paths - Add your files here
#-------------------------------------------------------------------------------
### Add include path here
INCLUDE_DIRS += \
    ${TLSDK_DIR}/Public \
    ${TLSDK_DIR}/Public/MobiCore/inc \
    $(TRUSTLET_DIR)/dependency_mobicore/inc \
    $(TRUSTLET_DIR)/inc
        
### Add source code files for C++ compiler here
SRC_CPP += # nothing

### Add source code files for C compiler here
# FIDO UAF AUTHNR
SRC_C += \
		$(TRUSTLET_DIR)/dependency_mobicore/mobidep_main.c \
		$(TRUSTLET_DIR)/dependency_mobicore/mobidep_util.c \
		$(TRUSTLET_DIR)/dependency_mobicore/mobidep_crypto.c \
		$(TRUSTLET_DIR)/cmd_manager.c \
		$(TRUSTLET_DIR)/tlv_parser.c \
		$(TRUSTLET_DIR)/parser_tlv.c \
		$(TRUSTLET_DIR)/util.c \
		$(TRUSTLET_DIR)/parser_certificate.c \
		$(TRUSTLET_DIR)/cmd_crypto.c \
		$(TRUSTLET_DIR)/cmd_skpm.c \
		$(TRUSTLET_DIR)/cmd_common.c

### Add source code files for assembler here
SRC_S += # nothing

#-------------------------------------------------------------------------------
# use generic make file
include $(TLSDK_DIR_SRC)/trustlet.mk