1#
2# Copyright (C) 2018 Cadence Design Systems, Inc.
3#
4# Permission is hereby granted, free of charge, to any person obtaining
5# a copy of this software and associated documentation files (the
6# "Software"), to use this Software with Cadence processor cores only and
7# not with any other processors and platforms, subject to
8# the following conditions:
9#
10# The above copyright notice and this permission notice shall be included
11# in all copies or substantial portions of the Software.
12#
13# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
14# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
15# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
16# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
17# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
18# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
19# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
20#
21
22
23.PHONY: all install clean HIKEY960
24
25NOSTRIP = 1
26XF_TRACE = 1
27
28ROOTDIR = ..
29CODEC_NAME = hikey
30
31PLUGINO2OBJS =
32PLUGINLIBS =
33PLUGININCLUDES =
34
35XA_MP3_DECODER ?= 0
36XA_VORBIS_DECODER ?= 1
37XA_MIXER 	   ?= 1
38XA_PCM 	   ?= 1
39
40
41vpath %.c $(ROOTDIR)/ipc/xt-shmem/hikey
42vpath %.c $(ROOTDIR)/ipc/xt-shmem
43vpath %.c $(ROOTDIR)/core/util
44vpath %.c $(ROOTDIR)/core/util/gdbstub
45vpath %.c $(ROOTDIR)/core
46vpath %.c $(ROOTDIR)/app
47vpath %.c $(ROOTDIR)/audio
48
49vpath %.S $(ROOTDIR)/ipc/xt-shmem/hikey
50vpath %.S $(ROOTDIR)/core/util/gdbstub
51
52vpath %.c $(ROOTDIR)/plugins/cadence/mixer
53
54LIBXAFASMOBJS = \
55			reset.o \
56			int_vector.o \
57			arch_hifi330.o \
58			gdbstub-entry.o
59
60LIBXAFO2OBJS = \
61            cpu_c.o \
62			dsp_debug.o \
63			dsp_comm.o \
64			mutex.o \
65			rbtree.o \
66			xf-core.o \
67			xf-io.o \
68			xf-mem.o \
69			xf-msg.o \
70			xf-sched.o \
71			xa-factory.o \
72			xf-shmem.o \
73			tinyvprintf.o \
74			xf-isr.o \
75			gdbstub.o \
76			xa-class-base.o \
77			xa-class-audio-codec.o \
78			xa-class-mixer.o \
79			xf-main.o
80
81ifeq ($(XF_TRACE),1)
82  CFLAGS         += -DXF_TRACE=1
83  CFLAGS         += -DXAF_PROFILE_DSP=1
84endif
85
86ifeq ($(XA_MP3_DECODER),1)
87  vpath %.c $(ROOTDIR)/plugins/cadence/mp3_dec
88  CFLAGS         += -DXA_MP3_DECODER=1
89  PLUGINO2OBJS   += xa-mp3-decoder.o
90  PLUGINLIBS     += $(ROOTDIR)/plugins/cadence/mp3_dec/lib/hifi2/xa_mp3_dec.a
91  PLUGININCLUDES += -I$(ROOTDIR)/plugins/cadence/mp3_dec
92endif
93
94ifeq ($(XA_PCM),1)
95  vpath %.c $(ROOTDIR)/plugins/cadence/pcm_proc
96  CFLAGS         += -DXA_PCM=1
97  PLUGINO2OBJS   += xa-pcm.o
98  PLUGINLIBS     +=
99  PLUGININCLUDES += -I$(ROOTDIR)/plugins/cadence/pcm_proc
100endif
101
102ifeq ($(XA_VORBIS_DECODER),1)
103  vpath %.c $(ROOTDIR)/plugins/cadence/vorbis_dec
104  CFLAGS         += -DXA_VORBIS_DECODER=1
105  PLUGINO2OBJS   += xa-vorbis-decoder.o
106  PLUGINLIBS     += $(ROOTDIR)/plugins/cadence/vorbis_dec/lib/hifi3/xa_vorbis_dec.a
107  PLUGININCLUDES += -I$(ROOTDIR)/plugins/cadence/vorbis_dec
108endif
109
110ifeq ($(XA_MIXER),1)
111  vpath %.c $(ROOTDIR)/plugins/cadence/mixer
112  CFLAGS         += -DXA_MIXER=1
113  PLUGINO2OBJS   += xa-mixer.o
114  PLUGINLIBS     +=
115  PLUGININCLUDES += -I$(ROOTDIR)/plugins/cadence/mixer
116endif
117
118LIBO2OBJS = $(LIBXAFO2OBJS) $(LIBMP3DECO2OBJS) $(LIBMIXERO2OBJS) $(PLUGINO2OBJS)
119LIBASMOBJS = $(LIBXAFASMOBJS)
120
121INCLUDES += \
122    -I$(ROOTDIR)/include \
123    -I$(ROOTDIR)/include/audio \
124    -I$(ROOTDIR)/include/sys/xt-shmem \
125	-I$(ROOTDIR)/include/sys/xt-shmem/board-hikey \
126    -I$(ROOTDIR)/plugins/cadence/mp3_dec
127
128INCLUDES += $(PLUGININCLUDES)
129
130LDFLAGS += -nostdlib -lhal -lhandlers-board -lc -lgcc
131LDFLAGS += -mlsp="./hifi_hikey_lsp"
132
133HIKEY960: $(CODEC_NAME)
134
135include $(ROOTDIR)/build_hikey/common.mk
136