-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathconfig.mk
executable file
·239 lines (211 loc) · 8.77 KB
/
config.mk
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
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
#
# global config options
#
# ----------------------------------------------------------------------------
# config options
# ----------------------------------------------------------------------------
include $(ROOT_PATH)/chip.mk
# ----------------------------------------------------------------------------
# config symbols
# ----------------------------------------------------------------------------
PRJ_RAM_MAX_SIZE = $(CONFIG_CHIP_RAM_SIZE)
ifeq ($(CONFIG_BLE), y)
PRJ_BLE_RAM_SIZE = 16
else
PRJ_BLE_RAM_SIZE = 0
endif
ifeq ($(CONFIG_WLAN), y)
PRJ_IMAGE_NUM_WLAN = 3
ifeq ($(CONFIG_WLAN_SHARE_RAM), y)
ifeq ($(CONFIG_WLAN_SHARE_RAM_SIZE_16K), y)
PRJ_WLAN_SHARE_RAM_SIZE = 16
else ifeq ($(CONFIG_WLAN_SHARE_RAM_SIZE_32K), y)
PRJ_WLAN_SHARE_RAM_SIZE = 32
else ifeq ($(CONFIG_WLAN_SHARE_RAM_SIZE_64K), y)
PRJ_WLAN_SHARE_RAM_SIZE = 64
else ifeq ($(CONFIG_WLAN_SHARE_RAM_SIZE_96K), y)
PRJ_WLAN_SHARE_RAM_SIZE = 96
else ifeq ($(CONFIG_WLAN_SHARE_RAM_SIZE_128K), y)
PRJ_WLAN_SHARE_RAM_SIZE = 128
else
$(info ERROR:"select wlan share app sram size error!")
endif
else
PRJ_WLAN_SHARE_RAM_SIZE = 0
endif
else
PRJ_IMAGE_NUM_WLAN = 0
PRJ_WLAN_SHARE_RAM_SIZE = 0
endif
ifeq ($(CONFIG_XIP), y)
CONFIG_SYMBOLS +=-DPRJ_XIP_SIZE=8M
ifeq ($(CONFIG_TZ_XIP), y)
CONFIG_SYMBOLS +=-DPRJ_TZ_XIP_SIZE=$(CONFIG_TZ_XIP_SIZE)K
PRJ_IMAGE_NUM_XIP = 2
else
PRJ_IMAGE_NUM_XIP = 1
endif
else
CONFIG_SYMBOLS +=-DPRJ_XIP_SIZE=0K
PRJ_IMAGE_NUM_XIP = 0
endif
ifeq ($(CONFIG_PSRAM), y)
ifeq ($(CONFIG_TZ_PSRAM), y)
PRJ_IMAGE_NUM_PSRAM = 2
else ifeq ($(CONFIG_TRUSTZONE_BOOT), y)
PRJ_IMAGE_NUM_PSRAM = 2
else
CONFIG_TZ_PSRAM_SIZE = 0
PRJ_IMAGE_NUM_PSRAM = 1
endif
else
CONFIG_TZ_PSRAM_SIZE = 0
PRJ_IMAGE_NUM_PSRAM = 0
endif
PRJ_TZ_PSRAM_SIZE=${CONFIG_TZ_PSRAM_SIZE}
ifeq ($(CONFIG_PSRAM_CHIP_SQPI), y)
PRJ_ALL_PSRAM_SIZE = 2048
else ifeq ($(CONFIG_PSRAM_CHIP_OPI32), y)
PRJ_ALL_PSRAM_SIZE = 4096
else ifeq ($(CONFIG_PSRAM_CHIP_OPI64), y)
PRJ_ALL_PSRAM_SIZE = 8192
else
PRJ_ALL_PSRAM_SIZE = 0
endif
ifeq ($(CONFIG_CACHE_SIZE_8K), y)
PRJ_CACHE_RAM_SIZE = 8
else ifeq ($(CONFIG_CACHE_SIZE_16K), y)
PRJ_CACHE_RAM_SIZE = 16
else ifeq ($(CONFIG_CACHE_SIZE_32K), y)
PRJ_CACHE_RAM_SIZE = 32
else
PRJ_CACHE_RAM_SIZE = 0
endif
#0x00200000 ~ (0x00201000 - 1) used for ROM
PRJ_RAM_USE_ROM_SIZE = 4
PRJ_TZ_RAM_USE_ROM_SIZE = 1
ifeq ($(CONFIG_SECURE_BOOT), y)
CONFIG_SYMBOLS += -DPRJ_BOOT_CERT="\"boot_pubk_sign.bin\""
CONFIG_SYMBOLS += -DPRJ_IMAGE_BOOT_ATTR="\"0x5\""
else
CONFIG_SYMBOLS += -DPRJ_BOOT_CERT="\"null\""
CONFIG_SYMBOLS += -DPRJ_IMAGE_BOOT_ATTR="\"0x1\""
endif
PRJ_TZ_RAM_SIZE = ${CONFIG_TZ_RAM_SIZE}
ifeq ($(CONFIG_ROM)_$(CONFIG_CHIP_ARCH_VER), y_2)
$(info ERROR:"CHIP_ARCH_VER 2 not support ROM")
endif
PRJ_RAM_MAP_START = 0x00200000
PRJ_RAM_START = 0x00201000
ifeq ($(CONFIG_WLAN_SHARE_RAM), y)
PRJ_SRAM_SIZE = $(shell expr $(PRJ_RAM_MAX_SIZE) - 32 - $(PRJ_RAM_USE_ROM_SIZE) - 16 - $(PRJ_WLAN_SHARE_RAM_SIZE))
else
PRJ_SRAM_SIZE = $(shell expr $(PRJ_RAM_MAX_SIZE) - $(PRJ_CACHE_RAM_SIZE) - $(PRJ_RAM_USE_ROM_SIZE) - $(PRJ_BLE_RAM_SIZE))
endif
PRJ_PSRAM_MAP_START = 0x01400000
PRJ_TZ_PSRAM_MAP_START = 0x02000000
ifeq ($(CONFIG_FLASH_FS_IMG_PACK), y)
ifeq ($(CONFIG_LITTLE_FS), y)
CONFIG_SYMBOLS += -DPRJ_LITTLE_FS_START_ADDR="\"$(CONFIG_LITTLE_FS_START_ADDR)\""
else ifeq ($(CONFIG_SPIF_FS), y)
CONFIG_SYMBOLS += -DPRJ_SPIF_FS_START_ADDR="\"$(CONFIG_SPIF_FS_START_ADDR)\""
endif
endif
ifeq ($(CONFIG_CHIP_ARCH_VER), 2)
CONFIG_SYMBOLS += -DPRJ_IMAGE_APP_SRAM_OFFS="\"0x00201000\""
CONFIG_SYMBOLS += -DPRJ_IMAGE_APP_EP="\"0x00201101\""
PRJ_PSRAM_SIZE = $(PRJ_ALL_PSRAM_SIZE)
else ifeq ($(CONFIG_CHIP_ARCH_VER), 3)
ifeq ($(CONFIG_TRUSTZONE), y)
BOOT_TZ = "_tz"
# 32 - $(PRJ_RAM_USE_ROM_SIZE) - $(PRJ_TZ_RAM_USE_ROM_SIZE)
PRJ_IMAGE_NUM_TZ_SRAM = 2
CONFIG_SYMBOLS += -DPRJ_IMAGE_APP_SRAM_OFFS="\"0x00208000\""
CONFIG_SYMBOLS += -DPRJ_IMAGE_APP_EP="\"0x00208101\""
CONFIG_SYMBOLS += -DPRJ_IMAGE_TZ_API_SRAM_OFFS="\"0x00201400\""
CONFIG_SYMBOLS += -DPRJ_IMAGE_TZ_API_EP="\"0x00201501\""
PRJ_TZ_RAM_START = 0x00201400
PRJ_RAM_START = 0x00208000
PRJ_SRAM_SIZE = $(shell expr $(PRJ_RAM_MAX_SIZE) - $(PRJ_CACHE_RAM_SIZE) - $(PRJ_TZ_RAM_SIZE) - $(PRJ_RAM_USE_ROM_SIZE) - $(PRJ_TZ_RAM_USE_ROM_SIZE) - $(PRJ_BLE_RAM_SIZE))
PRJ_PSRAM_SIZE = $(shell expr $(PRJ_ALL_PSRAM_SIZE) - $(PRJ_TZ_PSRAM_SIZE))
PRJ_TZ_PSRAM_START = $(shell printf 0x%08x $(shell expr $(PRJ_PSRAM_SIZE) \* 1024))
else ifeq ($(CONFIG_TRUSTZONE_BOOT), y)
PRJ_PSRAM_SIZE = $(shell expr $(PRJ_ALL_PSRAM_SIZE) - $(PRJ_TZ_PSRAM_SIZE))
PRJ_TZ_PSRAM_START = $(shell printf 0x%08x $(shell expr $(PRJ_PSRAM_SIZE) \* 1024))
else
CONFIG_SYMBOLS += -DPRJ_IMAGE_APP_SRAM_OFFS="\"0x00201000\""
CONFIG_SYMBOLS += -DPRJ_IMAGE_APP_EP="\"0x00201101\""
PRJ_PSRAM_SIZE = $(PRJ_ALL_PSRAM_SIZE)
endif
endif
ifeq ($(CONFIG_CHIP_ARCH_VER), 2)
CONFIG_SYMBOLS += -DPRJ_IMAGE_BOOT_SRAM_OFFS="\"0x00250000\""
CONFIG_SYMBOLS += -DPRJ_IMAGE_BOOT_EP="\"0x00250101\""
else ifeq ($(CONFIG_CHIP_ARCH_VER), 3)
CONFIG_SYMBOLS += -DPRJ_IMAGE_BOOT_SRAM_OFFS="\"0x00230000\""
CONFIG_SYMBOLS += -DPRJ_IMAGE_BOOT_EP="\"0x00230101\""
endif
ifeq ($(CONFIG_TZ_CODE_ENCRYPT), y)
CONFIG_SYMBOLS += -DPRJ_IMAGE_TZ_ATTR="\"0x2d\""
CONFIG_SYMBOLS += -DPRJ_IMAGE_TZ_XIP_ATTR="\"0x2e\""
CONFIG_SYMBOLS += -DPRJ_IMAGE_TZ_PSRAM_ATTR="\"0x2d\""
else
CONFIG_SYMBOLS += -DPRJ_IMAGE_TZ_ATTR="\"0x25\""
CONFIG_SYMBOLS += -DPRJ_IMAGE_TZ_XIP_ATTR="\"0x26\""
CONFIG_SYMBOLS += -DPRJ_IMAGE_TZ_PSRAM_ATTR="\"0x25\""
endif
PRJ_IMAGE_APP_ATTR := 0x1
PRJ_IMAGE_APP_XIP_ATTR := 0x2
PRJ_IMAGE_APP_PSRAM_ATTR := 0x1
ifeq ($(CONFIG_SECURE_BOOT), y)
CONFIG_SYMBOLS += -DPRJ_APP_BIN_CERT="\"app_sign.bin\""
PRJ_IMAGE_APP_ATTR := $(shell printf 0x%x $$(($(PRJ_IMAGE_APP_ATTR) | 0x4)))
else
CONFIG_SYMBOLS += -DPRJ_APP_BIN_CERT="\"null\""
endif
ifeq ($(CONFIG_SECURE_BOOT)_$(CONFIG_APP_XIP_BIN_SIGN), y_y)
CONFIG_SYMBOLS += -DPRJ_APP_XIP_BIN_CERT="\"app_xip_sign.bin\""
PRJ_IMAGE_APP_XIP_ATTR := $(shell printf 0x%x $$(($(PRJ_IMAGE_APP_XIP_ATTR) | 0x4)))
else
CONFIG_SYMBOLS += -DPRJ_APP_XIP_BIN_CERT="\"null\""
endif
ifeq ($(CONFIG_SECURE_BOOT)_$(CONFIG_APP_PSRAM_BIN_SIGN), y_y)
CONFIG_SYMBOLS += -DPRJ_APP_PSRAM_BIN_CERT="\"app_psram_sign.bin\""
PRJ_IMAGE_APP_PSRAM_ATTR := $(shell printf 0x%x $$(($(PRJ_IMAGE_APP_PSRAM_ATTR) | 0x4)))
else
CONFIG_SYMBOLS += -DPRJ_APP_PSRAM_BIN_CERT="\"null\""
endif
ifeq ($(CONFIG_FLASH_CRYPTO)_$(CONFIG_SRAM_BIN_ENCRYPT), y_y)
PRJ_IMAGE_APP_ATTR := $(shell printf 0x%x $$(($(PRJ_IMAGE_APP_ATTR) | 0x8)))
endif
ifeq ($(CONFIG_FLASH_CRYPTO)_$(CONFIG_APP_XIP_ENCRYPT), y_y)
PRJ_IMAGE_APP_XIP_ATTR := $(shell printf 0x%x $$(($(PRJ_IMAGE_APP_XIP_ATTR) | 0x8)))
endif
ifeq ($(CONFIG_FLASH_CRYPTO)_$(CONFIG_APP_PSRAM_ENCRYPT), y_y)
PRJ_IMAGE_APP_PSRAM_ATTR := $(shell printf 0x%x $$(($(PRJ_IMAGE_APP_PSRAM_ATTR) | 0x8)))
endif
CONFIG_SYMBOLS += -DPRJ_IMAGE_APP_ATTR="\"$(PRJ_IMAGE_APP_ATTR)\""
CONFIG_SYMBOLS += -DPRJ_IMAGE_APP_XIP_ATTR="\"$(PRJ_IMAGE_APP_XIP_ATTR)\""
CONFIG_SYMBOLS += -DPRJ_IMAGE_APP_PSRAM_ATTR="\"$(PRJ_IMAGE_APP_PSRAM_ATTR)\""
PRJ_IMAGE_NUM=$(shell expr $(PRJ_IMAGE_NUM_WLAN) + $(PRJ_IMAGE_NUM_XIP) + $(PRJ_IMAGE_NUM_PSRAM) + $(PRJ_IMAGE_NUM_TZ_SRAM) + 2)
CONFIG_SYMBOLS += -DCONFIG_RAM_START=$(PRJ_RAM_START)
CONFIG_SYMBOLS += -DPRJ_RAM_SIZE=$(PRJ_SRAM_SIZE)K
CONFIG_SYMBOLS += -DPRJ_PSRAM_START_OFFS="\"$(PRJ_PSRAM_MAP_START)\""
CONFIG_SYMBOLS += -DCONFIG_PSRAM_START=$(PRJ_PSRAM_MAP_START)
CONFIG_SYMBOLS += -DPRJ_PSRAM_SIZE=$(PRJ_PSRAM_SIZE)K
ifeq ($(CONFIG_TRUSTZONE), y)
CONFIG_SYMBOLS += -DCONFIG_TZ_RAM_START=$(PRJ_TZ_RAM_START)
CONFIG_SYMBOLS += -DPRJ_TZ_RAM_SIZE=$(PRJ_TZ_RAM_SIZE)K
CONFIG_SYMBOLS += -DPRJ_TZ_PARAMS_SRAM_OFFS="\"$(shell printf 0x%08x $(shell expr $(shell printf %d $(PRJ_RAM_MAP_START)) + $(PRJ_RAM_MAX_SIZE) \* 1024 - $(PRJ_BLE_RAM_SIZE) \* 1024 - 256))\""
CONFIG_SYMBOLS += -DCONFIG_TZ_PARAMS_REL_EP=$(shell printf 0x%08x $(shell expr $(shell printf %d $(PRJ_RAM_MAP_START)) + $(PRJ_RAM_MAX_SIZE) \* 1024 - $(PRJ_BLE_RAM_SIZE) \* 1024 - 256))
CONFIG_SYMBOLS += -DCONFIG_TZ_NSC_START=$(shell printf 0x%08x $(shell expr $(shell printf %d $(PRJ_TZ_RAM_START)) + $(PRJ_TZ_RAM_SIZE) \* 1024 - 1024))
CONFIG_SYMBOLS += -DCONFIG_TZ_PSRAM_START_VMA=$(PRJ_TZ_PSRAM_MAP_START)
CONFIG_SYMBOLS += -DPRJ_TZ_PSRAM_START_OFFS="\"$(PRJ_TZ_PSRAM_MAP_START)\""
CONFIG_SYMBOLS += -DPRJ_TZ_PSRAM_SIZE=$(PRJ_TZ_PSRAM_SIZE)K
endif
ifeq ($(CONFIG_TRUSTZONE_BOOT), y)
CONFIG_SYMBOLS += -DPRJ_TZ_PSRAM_START_PHY=$(PRJ_TZ_PSRAM_START)
CONFIG_SYMBOLS += -DPRJ_TZ_PSRAM_SIZE_BYTE=$(shell printf 0x%08x $(shell expr $(PRJ_TZ_PSRAM_SIZE) \* 1024))
endif
CONFIG_SYMBOLS += -DPRJ_IMAGE_BOOT_BIN="\"boot_$(CONFIG_HOSC_TYPE)M$(BOOT_TZ).bin\""
CONFIG_SYMBOLS += -DPRJ_IMAGE_SYS_SDD_BIN="\"sys_sdd_$(CONFIG_HOSC_TYPE)M.bin\""