• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (c) 2021 Bestechnic (Shanghai) Co., Ltd. All rights reserved.
2# Licensed under the Apache License, Version 2.0 (the "License");
3# you may not use this file except in compliance with the License.
4# You may obtain a copy of the License at
5#
6#     http://www.apache.org/licenses/LICENSE-2.0
7#
8# Unless required by applicable law or agreed to in writing, software
9# distributed under the License is distributed on an "AS IS" BASIS,
10# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11# See the License for the specific language governing permissions and
12# limitations under the License.
13cur_dir := $(dir $(lastword $(MAKEFILE_LIST)))
14
15obj-y :=
16
17ifeq ($(CP_BOOT), 1)
18obj-y += cp_code.o
19obj-y += cp_boot.o
20CFLAGS_cp_boot.o += -DFLASH_SIZE=$(FLASH_SIZE)
21endif
22obj-y += cp_ipc.o
23
24ccflags-y += -Inet/wifi -Inet/utils
25
26ifeq ($(NUTTX_BUILD),1)
27
28export CP_BIN_NAME ?= nuttx_cmcp
29$(obj)/cp_code.o : $(NUTTX_ROOT)/$(CP_BIN_NAME).bin
30AFLAGS_cp_code.o += -DCP_BIN_NAME=$(CP_BIN_NAME).bin -I$(NUTTX_ROOT)
31
32else
33
34export CP_BIN_NAME ?= cmcp
35$(obj)/cp_code.o : out/$(T)/$(CP_BIN_NAME).bin
36AFLAGS_cp_code.o += -DCP_BIN_NAME=$(CP_BIN_NAME).bin -Iout/$(T)
37out/$(T)/$(CP_BIN_NAME).bin : $(srctree)/out/$(CP_BIN_NAME)/$(CP_BIN_NAME).bin
38	$(call CMDCPFILE,$(srctree)/out/$(CP_BIN_NAME)/$(CP_BIN_NAME).bin,$(srctree)/$@)
39#	$(call CMDCPFILE,$(srctree)/out/$(CP_BIN_NAME)/$(CP_BIN_NAME).elf,$(srctree)/$(@:.bin=.elf))
40#	$(call CMDCPFILE,$(srctree)/out/$(CP_BIN_NAME)/$(CP_BIN_NAME).map,$(srctree)/$(@:.bin=.map))
41#	$(call CMDCPFILE,$(srctree)/out/$(CP_BIN_NAME)/$(CP_BIN_NAME).lst,$(srctree)/$(@:.bin=.lst))
42$(srctree)/out/$(CP_BIN_NAME)/$(CP_BIN_NAME).bin : FORCE
43	$(call echo-help,)
44	$(call echo-help,INFO    Please make sure DSP bin is up to date: out/$(CP_BIN_NAME)/$(CP_BIN_NAME).bin)
45# We cannot build $(CP_BIN_NAME) automatically here, because the env inherited by sub-make cannot be cleaned:
46# E.g., KBUILD_SRC, TC, CHIP_HAS_CP, ...
47	$(call echo-help,)
48
49endif
50
51