add IPL
This commit is contained in:
734
IPL/Customer/Mobis/Gen4_ICUMX_Loader/dos.mk
Normal file
734
IPL/Customer/Mobis/Gen4_ICUMX_Loader/dos.mk
Normal file
@@ -0,0 +1,734 @@
|
||||
#/*******************************************************************************
|
||||
# * DISCLAIMER
|
||||
# * This software is supplied by Renesas Electronics Corporation and is only
|
||||
# * intended for use with Renesas products. No other uses are authorized. This
|
||||
# * software is owned by Renesas Electronics Corporation and is protected under
|
||||
# * all applicable laws, including copyright laws.
|
||||
# * THIS SOFTWARE IS PROVIDED "AS IS" AND RENESAS MAKES NO WARRANTIES REGARDING
|
||||
# * THIS SOFTWARE, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING BUT NOT
|
||||
# * LIMITED TO WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE
|
||||
# * AND NON-INFRINGEMENT. ALL SUCH WARRANTIES ARE EXPRESSLY DISCLAIMED.
|
||||
# * TO THE MAXIMUM EXTENT PERMITTED NOT PROHIBITED BY LAW, NEITHER RENESAS
|
||||
# * ELECTRONICS CORPORATION NOR ANY OF ITS AFFILIATED COMPANIES SHALL BE LIABLE
|
||||
# * FOR ANY DIRECT, INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES FOR
|
||||
# * ANY REASON RELATED TO THIS SOFTWARE, EVEN IF RENESAS OR ITS AFFILIATES HAVE
|
||||
# * BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
# * Renesas reserves the right, without notice, to make changes to this software
|
||||
# * and to discontinue the availability of this software. By using this software,
|
||||
# * you agree to the additional terms and conditions found by accessing the
|
||||
# * following link:
|
||||
# * http://www.renesas.com/disclaimer
|
||||
# * Copyright 2022-2025 Renesas Electronics Corporation All rights reserved.
|
||||
# *******************************************************************************/
|
||||
#
|
||||
# *******************************************************************************
|
||||
# * DESCRIPTION : makefile for Loader
|
||||
# ******************************************************************************
|
||||
|
||||
define add_define
|
||||
DEFINES += -D$(1)$(if $(value $(1)),=$(value $(1)),)
|
||||
endef
|
||||
|
||||
INCLUDE_DIR = -Iinclude \
|
||||
-Iip/ddr
|
||||
|
||||
OUTDIR := build
|
||||
|
||||
# LSI setting common define
|
||||
RCAR_S4 := 0
|
||||
RCAR_V4H := 1
|
||||
RCAR_V4M := 2
|
||||
$(eval $(call add_define,RCAR_S4))
|
||||
$(eval $(call add_define,RCAR_V4H))
|
||||
$(eval $(call add_define,RCAR_V4M))
|
||||
ifneq ("$(FORCE_115200)", "")
|
||||
$(eval $(call add_define,FORCE_115200))
|
||||
endif
|
||||
|
||||
#/* Select LSI("S4" or "V4H" or "V4M" )********************************
|
||||
ifeq ("$(LSI)", "")
|
||||
LSI = S4
|
||||
endif
|
||||
|
||||
ifeq (${LSI},S4)
|
||||
RCAR_LSI:=${RCAR_S4}
|
||||
DIR_NAME_SA9 = s4
|
||||
OBJ_FILE += loader/loader_main_s4.o \
|
||||
cnf_tbl/cnf_tbl_s4.o \
|
||||
ip/qos/qos.o \
|
||||
ip/rtvram/rtvram.o \
|
||||
ip/ddr/s4/lpddr4x/ecc_enable_s4.o
|
||||
INCLUDE_DIR += -Imcu
|
||||
include ip/ddr/ddr.mk
|
||||
else ifeq (${LSI},V4H)
|
||||
RCAR_LSI:=${RCAR_V4H}
|
||||
DIR_NAME_SA9 = v4h
|
||||
OBJ_FILE += loader/loader_main_v4h.o \
|
||||
ip/fcpr/fcpr.o \
|
||||
cnf_tbl/cnf_tbl_v4h.o \
|
||||
common/crc32.o \
|
||||
image_load/android_ab.o \
|
||||
ip/ddr/v4h/lpddr5/ecc_enable_v4h.o \
|
||||
ip/ddr/v4h/lpddr5/ecm_enable_v4h.o
|
||||
else ifeq (${LSI},V4M)
|
||||
RCAR_LSI:=${RCAR_V4M}
|
||||
DIR_NAME_SA9 = v4m
|
||||
OBJ_FILE += loader/loader_main_v4m.o \
|
||||
ip/fcpr/fcpr.o \
|
||||
cnf_tbl/cnf_tbl_v4m.o \
|
||||
ip/sysc/sysc.o \
|
||||
ip/avs/avs.o \
|
||||
ip/i2c/i2c.o \
|
||||
ip/ddr/v4m/lpddr5/ecc_enable_v4m.o \
|
||||
ip/ddr/v4m/lpddr5/ecm_enable_v4m.o
|
||||
else
|
||||
$(error "Error: ${LSI} is not supported.")
|
||||
endif
|
||||
$(eval $(call add_define,RCAR_LSI))
|
||||
|
||||
# timing measurement
|
||||
ifeq ("$(MEASURE_TIME)", "")
|
||||
MEASURE_TIME = 0
|
||||
else
|
||||
$(eval $(call add_define,MEASURE_TIME))
|
||||
# Set log level to Error, so we dont waste time with unnecessary prints
|
||||
LOG_LEVEL := 1
|
||||
OBJ_FILE += common/scmt_checkpoint.o \
|
||||
common/timer/scmt.o
|
||||
endif
|
||||
ifeq ("$(MEASURE_TIME_NOPRINT)", "")
|
||||
MEASURE_TIME_NOPRINT = 0
|
||||
else
|
||||
$(eval $(call add_define,MEASURE_TIME_NOPRINT))
|
||||
endif
|
||||
|
||||
###################################################
|
||||
|
||||
#output file name
|
||||
FILE_NAME = icumx_loader
|
||||
FILE_NAME_SA0 = bootparam_sa0
|
||||
FILE_NAME_SA9 = cert_header_sa9
|
||||
FILE_NAME_TFMV_TBL = tfmv_ver_tbl
|
||||
FILE_NAME_NTFMV_TBL = ntfmv_ver_tbl
|
||||
|
||||
OUTPUT_FILE = $(FILE_NAME).elf
|
||||
OUTPUT_FILE_SA0 = $(FILE_NAME_SA0).elf
|
||||
OUTPUT_FILE_SA9 = $(FILE_NAME_SA9).elf
|
||||
OUTPUT_FILE_TFMV_TBL = $(FILE_NAME_TFMV_TBL).elf
|
||||
OUTPUT_FILE_NTFMV_TBL = $(FILE_NAME_NTFMV_TBL).elf
|
||||
|
||||
#object file name
|
||||
OBJ_FILE += cpu_on/cpu_on.o \
|
||||
common/log/log.o \
|
||||
common/log/scif.o \
|
||||
common/timer/micro_wait.o \
|
||||
image_load/image_load.o \
|
||||
intc/intc.o \
|
||||
intc/vecttbl.o \
|
||||
intc/vect_set.o \
|
||||
ip/ip_control.o \
|
||||
ip/cpg/cpg.o \
|
||||
ip/emmc/emmc_boot.o \
|
||||
ip/wdt/wdt.o \
|
||||
loader/loader.o \
|
||||
loader/loader_main_common.o \
|
||||
protect/ram_protection.o \
|
||||
protect/region_id.o \
|
||||
protect/stack_protect.o \
|
||||
remap/remap.o \
|
||||
rom_api/rom_api.o
|
||||
|
||||
OBJ_FILE_SA0 = tools/dummy_create/sa0.o
|
||||
OBJ_FILE_SA9 = tools/dummy_create/$(DIR_NAME_SA9)/sa9.o
|
||||
OBJ_FILE_TFMV_TBL = tools/sw_min_ver_tbl/tfmv_ver_tbl.o
|
||||
OBJ_FILE_NTFMV_TBL = tools/sw_min_ver_tbl/ntfmv_ver_tbl.o
|
||||
|
||||
#linker script name
|
||||
ifeq (${LSI},V4M)
|
||||
MEMORY_DEF = loader/icumx_loader_v4m.ld
|
||||
else
|
||||
MEMORY_DEF = loader/icumx_loader.ld
|
||||
endif
|
||||
|
||||
MEMORY_DEF_SA0 = tools/dummy_create/sa0.ld
|
||||
MEMORY_DEF_SA9 = tools/dummy_create/$(DIR_NAME_SA9)/sa9.ld
|
||||
MEMORY_DEF_TFMV_TBL = tools/sw_min_ver_tbl/tfmv_ver_tbl.ld
|
||||
MEMORY_DEF_NTFMV_TBL = tools/sw_min_ver_tbl/ntfmv_ver_tbl.ld
|
||||
|
||||
###################################################
|
||||
|
||||
# Debug build
|
||||
DEBUG:=0
|
||||
|
||||
# Process DEBUG flag
|
||||
$(eval $(call assert_boolean,DEBUG))
|
||||
$(eval $(call add_define,DEBUG))
|
||||
ifeq (${DEBUG},0)
|
||||
$(eval $(call add_define,NDEBUG))
|
||||
CFLAGS += -Onone
|
||||
else
|
||||
ASFLAGS += -G -dwarf2
|
||||
CFLAGS += -G -dwarf2 -Odebug
|
||||
endif
|
||||
|
||||
# booting performance check
|
||||
ifneq ("$(WDT_RESET)", "")
|
||||
$(eval $(call add_define,WDT_RESET))
|
||||
endif
|
||||
|
||||
# Process STRICT_AB_BOOTING flag
|
||||
ifneq ("$(STRICT_AB_BOOTING)", "")
|
||||
$(eval $(call add_define,STRICT_AB_BOOTING))
|
||||
endif
|
||||
|
||||
# booting performance check
|
||||
ifeq ("$(BOOT_TIME_CHECK)", "")
|
||||
BOOT_TIME_CHECK = 0
|
||||
endif
|
||||
$(eval $(call add_define,BOOT_TIME_CHECK))
|
||||
OBJ_FILE += ip/gpio/gpio.o
|
||||
|
||||
# MISRA Option
|
||||
#------ MISRA ------
|
||||
ifndef MISRA
|
||||
MISRA := MANDATORY
|
||||
endif
|
||||
ifeq ("$(MISRA)", "DISABLE")
|
||||
MISRA_OPTION = DISABLE
|
||||
else ifeq ("$(MISRA)", "FULL")
|
||||
MISRA_OPTION = FULL
|
||||
else ifeq ("$(MISRA)", "MANDATORY")
|
||||
MISRA_OPTION = MANDATORY
|
||||
else ifeq ("$(MISRA)", "REQUIRED")
|
||||
MISRA_OPTION = REQUIRED
|
||||
endif
|
||||
CFLAGS_MISRA_FULL = \
|
||||
--misra_adv=warn \
|
||||
--misra_req=warn \
|
||||
--misra_mand=warn \
|
||||
--no_misra_runtime \
|
||||
--misra_2012=all,-R1.1 # MISRA 2012 Rule 1.1 not allowed with non-strict -c99 or later
|
||||
CFLAGS_MISRA_REQUIRED = \
|
||||
--misra_adv=silent \
|
||||
--misra_req=warn \
|
||||
--misra_mand=warn \
|
||||
--no_misra_runtime \
|
||||
--misra_2012=all,-R1.1 # MISRA 2012 Rule 1.1 not allowed with non-strict -c99 or later
|
||||
CFLAGS_MISRA_MANDATORY = \
|
||||
--misra_adv=silent \
|
||||
--misra_req=silent \
|
||||
--misra_mand=warn \
|
||||
--no_misra_runtime \
|
||||
--misra_2012=all,-R1.1,-R3.1 # MISRA 2012 Rule 1.1 not allowed with non-strict -c99 or later
|
||||
# MISRA 2012 Rule 3.1 is confirmed with static analysis
|
||||
ifeq ("$(MISRA_OPTION)", "FULL")
|
||||
CFLAGS += $(CFLAGS_MISRA_FULL)
|
||||
else ifeq ("$(MISRA)", "REQUIRED")
|
||||
CFLAGS += $(CFLAGS_MISRA_REQUIRED)
|
||||
else ifeq ("$(MISRA)", "MANDATORY")
|
||||
CFLAGS += $(CFLAGS_MISRA_MANDATORY)
|
||||
endif
|
||||
|
||||
# Process LOG_LEVEL
|
||||
ifndef LOG_LEVEL
|
||||
LOG_LEVEL := 2
|
||||
endif
|
||||
$(eval $(call add_define,LOG_LEVEL))
|
||||
ifeq (${LOG_LEVEL},0)
|
||||
LDFLAGS += -nostdlib
|
||||
endif
|
||||
|
||||
# Process SET_FCPR_PARAM flag
|
||||
# 0:Disable, 1:Enable (Support V4H / V4M Linux OS)
|
||||
ifeq ($(filter ${LSI},V4H V4M),${LSI})
|
||||
ifndef SET_FCPR_PARAM
|
||||
SET_FCPR_PARAM := 0
|
||||
$(eval $(call add_define,SET_FCPR_PARAM))
|
||||
else
|
||||
ifeq (${SET_FCPR_PARAM},0)
|
||||
$(eval $(call add_define,SET_FCPR_PARAM))
|
||||
else ifeq (${SET_FCPR_PARAM},1)
|
||||
$(eval $(call add_define,SET_FCPR_PARAM))
|
||||
else
|
||||
$(error "Error:SET_FCPR_PARAM=${SET_FCPR_PARAM} is not supported.")
|
||||
endif
|
||||
endif
|
||||
else
|
||||
SET_FCPR_PARAM := 0
|
||||
$(eval $(call add_define,SET_FCPR_PARAM))
|
||||
endif
|
||||
|
||||
# Process BOOT_MCU flag (S4 only)
|
||||
# 0:None, 1:G4MH, 2:Reserved, 3:G4MH+ICUMH
|
||||
ifeq (${LSI},S4)
|
||||
ifndef BOOT_MCU
|
||||
BOOT_MCU :=3
|
||||
$(eval $(call add_define,BOOT_MCU))
|
||||
else
|
||||
ifeq (${BOOT_MCU},0)
|
||||
$(eval $(call add_define,BOOT_MCU))
|
||||
else ifeq (${BOOT_MCU},1)
|
||||
$(eval $(call add_define,BOOT_MCU))
|
||||
else ifeq (${BOOT_MCU},2)
|
||||
$(eval $(call add_define,BOOT_MCU))
|
||||
else ifeq (${BOOT_MCU},3)
|
||||
$(eval $(call add_define,BOOT_MCU))
|
||||
else
|
||||
$(error "Error:BOOT_MCU=${BOOT_MCU} is not supported.")
|
||||
endif
|
||||
endif
|
||||
else
|
||||
BOOT_MCU :=0
|
||||
$(eval $(call add_define,BOOT_MCU))
|
||||
endif
|
||||
|
||||
ifneq (${BOOT_MCU},0)
|
||||
OBJ_FILE += mcu/cpu_on_for_mcu.o \
|
||||
mcu/sdmac.o \
|
||||
mcu/loader_main_mcu.o \
|
||||
mcu/image_load_for_mcu.o \
|
||||
mcu/codesram_ecc.o
|
||||
endif
|
||||
|
||||
# Process RTVRAM_EXTEND flag
|
||||
ifeq (${LSI},S4)
|
||||
ifndef RTVRAM_EXTEND
|
||||
RTVRAM_EXTEND := 1
|
||||
$(eval $(call add_define,RTVRAM_EXTEND))
|
||||
else
|
||||
ifeq (${RTVRAM_EXTEND},0)
|
||||
$(eval $(call add_define,RTVRAM_EXTEND))
|
||||
else ifeq (${RTVRAM_EXTEND},1)
|
||||
$(eval $(call add_define,RTVRAM_EXTEND))
|
||||
else
|
||||
$(error "Error:RTVRAM_EXTEND=${RTVRAM_EXTEND} is not supported.")
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
# Process QSPI_DDR_MODE flag
|
||||
# 0:SDR, 1:DDR
|
||||
ifndef QSPI_DDR_MODE
|
||||
QSPI_DDR_MODE := 0
|
||||
$(eval $(call add_define,QSPI_DDR_MODE))
|
||||
else
|
||||
ifeq (${QSPI_DDR_MODE},0)
|
||||
$(eval $(call add_define,QSPI_DDR_MODE))
|
||||
else ifeq (${QSPI_DDR_MODE},1)
|
||||
$(eval $(call add_define,QSPI_DDR_MODE))
|
||||
else
|
||||
$(error "Error:QSPI_DDR_MODE=${QSPI_DDR_MODE} is not supported.")
|
||||
endif
|
||||
endif
|
||||
|
||||
# RCAR_QSPI_DDR_DUMMY_CYCLE
|
||||
ifndef RCAR_QSPI_DDR_DUMMY_CYCLE
|
||||
RCAR_QSPI_DDR_DUMMY_CYCLE := 9
|
||||
endif
|
||||
$(eval $(call add_define,RCAR_QSPI_DDR_DUMMY_CYCLE))
|
||||
|
||||
# Process RCAR_SA9_TYPE flag
|
||||
# 0:Flash, 1:eMMC
|
||||
ifeq (${LSI},S4)
|
||||
ifndef RCAR_SA9_TYPE
|
||||
RCAR_SA9_TYPE := 0
|
||||
$(eval $(call add_define,RCAR_SA9_TYPE))
|
||||
else
|
||||
ifeq (${RCAR_SA9_TYPE},0)
|
||||
$(eval $(call add_define,RCAR_SA9_TYPE))
|
||||
else ifeq (${RCAR_SA9_TYPE},1)
|
||||
$(eval $(call add_define,RCAR_SA9_TYPE))
|
||||
else
|
||||
$(error "Error:RCAR_SA9_TYPE=${RCAR_SA9_TYPE} is not supported.")
|
||||
endif
|
||||
endif
|
||||
else ifeq ($(filter ${LSI},V4H V4M),${LSI})
|
||||
RCAR_SA9_TYPE := 0
|
||||
$(eval $(call add_define,RCAR_SA9_TYPE))
|
||||
endif
|
||||
|
||||
|
||||
ifeq (${RCAR_SA9_TYPE},1)
|
||||
OBJ_FILE += image_load/image_load_emmc.o \
|
||||
ip/emmc/emmc_cmd.o \
|
||||
ip/emmc/emmc_init.o \
|
||||
ip/emmc/emmc_interrupt.o \
|
||||
ip/emmc/emmc_mount.o \
|
||||
ip/emmc/emmc_multiboot.o \
|
||||
ip/emmc/emmc_read.o \
|
||||
ip/emmc/emmc_utility.o
|
||||
else ifeq (${RCAR_SA9_TYPE},0)
|
||||
OBJ_FILE += image_load/image_load_flash.o \
|
||||
ip/dma/dma.o \
|
||||
ip/rpc/rpc.o \
|
||||
ip/rpc/qspi_xdr_mode.o \
|
||||
ip/rpc/dma2.o \
|
||||
ip/rpc/rpcqspidrv.o \
|
||||
ip/rpc/spiflash2drv.o \
|
||||
ip/mfis/mfis.o
|
||||
endif
|
||||
|
||||
# Process CA_LOAD_TYPE flag
|
||||
# 0:CA Loader 1:BL31 (or Secure Monitor)
|
||||
ifeq (${LSI},S4)
|
||||
ifndef CA_LOAD_TYPE
|
||||
CA_LOAD_TYPE := 0
|
||||
$(eval $(call add_define,CA_LOAD_TYPE))
|
||||
else
|
||||
ifeq (${CA_LOAD_TYPE},0)
|
||||
$(eval $(call add_define,CA_LOAD_TYPE))
|
||||
else ifeq (${CA_LOAD_TYPE},1)
|
||||
$(eval $(call add_define,CA_LOAD_TYPE))
|
||||
else
|
||||
$(error "Error:CA_LOAD_TYPE=${CA_LOAD_TYPE} is not supported.")
|
||||
endif
|
||||
endif
|
||||
else ifeq ($(filter ${LSI},V4H V4M),${LSI})
|
||||
CA_LOAD_TYPE := 0
|
||||
$(eval $(call add_define,CA_LOAD_TYPE))
|
||||
endif
|
||||
|
||||
ifeq (${RCAR_SA9_TYPE},1)
|
||||
ifeq (${CA_LOAD_TYPE},0)
|
||||
$(error "Error:RCAR_SA9_TYPE=1 and CA_LOAD_TYPE=0 is not supported.")
|
||||
endif
|
||||
endif
|
||||
|
||||
# Process MCU_SECURE_BOOT flag (S4 only)
|
||||
ifndef MCU_SECURE_BOOT
|
||||
MCU_SECURE_BOOT := 0
|
||||
$(eval $(call add_define,MCU_SECURE_BOOT))
|
||||
else
|
||||
ifeq (${MCU_SECURE_BOOT},0)
|
||||
$(eval $(call add_define,MCU_SECURE_BOOT))
|
||||
else ifeq (${MCU_SECURE_BOOT},1)
|
||||
ifeq (${BOOT_MCU},0)
|
||||
$(error "Error:MCU_SECURE_BOOT=${MCU_SECURE_BOOT} and BOOT_MCU=${BOOT_MCU} is not supported.")
|
||||
else
|
||||
$(eval $(call add_define,MCU_SECURE_BOOT))
|
||||
endif
|
||||
else
|
||||
$(error "Error:MCU_SECURE_BOOT=${MCU_SECURE_BOOT} is not supported.")
|
||||
endif
|
||||
endif
|
||||
|
||||
# Process SW_VERSION_CHECK flag
|
||||
# 0:Disable 1:Enable
|
||||
ifndef SW_VERSION_CHECK
|
||||
SW_VERSION_CHECK := 0
|
||||
$(eval $(call add_define,SW_VERSION_CHECK))
|
||||
else
|
||||
ifeq (${SW_VERSION_CHECK},0)
|
||||
$(eval $(call add_define,SW_VERSION_CHECK))
|
||||
else ifeq (${SW_VERSION_CHECK},1)
|
||||
$(eval $(call add_define,SW_VERSION_CHECK))
|
||||
else
|
||||
$(error "Error:SW_VERSION_CHECK=${SW_VERSION_CHECK} is not supported.")
|
||||
endif
|
||||
endif
|
||||
|
||||
# Process access protection flag
|
||||
# 0:Disable 1:Enable
|
||||
ifndef ACC_PROT_ENABLE
|
||||
ACC_PROT_ENABLE := 0
|
||||
$(eval $(call add_define,ACC_PROT_ENABLE))
|
||||
else
|
||||
ifeq (${ACC_PROT_ENABLE},0)
|
||||
$(eval $(call add_define,ACC_PROT_ENABLE))
|
||||
else ifeq (${ACC_PROT_ENABLE},1)
|
||||
$(eval $(call add_define,ACC_PROT_ENABLE))
|
||||
else
|
||||
$(error "Error:ACC_PROT_ENABLE=${ACC_PROT_ENABLE} is not supported.")
|
||||
endif
|
||||
endif
|
||||
|
||||
ifeq (${MCU_SECURE_BOOT},1)
|
||||
include mcu_secureboot/mcu_secureboot.mk
|
||||
endif
|
||||
|
||||
# Process ADD_HOTPLUG_MAGIC flag
|
||||
ifndef ADD_HOTPLUG_MAGIC
|
||||
ADD_HOTPLUG_MAGIC := 0
|
||||
$(eval $(call add_define,ADD_HOTPLUG_MAGIC))
|
||||
else
|
||||
ifeq (${ADD_HOTPLUG_MAGIC},0)
|
||||
$(eval $(call add_define,ADD_HOTPLUG_MAGIC))
|
||||
else ifeq (${ADD_HOTPLUG_MAGIC},1)
|
||||
$(eval $(call add_define,ADD_HOTPLUG_MAGIC))
|
||||
else
|
||||
$(error "Error:ADD_HOTPLUG_MAGIC=${ADD_HOTPLUG_MAGIC} is not supported.")
|
||||
endif
|
||||
endif
|
||||
|
||||
# Process STACK_PROTECT flag
|
||||
ifndef STACK_PROTECT
|
||||
STACK_PROTECT := 0
|
||||
$(eval $(call add_define,STACK_PROTECT))
|
||||
else
|
||||
ifeq (${STACK_PROTECT},0)
|
||||
$(eval $(call add_define,STACK_PROTECT))
|
||||
else ifeq (${STACK_PROTECT},1)
|
||||
$(eval $(call add_define,STACK_PROTECT))
|
||||
CFLAGS += -stack_protector
|
||||
else
|
||||
$(error "Error:STACK_PROTECT=${STACK_PROTECT} is not supported.")
|
||||
endif
|
||||
endif
|
||||
|
||||
# Process RTOS_LOAD_NUM flag
|
||||
# 1:RTOS#0 only 3:RTOS#0,#1,#2
|
||||
ifndef RTOS_LOAD_NUM
|
||||
RTOS_LOAD_NUM := 1
|
||||
$(eval $(call add_define,RTOS_LOAD_NUM))
|
||||
else
|
||||
ifeq (${RTOS_LOAD_NUM},1)
|
||||
$(eval $(call add_define,RTOS_LOAD_NUM))
|
||||
else ifeq (${RTOS_LOAD_NUM},3)
|
||||
$(eval $(call add_define,RTOS_LOAD_NUM))
|
||||
else
|
||||
$(error "Error:RTOS_LOAD_NUM=${RTOS_LOAD_NUM} is not supported.")
|
||||
endif
|
||||
endif
|
||||
|
||||
# Process OPTEE_LOAD_ENABLE flag
|
||||
ifeq ($(filter ${LSI},V4H V4M),${LSI})
|
||||
ifndef OPTEE_LOAD_ENABLE
|
||||
OPTEE_LOAD_ENABLE := 1
|
||||
$(eval $(call add_define,OPTEE_LOAD_ENABLE))
|
||||
else
|
||||
ifeq (${OPTEE_LOAD_ENABLE},0)
|
||||
$(eval $(call add_define,OPTEE_LOAD_ENABLE))
|
||||
else ifeq (${OPTEE_LOAD_ENABLE},1)
|
||||
$(eval $(call add_define,OPTEE_LOAD_ENABLE))
|
||||
else
|
||||
$(error "Error:OPTEE_LOAD_ENABLE=${OPTEE_LOAD_ENABLE} is not supported.")
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
# Process BL2_LOAD_ENABLE flag
|
||||
ifeq (${LSI},V4H)
|
||||
ifndef BL2_LOAD_ENABLE
|
||||
BL2_LOAD_ENABLE := 1
|
||||
$(eval $(call add_define,BL2_LOAD_ENABLE))
|
||||
else
|
||||
ifeq (${BL2_LOAD_ENABLE},0)
|
||||
$(eval $(call add_define,BL2_LOAD_ENABLE))
|
||||
else ifeq (${BL2_LOAD_ENABLE},1)
|
||||
$(eval $(call add_define,BL2_LOAD_ENABLE))
|
||||
else
|
||||
$(error "Error:BL2_LOAD_ENABLE=${BL2_LOAD_ENABLE} is not supported.")
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
# Process QNX_OS_LOAD_ENABLE flag
|
||||
ifeq (${LSI},V4H)
|
||||
ifndef QNX_OS_LOAD_ENABLE
|
||||
QNX_OS_LOAD_ENABLE := 1
|
||||
$(eval $(call add_define,QNX_OS_LOAD_ENABLE))
|
||||
else
|
||||
ifeq (${QNX_OS_LOAD_ENABLE},0)
|
||||
$(eval $(call add_define,QNX_OS_LOAD_ENABLE))
|
||||
else ifeq (${QNX_OS_LOAD_ENABLE},1)
|
||||
$(eval $(call add_define,QNX_OS_LOAD_ENABLE))
|
||||
else
|
||||
$(error "Error:QNX_OS_LOAD_ENABLE=${QNX_OS_LOAD_ENABLE} is not supported.")
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
###################################################
|
||||
# pass SecureMonitor parametor
|
||||
###################################################
|
||||
# Process SET_CA_PARAM flag
|
||||
ifeq (${LSI},S4)
|
||||
ifndef SET_CA_PARAM
|
||||
SET_CA_PARAM := 1
|
||||
$(eval $(call add_define,SET_CA_PARAM))
|
||||
else
|
||||
ifeq (${SET_CA_PARAM},0)
|
||||
$(eval $(call add_define,SET_CA_PARAM))
|
||||
else ifeq (${SET_CA_PARAM},1)
|
||||
$(eval $(call add_define,SET_CA_PARAM))
|
||||
else
|
||||
$(error "Error:SET_CA_PARAM=${SET_CA_PARAM} is not supported.")
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
# Process ECM_ENABLE
|
||||
ifndef ECM_ENABLE
|
||||
ECM_ENABLE:= 0
|
||||
$(eval $(call add_define,ECM_ENABLE))
|
||||
else
|
||||
ifeq (${ECM_ENABLE},0)
|
||||
$(eval $(call add_define,ECM_ENABLE))
|
||||
else ifeq (${ECM_ENABLE},1)
|
||||
$(eval $(call add_define,ECM_ENABLE))
|
||||
else
|
||||
$(error "Error: ECM_ENABLE=${ECM_ENABLE} is not supported.")
|
||||
endif
|
||||
endif
|
||||
|
||||
# Process ECM_ERROR_ENABLE flag
|
||||
ifndef ECM_ERROR_ENABLE
|
||||
ECM_ERROR_ENABLE := 1
|
||||
$(eval $(call add_define,ECM_ERROR_ENABLE))
|
||||
else
|
||||
ifeq (${ECM_ERROR_ENABLE},0)
|
||||
$(eval $(call add_define,ECM_ERROR_ENABLE))
|
||||
else ifeq (${ECM_ERROR_ENABLE},1)
|
||||
$(eval $(call add_define,ECM_ERROR_ENABLE))
|
||||
else
|
||||
$(error "Error:ECM_ERROR_ENABLE=${ECM_ERROR_ENABLE} is not supported.")
|
||||
endif
|
||||
endif
|
||||
|
||||
|
||||
# Process SAN_ENABLE
|
||||
ifndef SAN_ENABLE
|
||||
SAN_ENABLE:= 0
|
||||
$(eval $(call add_define,SAN_ENABLE))
|
||||
else
|
||||
ifeq (${SAN_ENABLE},0)
|
||||
$(eval $(call add_define,SAN_ENABLE))
|
||||
else ifeq (${SAN_ENABLE},1)
|
||||
$(eval $(call add_define,SAN_ENABLE))
|
||||
OBJ_FILE += \
|
||||
ip/san/v4h.o \
|
||||
ip/wdt/rwdt.o \
|
||||
ip/i2c/i2c5.o
|
||||
else
|
||||
$(error "Error: SAN_ENABLE=${SAN_ENABLE} is not supported.")
|
||||
endif
|
||||
endif
|
||||
|
||||
# Process DBSC HUNGUP WA
|
||||
ifndef WA_OTLINT5579
|
||||
WA_OTLINT5579:= 1
|
||||
endif
|
||||
$(eval $(call add_define,WA_OTLINT5579))
|
||||
|
||||
###################################################
|
||||
|
||||
OUTDIR_REL := $(OUTDIR)/release
|
||||
OUTDIR_OBJ := $(OUTDIR)/obj
|
||||
|
||||
OBJ_FILE := $(OBJ_FILE:%.o=$(OUTDIR_OBJ)/%.o)
|
||||
OBJ_FILE_SA0 := $(OBJ_FILE_SA0:%.o=$(OUTDIR_OBJ)/%.o)
|
||||
OBJ_FILE_SA9 := $(OBJ_FILE_SA9:%.o=$(OUTDIR_OBJ)/%.o)
|
||||
OBJ_FILE_TFMV_TBL := $(OBJ_FILE_TFMV_TBL:%.o=$(OUTDIR_OBJ)/%.o)
|
||||
OBJ_FILE_NTFMV_TBL := $(OBJ_FILE_NTFMV_TBL:%.o=$(OUTDIR_OBJ)/%.o)
|
||||
|
||||
CC = cxrh850
|
||||
AS = cxrh850
|
||||
LD = cxrh850
|
||||
OC = gsrec
|
||||
OD = gdump
|
||||
|
||||
ASFLAGS += -asm="-preprocess_assembly_files" \
|
||||
-asm="-nostartfiles" \
|
||||
-D__ASSEMBLY \
|
||||
$(INCLUDE_DIR) $(DEFINES)
|
||||
|
||||
CFLAGS += -nostartfiles \
|
||||
-c99 \
|
||||
$(INCLUDE_DIR) $(DEFINES) \
|
||||
--ghstd=last \
|
||||
-Wundef \
|
||||
--diag_error=193 \
|
||||
--prototype_errors
|
||||
# --ghstd=last : Enable Green Hills Standard Mode
|
||||
# -Wundef : Output warning if there are any undefined symbols
|
||||
# --diag_error=193 : Error if zero is applied to undefined symbol
|
||||
# --prototype_errors : Error if there are no any prototype declaration
|
||||
|
||||
ifeq (${LOG_LEVEL},0)
|
||||
# There are no any additional options
|
||||
else
|
||||
CFLAGS += --diag_suppress=1932 # There is warning that format string parameter in sprintf is not constant
|
||||
endif
|
||||
|
||||
LDFLAGS += -nostartfiles -Mu
|
||||
|
||||
BUILD_MESSAGE_TIMESTAMP ?= __TIME__", "__DATE__
|
||||
|
||||
###################################################
|
||||
.SUFFIXES : .s .c .o
|
||||
|
||||
###################################################
|
||||
# command
|
||||
|
||||
.PHONY: all
|
||||
all: $(OUTPUT_FILE) $(OUTPUT_FILE_SA0) $(OUTPUT_FILE_SA9) $(OUTPUT_FILE_TFMV_TBL) $(OUTPUT_FILE_NTFMV_TBL)
|
||||
|
||||
###################################################
|
||||
# Linker
|
||||
###################################################
|
||||
$(OUTPUT_FILE) : $(MEMORY_DEF) $(OBJ_FILE)
|
||||
@echo const char build_message[] = "Built : "$(BUILD_MESSAGE_TIMESTAMP); > $(OUTDIR_OBJ)/build_message.c
|
||||
$(V)$(CC) $(CFLAGS) -o $(OUTDIR_OBJ)/build_message.o -c $(OUTDIR_OBJ)/build_message.c
|
||||
|
||||
$(V)$(LD) $(OBJ_FILE) $(OUTDIR_OBJ)/build_message.o \
|
||||
-T $(MEMORY_DEF) \
|
||||
-o $(OUTDIR_REL)/$(OUTPUT_FILE) \
|
||||
$(LDFLAGS) \
|
||||
-map=$(OUTDIR_REL)/$(FILE_NAME).map
|
||||
|
||||
$(V)$(OC) -S3 -bytes 16 -noS5 $(OUTDIR_REL)/$(OUTPUT_FILE) > $(OUTDIR_REL)/$(FILE_NAME).srec
|
||||
$(V)$(OD) -full -ysec $(OUTDIR_REL)/$(OUTPUT_FILE) > $(OUTDIR_REL)/$(FILE_NAME).dump
|
||||
$(V)gmemfile $(OUTDIR_REL)/$(OUTPUT_FILE) -o $(OUTDIR_REL)/$(OUTPUT_FILE:%.elf=%.bin)
|
||||
|
||||
$(OUTPUT_FILE_SA0) : $(MEMORY_DEF_SA0) $(OBJ_FILE_SA0)
|
||||
$(V)$(LD) $(OBJ_FILE_SA0) \
|
||||
-T $(MEMORY_DEF_SA0) \
|
||||
-o $(OUTDIR_REL)/$(OUTPUT_FILE_SA0) \
|
||||
-map=$(OUTDIR_REL)/$(FILE_NAME_SA0).map \
|
||||
-nostdlib
|
||||
|
||||
$(V)$(OC) -S3 -bytes 16 -noS5 $(OUTDIR_REL)/$(OUTPUT_FILE_SA0) > $(OUTDIR_REL)/$(FILE_NAME_SA0).srec
|
||||
$(V)gmemfile $(OUTDIR_REL)/$(OUTPUT_FILE_SA0) -o $(OUTDIR_REL)/$(OUTPUT_FILE_SA0:%.elf=%.bin)
|
||||
|
||||
$(OUTPUT_FILE_SA9) : $(MEMORY_DEF_SA9) $(OBJ_FILE_SA9)
|
||||
$(V)$(LD) $(OBJ_FILE_SA9) \
|
||||
-T $(MEMORY_DEF_SA9) \
|
||||
-o $(OUTDIR_REL)/$(OUTPUT_FILE_SA9) \
|
||||
-map=$(OUTDIR_REL)/$(FILE_NAME_SA9).map \
|
||||
-nostdlib
|
||||
|
||||
$(V)$(OC) -S3 -bytes 16 -noS5 $(OUTDIR_REL)/$(OUTPUT_FILE_SA9) > $(OUTDIR_REL)/$(FILE_NAME_SA9).srec
|
||||
$(V)gmemfile $(OUTDIR_REL)/$(OUTPUT_FILE_SA9) -o $(OUTDIR_REL)/$(OUTPUT_FILE_SA9:%.elf=%.bin)
|
||||
|
||||
$(OUTPUT_FILE_TFMV_TBL) : $(MEMORY_DEF_TFMV_TBL) $(OBJ_FILE_TFMV_TBL)
|
||||
$(V)$(LD) $(OBJ_FILE_TFMV_TBL) \
|
||||
-T $(MEMORY_DEF_TFMV_TBL) \
|
||||
-o $(OUTDIR_REL)/$(OUTPUT_FILE_TFMV_TBL) \
|
||||
-map=$(OUTDIR_REL)/$(FILE_NAME_TFMV_TBL).map \
|
||||
-nostdlib
|
||||
|
||||
$(V)gmemfile $(OUTDIR_REL)/$(OUTPUT_FILE_TFMV_TBL) -o $(OUTDIR_REL)/$(OUTPUT_FILE_TFMV_TBL:%.elf=%.bin)
|
||||
|
||||
$(OUTPUT_FILE_NTFMV_TBL) : $(MEMORY_DEF_NTFMV_TBL) $(OBJ_FILE_NTFMV_TBL)
|
||||
$(V)$(LD) $(OBJ_FILE_NTFMV_TBL) \
|
||||
-T $(MEMORY_DEF_NTFMV_TBL) \
|
||||
-o $(OUTDIR_REL)/$(OUTPUT_FILE_NTFMV_TBL) \
|
||||
-map=$(OUTDIR_REL)/$(FILE_NAME_NTFMV_TBL).map \
|
||||
-nostdlib
|
||||
|
||||
$(V)gmemfile $(OUTDIR_REL)/$(OUTPUT_FILE_NTFMV_TBL) -o $(OUTDIR_REL)/$(OUTPUT_FILE_NTFMV_TBL:%.elf=%.bin)
|
||||
|
||||
###################################################
|
||||
# Compile
|
||||
###################################################
|
||||
|
||||
$(OUTDIR_OBJ)/%.o:%.c
|
||||
$(V)$(CC) $(CFLAGS) -o $@ -c $<
|
||||
|
||||
$(OUTDIR_OBJ)/%.o:%.S
|
||||
$(V)$(AS) $(ASFLAGS) -o $@ -c $<
|
||||
|
||||
|
||||
.PHONY: clean
|
||||
clean:
|
||||
@rm -rf $(OUTDIR)
|
||||
Reference in New Issue
Block a user