summaryrefslogtreecommitdiffstats
blob: 7172a101e1e78e88e9fb991faff321262bd46866 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
#
# Macro definitions referenced below
#

empty =
space =$(empty) $(empty)

ARMV7OBJDIR ?= ./obj/$(DEVICE)
ARMV7BINDIR ?= ./bin/$(DEVICE)
ARMV7LIBDIR ?= ./lib

ARMV7OBJDIR := $(ARMV7OBJDIR)/pruss/example/apps/sorte/slave
ARMV7BINDIR := $(ARMV7BINDIR)/pruss/example/apps/sorte/slave

#Cross tools
ifdef CROSS_TOOL_INSTALL_PATH
# Support backwards compatibility with KeyStone1 approach
 CC = $(CROSS_TOOL_INSTALL_PATH)/$(CROSS_TOOL_PRFX)gcc
 AC = $(CROSS_TOOL_INSTALL_PATH)/$(CROSS_TOOL_PRFX)as
 AR = $(CROSS_TOOL_INSTALL_PATH)/$(CROSS_TOOL_PRFX)ar
 LD = $(CROSS_TOOL_INSTALL_PATH)/$(CROSS_TOOL_PRFX)gcc
endif

# INCLUDE Directories
PRUSS_INC_DIR = $(PDK_INSTALL_PATH)/ti/drv/pruss

PRUSS_SRC_DIR ?= $(PDK_INSTALL_PATH)/ti/drv/pruss
PRUSS_TEST_DIR = $(PRUSS_SRC_DIR)/test
PRUSS_EXAMPLE_SORTE_DIR = $(PRUSS_SRC_DIR)/example/apps/sorte
PRUSS_ARM_LIN_TEST_DIR = $(PRUSS_TEST_DIR)/src/armv7/linux
PRUSS_DEVICE_DIR = $(PRUSS_SRC_DIR)/soc/$(DEVICE)

INCDIR := $(PDK_INSTALL_PATH);$(PRUSS_INC_DIR);$(PRUSS_EXAMPLE_SORTE_DIR)/src;$(PRUSS_ARM_LIN_TEST_DIR);$(PRUSS_DEVICE_DIR);$(PRUSS_SRC_DIR)/../../..

# Libraries
PRUSS_LIB = -lpruss
OSAL_LIB = -L $(PDK_INSTALL_PATH)/ti/osal/lib/linux -losal


FW_LNK_CMD_REV1 = $(PDK_PKG_PATH)/ti/build/pruss/lnk_a8_a9_a15_REV1_linux.cmd
FW_LNK_CMD_REV2 = $(PDK_PKG_PATH)/ti/build/pruss/lnk_a8_a9_a15_REV2_linux.cmd
FW_BIN_PATH_A15 = $(PDK_PKG_PATH)/ti/drv/pruss/example/apps/sorte/firmware/bin/$(DEVICE)/a15_0/REV2
FW_BIN_PATH_A9 = $(PDK_PKG_PATH)/ti/drv/pruss/example/apps/sorte/firmware/bin/$(DEVICE)/a9host/REV1
FW_BIN_PATH_A8 = $(PDK_PKG_PATH)/ti/drv/pruss/example/apps/sorte/firmware/bin/$(DEVICE)/a8host/REV1

ifeq ($(DEVICE), am571x)
  TARGET = SOC_AM571x
  BOARD = idkAM571x
  FW_LNK_CMD = $(FW_LNK_CMD_REV2)
  FW_LIB_PRU0 = $(FW_BIN_PATH_A15)/sorte_slave_PRU0.bin
  FW_LIB_PRU1 = $(FW_BIN_PATH_A15)/sorte_slave_PRU1.bin
endif

ifeq ($(DEVICE), am572x)
  TARGET = SOC_AM572x
  BOARD = idkAM572x
  FW_LNK_CMD = $(FW_LNK_CMD_REV2)
  FW_LIB_PRU0 = $(FW_BIN_PATH_A15)/sorte_slave_PRU0.bin
  FW_LIB_PRU1 = $(FW_BIN_PATH_A15)/sorte_slave_PRU1.bin
endif

ifeq ($(DEVICE), am574x)
  TARGET = SOC_AM574x
  BOARD = idkAM574x
  FW_LNK_CMD = $(FW_LNK_CMD_REV2)
  FW_LIB_PRU0 = $(FW_BIN_PATH_A15)/sorte_slave_PRU0.bin
  FW_LIB_PRU1 = $(FW_BIN_PATH_A15)/sorte_slave_PRU1.bin
endif

