arm-trusted-firmware/plat/nxp/soc-lx2160a/ddr_fip.mk
Chris Kay 7c4e1eea61 build: unify verbosity handling
This change introduces a few helper variables for dealing with verbose
and silent build modes: `silent`, `verbose`, `q` and `s`.

The `silent` and `verbose` variables are boolean values determining
whether the build system has been configured to run silently or
verbosely respectively (i.e. with `--silent` or `V=1`).

These two modes cannot be used together - if `silent` is truthy then
`verbose` is always falsy. As such:

    make --silent V=1

... results in a silent build.

In addition to these boolean variables, we also introduce two new
variables - `s` and `q` - for use in rule recipes to conditionally
suppress the output of commands.

When building silently, `s` expands to a value which disables the
command that follows, and `q` expands to a value which supppresses
echoing of the command:

    $(s)echo 'This command is neither echoed nor executed'
    $(q)echo 'This command is executed but not echoed'

When building verbosely, `s` expands to a value which disables the
command that follows, and `q` expands to nothing:

    $(s)echo 'This command is neither echoed nor executed'
    $(q)echo 'This command is executed and echoed'

In all other cases, both `s` and `q` expand to a value which suppresses
echoing of the command that follows:

    $(s)echo 'This command is executed but not echoed'
    $(q)echo 'This command is executed but not echoed'

The `s` variable is predominantly useful for `echo` commands, where you
always want to suppress echoing of the command itself, whilst `q` is
more useful for all other commands.

Change-Id: I8d8ff6ed714d3cb401946c52955887ed7dca602b
Signed-off-by: Chris Kay <chris.kay@arm.com>
2024-06-14 15:54:48 +00:00

97 lines
2.4 KiB
Makefile

#
# Copyright 2020 NXP
#
# SPDX-License-Identifier: BSD-3-Clause
#
DDR_PHY_BIN_PATH ?= ./ddr-phy-binary/lx2160a
ifeq (${DDR_IMEM_UDIMM_1D},)
DDR_IMEM_UDIMM_1D := ${DDR_PHY_BIN_PATH}/ddr4_pmu_train_imem.bin
endif
ifeq (${DDR_IMEM_UDIMM_2D},)
DDR_IMEM_UDIMM_2D := ${DDR_PHY_BIN_PATH}/ddr4_2d_pmu_train_imem.bin
endif
ifeq (${DDR_DMEM_UDIMM_1D},)
DDR_DMEM_UDIMM_1D := ${DDR_PHY_BIN_PATH}/ddr4_pmu_train_dmem.bin
endif
ifeq (${DDR_DMEM_UDIMM_2D},)
DDR_DMEM_UDIMM_2D := ${DDR_PHY_BIN_PATH}/ddr4_2d_pmu_train_dmem.bin
endif
ifeq (${DDR_IMEM_RDIMM_1D},)
DDR_IMEM_RDIMM_1D := ${DDR_PHY_BIN_PATH}/ddr4_rdimm_pmu_train_imem.bin
endif
ifeq (${DDR_IMEM_RDIMM_2D},)
DDR_IMEM_RDIMM_2D := ${DDR_PHY_BIN_PATH}/ddr4_rdimm2d_pmu_train_imem.bin
endif
ifeq (${DDR_DMEM_RDIMM_1D},)
DDR_DMEM_RDIMM_1D := ${DDR_PHY_BIN_PATH}/ddr4_rdimm_pmu_train_dmem.bin
endif
ifeq (${DDR_DMEM_RDIMM_2D},)
DDR_DMEM_RDIMM_2D := ${DDR_PHY_BIN_PATH}/ddr4_rdimm2d_pmu_train_dmem.bin
endif
$(shell mkdir -p '${BUILD_PLAT}')
ifeq (${DDR_FIP_NAME},)
ifeq (${TRUSTED_BOARD_BOOT},1)
DDR_FIP_NAME := ddr_fip_sec.bin
else
DDR_FIP_NAME := ddr_fip.bin
endif
endif
ifneq (${TRUSTED_BOARD_BOOT},1)
DDR_FIP_ARGS += --ddr-immem-udimm-1d ${DDR_IMEM_UDIMM_1D} \
--ddr-immem-udimm-2d ${DDR_IMEM_UDIMM_2D} \
--ddr-dmmem-udimm-1d ${DDR_DMEM_UDIMM_1D} \
--ddr-dmmem-udimm-2d ${DDR_DMEM_UDIMM_2D} \
--ddr-immem-rdimm-1d ${DDR_IMEM_RDIMM_1D} \
--ddr-immem-rdimm-2d ${DDR_IMEM_RDIMM_2D} \
--ddr-dmmem-rdimm-1d ${DDR_DMEM_RDIMM_1D} \
--ddr-dmmem-rdimm-2d ${DDR_DMEM_RDIMM_2D}
endif
ifeq (${TRUSTED_BOARD_BOOT},1)
ifeq (${MBEDTLS_DIR},)
include plat/nxp/soc-lx2160a/ddr_sb.mk
else
include plat/nxp/soc-lx2160a/ddr_tbbr.mk
# Variables for use with Certificate Generation Tool
CRTTOOLPATH ?= tools/cert_create
CRTTOOL ?= ${CRTTOOLPATH}/cert_create${BIN_EXT}
ifneq (${GENERATE_COT},0)
ddr_certificates: ${DDR_CRT_DEPS} ${CRTTOOL}
$(q)${CRTTOOL} ${DDR_CRT_ARGS}
$(s)echo
$(s)echo "Built $@ successfully"
$(s)echo "DDR certificates can be found in ${BUILD_PLAT}"
$(s)echo
endif
endif
endif
# Variables for use with Firmware Image Package
FIPTOOLPATH ?= tools/fiptool
FIPTOOL ?= ${FIPTOOLPATH}/fiptool${BIN_EXT}
${BUILD_PLAT}/${DDR_FIP_NAME}: ${DDR_FIP_DEPS} ${FIPTOOL}
$(eval ${CHECK_DDR_FIP_CMD})
$(q)${FIPTOOL} create ${DDR_FIP_ARGS} $@
$(q)${FIPTOOL} info $@
$(s)echo
$(s)echo "Built $@ successfully"
$(s)echo
fip_ddr: ${BUILD_PLAT}/${DDR_FIP_NAME}