-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
121 lines (99 loc) · 3.19 KB
/
Makefile
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
# Copyright (C) 2017 GreenWaves Technologies
# All rights reserved.
# This software may be modified and distributed under the terms
# of the BSD license. See the LICENSE file for details.
ifndef GAP_SDK_HOME
$(error Source sourceme in gap_sdk first)
endif
RGB?=0
include common.mk
ifeq ($(RGB), 1)
IMAGE=$(CURDIR)/images/COCO_val2014_000000000641.ppm
else
IMAGE=$(CURDIR)/images/COCO_val2014_000000000641_gray.ppm
endif
io=host
QUANT_BITS=8
BUILD_DIR=BUILD
MODEL_SQ8=1
$(info Building GAP8 mode with $(QUANT_BITS) bit quantization)
MODEL_SUFFIX = _SQ8BIT
TRAINED_TFLITE_MODEL=model/trained_models/$(MODEL_PREFIX).tflite
include common/model_decl.mk
# Here we set the memory allocation for the generated kernels
# REMEMBER THAT THE L1 MEMORY ALLOCATION MUST INCLUDE SPACE
# FOR ALLOCATED STACKS!
CLUSTER_STACK_SIZE=6144
CLUSTER_SLAVE_STACK_SIZE=1024
ifeq '$(TARGET_CHIP_FAMILY)' 'GAP9'
TOTAL_STACK_SIZE=$(shell expr $(CLUSTER_STACK_SIZE) \+ $(CLUSTER_SLAVE_STACK_SIZE) \* 8)
FREQ_CL?=50
FREQ_FC?=50
MODEL_L1_MEMORY=$(shell expr 125000 \- $(TOTAL_STACK_SIZE))
MODEL_L2_MEMORY=950000
MODEL_L3_MEMORY=8388608
else
TOTAL_STACK_SIZE=$(shell expr $(CLUSTER_STACK_SIZE) \+ $(CLUSTER_SLAVE_STACK_SIZE) \* 7)
ifeq '$(TARGET_CHIP)' 'GAP8_V3'
FREQ_CL?=175
else
FREQ_CL?=50
endif
FREQ_FC?=250
MODEL_L1_MEMORY=$(shell expr 60000 \- $(TOTAL_STACK_SIZE))
MODEL_L2_MEMORY=200000
MODEL_L3_MEMORY=8388608
endif
FLASH_TYPE ?= DEFAULT
RAM_TYPE ?= DEFAULT
ifeq '$(FLASH_TYPE)' 'HYPER'
MODEL_L3_FLASH=AT_MEM_L3_HFLASH
else ifeq '$(FLASH_TYPE)' 'MRAM'
MODEL_L3_FLASH=AT_MEM_L3_MRAMFLASH
READFS_FLASH = target/chip/soc/mram
else ifeq '$(FLASH_TYPE)' 'QSPI'
MODEL_L3_FLASH=AT_MEM_L3_QSPIFLASH
READFS_FLASH = target/board/devices/spiflash
else ifeq '$(FLASH_TYPE)' 'OSPI'
MODEL_L3_FLASH=AT_MEM_L3_OSPIFLASH
else ifeq '$(FLASH_TYPE)' 'DEFAULT'
MODEL_L3_FLASH=AT_MEM_L3_DEFAULTFLASH
endif
ifeq '$(RAM_TYPE)' 'HYPER'
MODEL_L3_RAM=AT_MEM_L3_HRAM
else ifeq '$(RAM_TYPE)' 'QSPI'
MODEL_L3_RAM=AT_MEM_L3_QSPIRAM
else ifeq '$(RAM_TYPE)' 'OSPI'
MODEL_L3_RAM=AT_MEM_L3_OSPIRAM
else ifeq '$(RAM_TYPE)' 'DEFAULT'
MODEL_L3_RAM=AT_MEM_L3_DEFAULTRAM
endif
pulpChip = GAP
PULP_APP = vww_vehicle
APP = vww_vehicle
APP_SRCS += main.c $(MODEL_GEN_C) $(MODEL_COMMON_SRCS) $(CNN_LIB) BUILD_MODEL_SQ8BIT/Expression_Kernels.c
APP_CFLAGS += -g -O3 -mno-memcpy -fno-tree-loop-distribute-patterns
APP_CFLAGS += -I. -I$(MODEL_COMMON_INC) -I$(TILER_EMU_INC) -I$(TILER_INC) $(CNN_LIB_INCLUDE) -I$(MODEL_BUILD)
APP_CFLAGS += -DAT_MODEL_PREFIX=$(MODEL_PREFIX) $(MODEL_SIZE_CFLAGS)
APP_CFLAGS += -DSTACK_SIZE=$(CLUSTER_STACK_SIZE) -DSLAVE_STACK_SIZE=$(CLUSTER_SLAVE_STACK_SIZE)
APP_CFLAGS += -DAT_IMAGE=$(IMAGE) -DFREQ_FC=$(FREQ_FC) -DFREQ_CL=$(FREQ_CL)
APP_CFLAGS += -Wno-parentheses
# test on board
ifneq ($(DISABLE_DRIVERS), 1)
ifneq ($(platform), gvsoc)
APP_CFLAGS += -DHAVE_CAMERA -DSILENT #-DHAVE_LCD
endif
endif
ifeq ($(RGB), 1)
APP_CFLAGS += -DRGB
endif
READFS_FILES=$(abspath $(MODEL_TENSORS))
PLPBRIDGE_FLAGS += -f
# build depends on the model
build:: model
clean:: #clean_model
rm -rf $(MODEL_GEN_CLEAN)
include common/model_rules.mk
$(info APP_SRCS... $(APP_SRCS))
$(info APP_CFLAGS... $(APP_CFLAGS))
include $(RULES_DIR)/pmsis_rules.mk