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. 13make_file := $(abspath $(lastword $(MAKEFILE_LIST))) 14os_path := $(dir $(make_file)) 15 16#LITEOS_SRCS += $(wildcard $(os_path)components/bounds_check/*.c) 17LITEOS_SRCS += $(wildcard $(os_path)kal/cmsis/*.c) 18 19ifeq ($(MODULE_KERNEL_STUB),1) 20subdir-ccflags-y += -DMODULE_KERNEL_STUB 21else 22ifeq ($(LPLAYER_NEED_POSIX),1) 23LITEOS_SRCS += $(wildcard $(os_path)kal/posix/src/*.c) 24ccflags-y += -DLPLAYER_NEED_POSIX 25endif 26LITEOS_SRCS += $(wildcard $(os_path)utils/*.c) 27LITEOS_SRCS += $(wildcard $(os_path)components/bounds_checking_function/src/*.c) 28LITEOS_SRCS += $(wildcard $(os_path)components/exchook/*.c) 29LITEOS_SRCS += $(wildcard $(os_path)components/cpup/*.c) 30LITEOS_SRCS += $(wildcard $(os_path)components/backtrace/*.c) 31LITEOS_SRCS += $(wildcard $(os_path)components/power/*.c) 32LITEOS_SRCS += $(wildcard $(os_path)kernel/src/*.c) 33LITEOS_SRCS += $(wildcard $(os_path)kernel/src/mm/*.c) 34 35# trustzone build 36ifeq ($(ARM_CMNS),1) 37LITEOS_SRCS += $(wildcard $(os_path)arch/arm/cortex-m33/gcc/TZ/non_secure/*.c) 38LITEOS_AS += $(wildcard $(os_path)arch/arm/cortex-m33/gcc/TZ/non_secure/*.S) 39LITEOS_SRCS += $(wildcard $(os_path)arch/arm/cortex-m33/gcc/TZ/secure/*.c) 40LITEOS_AS += $(wildcard $(os_path)arch/arm/cortex-m33/gcc/TZ/secure/*.S) 41else 42LITEOS_SRCS += $(wildcard $(os_path)arch/arm/cortex-m33/gcc/NTZ/*.c) 43LITEOS_AS += $(wildcard $(os_path)arch/arm/cortex-m33/gcc/NTZ/*.S) 44endif 45STRIP_SRCS_AS = $(subst $(os_path),,$(LITEOS_AS)) 46obj-y += $(patsubst %.S, %.o, $(STRIP_SRCS_AS)) 47endif 48 49STRIP_SRCS = $(subst $(os_path),,$(LITEOS_SRCS)) 50 51obj-y += $(patsubst %.c, %.o, $(STRIP_SRCS)) 52obj-y += board.o 53 54# include extern kernel header 55ifeq ($(MODULE_KERNEL_STUB_INC),1) 56EXTERN_ROOT_PATH ?= ./../../../../../ 57${info "EXTERN_ROOT_PATH:$(EXTERN_ROOT_PATH)"} 58INC_DIR = -I$(EXTERN_ROOT_PATH)kernel/liteos_m/kernel/include/ 59INC_DIR += -I$(EXTERN_ROOT_PATH)kernel/liteos_m/utils/ 60INC_DIR += -I$(EXTERN_ROOT_PATH)kernel/liteos_m/kernel/arch/include/ 61INC_DIR += -I$(EXTERN_ROOT_PATH)kernel/liteos_m/arch/include/ 62INC_DIR += -I$(EXTERN_ROOT_PATH)kernel/liteos_m/kernel/arch/arm/cortex-m33/gcc/NTZ/ 63INC_DIR += -I$(EXTERN_ROOT_PATH)kernel/liteos_m/arch/arm/cortex-m33/gcc/NTZ/ 64INC_DIR += -I$(EXTERN_ROOT_PATH)third_party/bounds_checking_function/include/ 65INC_DIR += -I$(EXTERN_ROOT_PATH)kernel/liteos_m/components/exchook/ 66INC_DIR += -I$(EXTERN_ROOT_PATH)kernel/liteos_m/components/backtrace/ 67INC_DIR += -I$(EXTERN_ROOT_PATH)kernel/liteos_m/arch/arm/common/ 68ccflags-y += $(INC_DIR) 69else 70INC_DIR = kernel/include 71# trustzone build 72ifeq ($(ARM_CMNS),1) 73INC_DIR += arch/arm/cortex-m33/gcc/TZ/non_secure/ 74INC_DIR += arch/arm/cortex-m33/gcc/TZ/secure/ 75else 76INC_DIR += arch/arm/cortex-m33/gcc/NTZ/ 77endif 78 79 80INC_DIR += arch/include 81INC_DIR += kal 82INC_DIR += kal/cmsis 83INC_DIR += utils 84INC_DIR += components/bounds_checking_function/include 85INC_DIR += components/exchook 86ifeq ($(LPLAYER_NEED_POSIX),1) 87INC_DIR += kal/posix/include/ 88INC_DIR += ../../../include/rtos/liteos/liteos_m/kal/posix/include 89endif 90INC_DIR += components/cpup 91INC_DIR += components/backtrace 92INC_DIR += components/power 93ccflags-y += $(addprefix -I${os_path},${INC_DIR}) 94endif 95 96ccflags-y += -I${os_path}../../../platform/hal/$(CHIP) 97 98AFLAGS_los_dispatch.o += -D__FPU_PRESENT=1 -D__FPU_USED=1 99AFLAGS_los_exc.o += -D__FPU_PRESENT=1 -D__FPU_USED=1 100