ifeq ($(DEVICE), am335x)
  TARGET = SOC_AM335x
  BOARD = icev2AM335x
  FW_LNK_CMD = $(FW_LNK_CMD_REV1)
  FW_LIB_PRU0 = $(FW_BIN_PATH_A8)/sorte_slave_PRU0.bin
  FW_LIB_PRU1 = $(FW_BIN_PATH_A8)/sorte_slave_PRU1.bin
endif

ifeq ($(DEVICE), am437x)
  TARGET = SOC_AM437x
  BOARD = idkAM437x
  FW_LNK_CMD = $(FW_LNK_CMD_REV1)
  FW_LIB_PRU0 = $(FW_BIN_PATH_A9)/sorte_slave_PRU0.bin
  FW_LIB_PRU1 = $(FW_BIN_PATH_A9)/sorte_slave_PRU1.bin
endif

ifeq ($(DEVICE), k2g)
  TARGET = SOC_K2G
  BOARD = iceK2G
  FW_LNK_CMD = $(FW_LNK_CMD_REV2)
  FW_LIB_PRU0 = $(FW_BIN_PATH_A15)/sorte_slave_PRU0.bin
  FW_LIB_PRU1 = $(FW_BIN_PATH_A15)/sorte_slave_PRU1.bin
endif

ifeq ($(USEDYNAMIC_LIB), yes)
#presuming ARM executable would depend on dynamic library dependency
EXE_EXTN = _so
LIBS     = $(PRUSS_LIB) $(OSAL_LIB)
else
#forcing ARM executable to depend on static LLD libraries
EXE_EXTN =
LIBS     = -Wl,-Bstatic $(PRUSS_LIB) $(OSAL_LIB) -Wl,-Bdynamic
endif


# Compiler options
INTERNALDEFS = $(DEBUG_FLAG) -D__ARMv7 -D__LINUX_USER_SPACE -D_LITTLE_ENDIAN=1 -DMAKEFILE_BUILD -D_GNU_SOURCE -D${BOARD} -D${TARGET} -DUIO_INTERRUPT_ONE_SHOT_MODE -DSORTE_SLAVE

# Linker options
INTERNALLINKDEFS = -Wl,--start-group -L $(ARMV7LIBDIR) $(LIBS) -lrt -Wl,--end-group -pthread $(LDFLAGS)

MAIN_TEST_EXE=pruss_app_sorte_slave$(EXE_EXTN).out

OBJEXT = o

SRCDIR = $(PRUSS_EXAMPLE_SORTE_DIR)/src:$(PRUSS_ARM_LIN_TEST_DIR):$(PRUSS_DEVICE_DIR):

INCS = -I. -I$(strip $(subst ;, -I,$(INCDIR)))

VPATH=$(SRCDIR)

#List the Source Files
OSAL_TEST_SRC = \
	mmap_helper.c \
	pruicss_soc.c

MAIN_TEST_SRC = \
	main.c

# FLAGS for the SourceFiles
SRC_CFLAGS = -I. $(CFLAGS)

# Make Rule for the SRC Files
OSAL_TEST_SRC_OBJS = $(patsubst %.c, $(ARMV7OBJDIR)/%.$(OBJEXT), $(OSAL_TEST_SRC))
MAIN_TEST_SRC_OBJS = $(patsubst %.c, $(ARMV7OBJDIR)/%.$(OBJEXT), $(MAIN_TEST_SRC))

all:$(ARMV7BINDIR)/$(MAIN_TEST_EXE)

$(ARMV7BINDIR)/$(MAIN_TEST_EXE): $(MAIN_TEST_SRC_OBJS) $(OSAL_TEST_SRC_OBJS) $(ARMV7BINDIR)/.created
	@echo linking $(MAIN_TEST_SRC_OBJS) $(OSAL_TEST_SRC_OBJS) ${FW_LIB_PRU0} ${FW_LIB_PRU1} ${FW_LNK_CMD} into $@ ...
	@$(CC) $(MAIN_TEST_SRC_OBJS) $(OSAL_TEST_SRC_OBJS) ${FW_LIB_PRU0} ${FW_LIB_PRU1} ${FW_LNK_CMD} $(INTERNALLINKDEFS) -o $@

$(ARMV7OBJDIR)/%.$(OBJEXT): %.c $(ARMV7OBJDIR)/.created
	@echo compiling $< ...
	@$(CC) -c $(SRC_CFLAGS) $(INTERNALDEFS) $(INCS)  $< -o $@

$(ARMV7OBJDIR)/.created:
	@mkdir -p $(ARMV7OBJDIR)
	@touch $(ARMV7OBJDIR)/.created

$(ARMV7BINDIR)/.created:
	@mkdir -p $(ARMV7BINDIR)
	@touch $(ARMV7BINDIR)/.created

clean:
	@rm -fr $(ARMV7OBJDIR)
	@rm -fr $(ARMV7BINDIR)