源码压缩包的文件路径:/home/alientek/mp13x_pro/stm32mp1-openstlinux-5.15-yocto-kirkstone-mp1-v22.06.15/sources/arm-ostl-linux-gnueabi/tf-a-stm32mp-v2.6-stm32mp1-r1-r0
终端输入指令:
tar -xvf tf-a-stm32mp-v2.6-stm32mp1-r1-r0.tar.xz
终端输入指令:
cd tf-a-stm32mp-v2.6-stm32mp1-r1
for p in `ls -1 ../*.patch`; do patch -p1 < $p; done
终端输入指令:
cd tf-a-stm32mp-v2.6-stm32mp1-r1/
终端输入指令:
touch build.sh
chmod 777 build.sh
终端输入指令:
vim build.sh
输入以下内容:
#!/bin/sh
# script-name: build.sh
# version: 1.0
# date: 2023-06-15
# author: wangjianquan
#删除上层目录的编译文件
rm ../build/ ../deploy/ -rf
#运行编译
make -f ../Makefile.sdk all
保存文件,按下键盘的Esc键,输入:wq!
源码文件目录:tf-a-stm32mp-v2.6-stm32mp1-r1/fdts
终端执行命令:
cp stm32mp135d-dk.dts stm32mp135d-mini.dts
cp stm32mp13-pinctrl.dtsi stm32mp13-pinctrl-mini.dtsi
cp stm32mp135d-dk-fw-config.dts stm32mp135d-mini-fw-config.dts
解释:这里是以stm32mp135d-dk板子的官方源码为模板进行的移植,文件名中含有"mini"字样的都是我们接下来要进行源码处理的文件,也就是我们开发板的DIY源码!
←(左侧):已修改的tf-a源码
→(右侧):未修改的tf-a源码
解释:使我们新建的pinctrl文件在设备树中生效。
←(左侧):已修改的tf-a源码
→(右侧):未修改的tf-a源码
解释:model属性在tf-a启动时会被调用显示在串口输出打印消息里,调用文件:plat/st/stm32mp1/bl2_plat_setup.c;compatible属性用于platfrom的匹配,这个属性调用的文件数量较多,这里不一一列举,自行在源码文件夹中搜索。
←(左侧):已修改的tf-a源码
→(右侧):未修改的tf-a源码
←(左侧):已修改的tf-a源码
→(右侧):未修改的tf-a源码
解释:板子是靠uart4进行串口通信的,其它串口我们可以预留到别的功能上!这里不建议大家使用别的uart进行串口通信,因为st官方设计的源码里面指定是使用uart4的,如果你换了别的uart,会加大你对源码修改的工作量。
←(左侧):已修改的tf-a源码
→(右侧):未修改的tf-a源码
←(左侧):已修改的tf-a源码
→(右侧):未修改的tf-a源码
←(左侧):已修改的tf-a源码
→(右侧):未修改的tf-a源码
←(左侧):已修改的tf-a源码
→(右侧):未修改的tf-a源码
解释:ST官方提供专用的PMIC(型号:STPMIC1A)成本太高,我设计的开发板里没有用到这个玩意,我也不建议大家去使用,毕竟1000片起订1.9美元/片!STPMIC1A 是一个 IIC 器件,所以也会存在IIC节点,这里我们直接删除。ST官方提供的tf-a、optee、uboot、linux kernel中都有关于这个PMIC使用的设备树配置,接下来的教程里,在设备树中我们都将涉及到取消与这个PMIC相关的配置的操作。
←(左侧):已修改的tf-a源码
→(右侧):未修改的tf-a源码
解释:ST官方的源码里没有使用到sdmmc2(TF卡),所以这里补充上了sdmmc2的节点,这里没什么好说的。
←(左侧):已修改的tf-a源码
→(右侧):未修改的tf-a源码
解释:我的开发板上用到了有源晶振来代替从mp135芯片上获取的时钟分频,所以注释掉这个节点了,你可以试着注释掉这个节点,如果启动tf-a的时候报错了再恢复这个节点就行。
// SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause)
/*
* Copyright (C) STMicroelectronics 2022 - All Rights Reserved
* Author: Alexandre Torgue for STMicroelectronics.
*/
/dts-v1/;
#include
#include "stm32mp135.dtsi"
#include "stm32mp13xd.dtsi"
#include "stm32mp13-ddr3-1x4Gb-1066-binF.dtsi"
#include "stm32mp13-pinctrl-mini.dtsi"
/ {
model = "STM32MP135D-MINI Discovery Board";
compatible = "st,stm32mp135d-mini", "st,stm32mp135";
aliases {
serial0 = &uart4;
};
chosen {
stdout-path = "serial0:115200n8";
};
memory@c0000000 {
device_type = "memory";
reg = <0xc0000000 0x20000000>;
};
vddcore: regulator-vddcore {
compatible = "regulator-fixed";
regulator-name = "vddcore";
regulator-min-microvolt = <1250000>;
regulator-max-microvolt = <1250000>;
regulator-off-in-suspend;
regulator-always-on;
};
vddcpu: regulator-vddcpu {
compatible = "regulator-fixed";
regulator-name = "vddcpu";
regulator-min-microvolt = <1350000>;
regulator-max-microvolt = <1350000>;
regulator-off-in-suspend;
regulator-always-on;
};
v3v3: regulator-v3v3 {
compatible = "regulator-fixed";
regulator-name = "v3v3";
regulator-min-microvolt = <3300000>;
regulator-max-microvolt = <3300000>;
regulator-off-in-suspend;
regulator-always-on;
};
vdd: regulator-vdd {
compatible = "regulator-fixed";
regulator-name = "vdd";
regulator-min-microvolt = <3300000>;
regulator-max-microvolt = <3300000>;
regulator-off-in-suspend;
regulator-always-on;
};
vdd_usb: regulator-vdd-usb {
compatible = "regulator-fixed";
regulator-name = "vdd_usb";
regulator-min-microvolt = <3300000>;
regulator-max-microvolt = <3300000>;
regulator-off-in-suspend;
regulator-always-on;
};
};
&bsec {
board_id: board_id@f0 {
reg = <0xf0 0x4>;
st,non-secure-otp;
};
};
&clk_hse {
st,digbypass;
};
&cpu0 {
cpu-supply = <&vddcpu>;
};
&hash {
status = "okay";
};
&iwdg2 {
timeout-sec = <32>;
status = "okay";
};
&pwr_regulators {
vdd-supply = <&vdd>;
vdd_3v3_usbfs-supply = <&vdd_usb>;
};
&rcc {
st,clksrc = <
CLK_MPU_PLL1P
CLK_AXI_PLL2P
CLK_MLAHBS_PLL3
CLK_CKPER_HSE
CLK_RTC_LSE
CLK_SDMMC1_PLL4P
CLK_SDMMC2_PLL4P
CLK_STGEN_HSE
CLK_USBPHY_HSE
CLK_I2C4_HSI
CLK_USBO_USBPHY
CLK_I2C12_HSI
CLK_UART2_HSI
CLK_UART4_HSI
>;
st,clkdiv = <
DIV(DIV_AXI, 0)
DIV(DIV_MLAHB, 0)
DIV(DIV_APB1, 1)
DIV(DIV_APB2, 1)
DIV(DIV_APB3, 1)
DIV(DIV_APB4, 1)
DIV(DIV_APB5, 2)
DIV(DIV_APB6, 1)
DIV(DIV_RTC, 0)
>;
st,pll_vco {
pll1_vco_1300Mhz: pll1-vco-1300Mhz {
src = < CLK_PLL12_HSE >;
divmn = < 2 80 >;
frac = < 0x800 >;
};
pll2_vco_1066Mhz: pll2-vco-1066Mhz {
src = < CLK_PLL12_HSE >;
divmn = < 2 65 >;
frac = < 0x1400 >;
};
pll3_vco_417_8Mhz: pll2-vco-417_8Mhz {
src = < CLK_PLL3_HSE >;
divmn = < 1 33 >;
frac = < 0x1a04 >;
};
pll4_vco_600Mhz: pll2-vco-600Mhz {
src = < CLK_PLL4_HSE >;
divmn = < 1 49 >;
};
};
/* VCO = 1300.0 MHz => P = 650 (CPU) */
pll1:st,pll@0 {
compatible = "st,stm32mp1-pll";
reg = <0>;
st,pll = < &pll1_cfg1 >;
pll1_cfg1: pll1_cfg1 {
st,pll_vco = < &pll1_vco_1300Mhz >;
st,pll_div_pqr = < 0 1 1 >;
};
};
/* VCO = 1066.0 MHz => P = 266 (AXI), Q = 266, R = 533 (DDR) */
pll2:st,pll@1 {
compatible = "st,stm32mp1-pll";
reg = <1>;
st,pll = < &pll2_cfg1 >;
pll2_cfg1: pll2_cfg1 {
st,pll_vco = < &pll2_vco_1066Mhz >;
st,pll_div_pqr = < 1 1 0 >;
};
};
/* VCO = 417.8 MHz => P = 209, Q = 24, R = 209 */
pll3:st,pll@2 {
compatible = "st,stm32mp1-pll";
reg = <2>;
st,pll = < &pll3_cfg1 >;
pll3_cfg1: pll3_cfg1 {
st,pll_vco = < &pll3_vco_417_8Mhz >;
st,pll_div_pqr = < 1 16 1 >;
};
};
/* VCO = 600.0 MHz => P = 50, Q = 10, R = 100 */
pll4:st,pll@3 {
compatible = "st,stm32mp1-pll";
reg = <3>;
st,pll = < &pll4_cfg1 >;
pll4_cfg1: pll4_cfg1 {
st,pll_vco = < &pll4_vco_600Mhz >;
st,pll_div_pqr = < 11 59 5 >;
};
};
};
&rng {
status = "okay";
};
&sdmmc1 {
pinctrl-names = "default";
pinctrl-0 = <&sdmmc1_b4_pins_a &sdmmc1_clk_pins_a>;
disable-wp;
st,neg-edge;
no-1-8-v;
bus-width = <4>;
vmmc-supply = <&v3v3>;
status = "okay";
};
&sdmmc2 {
pinctrl-names = "default";
pinctrl-0 = <&sdmmc2_b4_pins_a &sdmmc2_b4_b7_pins_a &sdmmc2_clk_pins_a>;
non-removable;
st,neg-edge;
mmc-ddr-3_3v;
no-1-8-v;
bus-width = <8>;
vmmc-supply = <&v3v3>;
vqmmc-supply = <&v3v3>;
status = "okay";
};
&uart4 {
pinctrl-names = "default";
pinctrl-0 = <&uart4_pins_a>;
status = "okay";
};
←(左侧):已修改的tf-a源码
→(右侧):未修改的tf-a源码
解释:在设备树中删除了PMIC电源管理芯片的相关节点,这里做同步处理。
←(左侧):已修改的tf-a源码
→(右侧):未修改的tf-a源码
解释:在设备树中补充了EMMC2节点,这里做同步处理。
←(左侧):已修改的tf-a源码
→(右侧):未修改的tf-a源码
解释:在设备树中删除了uart初始化的节点信息,这里做同步处理。
// SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause)
/*
* Copyright (C) STMicroelectronics 2019 - All Rights Reserved
* Author: Alexandre Torgue
*/
#include
&pinctrl {
sdmmc1_b4_pins_a: sdmmc1-b4-0 {
pins {
pinmux = <STM32_PINMUX('C', 8, AF12)>, /* SDMMC1_D0 */
<STM32_PINMUX('C', 9, AF12)>, /* SDMMC1_D1 */
<STM32_PINMUX('C', 10, AF12)>, /* SDMMC1_D2 */
<STM32_PINMUX('C', 11, AF12)>, /* SDMMC1_D3 */
<STM32_PINMUX('D', 2, AF12)>; /* SDMMC1_CMD */
slew-rate = <1>;
drive-push-pull;
bias-disable;
};
};
sdmmc1_clk_pins_a: sdmmc1-clk-0 {
pins {
pinmux = <STM32_PINMUX('C', 12, AF12)>; /* SDMMC1_CK */
slew-rate = <1>;
drive-push-pull;
bias-disable;
};
};
sdmmc2_b4_pins_a: sdmmc2-b4-0 {
pins {
pinmux = <STM32_PINMUX('B', 14, AF10)>, /* SDMMC2_D0 */
<STM32_PINMUX('B', 15, AF10)>, /* SDMMC2_D1 */
<STM32_PINMUX('B', 3, AF10)>, /* SDMMC2_D2 */
<STM32_PINMUX('B', 4, AF10)>, /* SDMMC2_D3 */
<STM32_PINMUX('G', 6, AF10)>; /* SDMMC2_CMD */
slew-rate = <1>;
drive-push-pull;
bias-pull-up;
};
};
sdmmc2_b4_b7_pins_a: sdmmc2-b4-b7-0 {
pins {
pinmux = <STM32_PINMUX('F', 0, AF10)>, /* SDMMC2_D4 */
<STM32_PINMUX('B', 9, AF10)>, /* SDMMC2_D5 */
<STM32_PINMUX('C', 6, AF10)>, /* SDMMC2_D6 */
<STM32_PINMUX('C', 7, AF10)>; /* SDMMC2_D7 */
slew-rate = <1>;
drive-push-pull;
bias-pull-up;
};
};
sdmmc2_clk_pins_a: sdmmc2-clk-0 {
pins {
pinmux = <STM32_PINMUX('E', 3, AF10)>; /* SDMMC2_CK */
slew-rate = <1>;
drive-push-pull;
bias-pull-up;
};
};
uart4_pins_a: uart4-0 {
pins1 {
pinmux = <STM32_PINMUX('D', 6, AF8)>; /* UART4_TX */
bias-disable;
drive-push-pull;
slew-rate = <0>;
};
pins2 {
pinmux = <STM32_PINMUX('D', 8, AF8)>; /* UART4_RX */
bias-pull-up;
};
};
};
// SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause)
/*
* Copyright (c) 2022, STMicroelectronics - All Rights Reserved
*/
#define DDR_SIZE 0x20000000 /* 512MB */
#include "stm32mp13-fw-config.dtsi"
解释:跟ST的开发板使用了同样的DDR,这里不需要什么改动。
←(左侧):已修改的tf-a源码
→(右侧):未修改的tf-a源码
解释:在设备树中我们注释了clk节点,这里做对应的处理!
static void clk_oscillator_check_bypass(struct stm32_clk_priv *priv, int idx,
bool digbyp, bool bypass)
{
struct clk_oscillator_data *osc_data = clk_oscillator_get_data(priv, idx);
struct stm32_clk_bypass *bypass_data = osc_data->bypass;
uintptr_t address;
if (bypass_data == NULL) {
return;
}
address = priv->base + bypass_data->offset;
if ((mmio_read_32(address) & RCC_OCENR_HSEBYP) &&
(!(digbyp || bypass))) {
// panic();
}
}
←(左侧):已修改的tf-a源码
→(右侧):未修改的tf-a源码
解释:修改编译器为arm-none-linux-gnueabihf。
解释:关闭tf-a的关联编译。
# Set default path
SRC_PATH ?= $(PWD)
BLD_PATH ?= $(SRC_PATH)/../build
DEPLOYDIR ?= $(SRC_PATH)/../deploy
BL32_DEPLOYDIR ?= $(DEPLOYDIR)/bl32
FWCONFIG_DEPLOYDIR ?= $(DEPLOYDIR)/fwconfig
# Configure default TF-A features
TF_A_ENABLE_DEBUG_WRAPPER ?= 0
# Set default TF-A config
TF_A_CONFIG ?= optee emmc sdcard usb
# Default TF-A overall settings to null
TF_A_BINARY ?=
TF_A_DEVICETREE ?=
TF_A_MAKE_TARGET ?=
TF_A_EXTRA_OPTFLAGS ?=
# Default TF-A metadata template
TF_A_METADATA_JSON ?= $(SRC_PATH)/plat/st/stm32mp1/default_metadata.json
# Init default config settings
TF_A_DEVICETREE_optee ?= stm32mp135d-mini
TF_A_EXTRA_OPTFLAGS_optee ?= AARCH32_SP=optee
TF_A_BINARY_optee ?= tf-a
TF_A_MAKE_TARGET_optee ?= dtbs
# Init default config settings
#TF_A_DEVICETREE_trusted ?= stm32mp157a-dk1 stm32mp157d-dk1 stm32mp157c-dk2 stm32mp157f-dk2 stm32mp157c-ed1 stm32mp157f-ed1 stm32mp157a-ev1 stm32mp157c-ev1 stm32mp157d-ev1 stm32mp157f-ev1
#TF_A_EXTRA_OPTFLAGS_trusted ?= AARCH32_SP=sp_min
#TF_A_BINARY_trusted ?= tf-a
#TF_A_MAKE_TARGET_trusted ?= bl32 dtbs
# Init default config settings
TF_A_DEVICETREE_emmc ?= stm32mp135d-mini
TF_A_EXTRA_OPTFLAGS_emmc ?= STM32MP_EMMC=1 PSA_FWU_SUPPORT=1
TF_A_BINARY_emmc ?= tf-a
TF_A_MAKE_TARGET_emmc ?= all
# Init default config settings
#TF_A_DEVICETREE_nand ?= stm32mp157a-ev1 stm32mp157c-ev1 stm32mp157d-ev1 stm32mp157f-ev1
#TF_A_EXTRA_OPTFLAGS_nand ?= STM32MP_RAW_NAND=1 STM32MP_FORCE_MTD_START_OFFSET=0x00200000
#TF_A_BINARY_nand ?= tf-a
#TF_A_MAKE_TARGET_nand ?= all
# Init default config settings
#TF_A_DEVICETREE_nor ?= stm32mp157a-ev1 stm32mp157c-ev1 stm32mp157d-ev1 stm32mp157f-ev1
#TF_A_EXTRA_OPTFLAGS_nor ?= STM32MP_SPI_NOR=1 PSA_FWU_SUPPORT=1 STM32MP_FORCE_MTD_START_OFFSET=0x00080000
#TF_A_BINARY_nor ?= tf-a
#TF_A_MAKE_TARGET_nor ?= all
# Init default config settings
TF_A_DEVICETREE_sdcard ?= stm32mp135d-mini
TF_A_EXTRA_OPTFLAGS_sdcard ?= STM32MP_SDMMC=1 PSA_FWU_SUPPORT=1
TF_A_BINARY_sdcard ?= tf-a
TF_A_MAKE_TARGET_sdcard ?= all
# Init default config settings
TF_A_DEVICETREE_uart ?= stm32mp135d-mini
TF_A_EXTRA_OPTFLAGS_uart ?= STM32MP_UART_PROGRAMMER=1
TF_A_BINARY_uart ?= tf-a
TF_A_MAKE_TARGET_uart ?= all
# Init default config settings
TF_A_DEVICETREE_usb ?= stm32mp135d-mini
TF_A_EXTRA_OPTFLAGS_usb ?= STM32MP_USB_PROGRAMMER=1
TF_A_BINARY_usb ?= tf-a
TF_A_MAKE_TARGET_usb ?= all
# Reset default variables
LDFLAGS =
CFLAGS =
CPPFLAGS =
CC =
CPP =
AS =
AR =
LD =
NM =
# Define default make options
EXTRA_OEMAKE ?= PLAT=stm32mp1 ARCH=aarch32 ARM_ARCH_MAJOR=7 CROSS_COMPILE=arm-none-linux-gnueabihf- DEBUG=1 LOG_LEVEL=40
# Display TF-A config details
define tf-configs
echo " $(1)" ; \
echo " with device tree : $(if $(TF_A_DEVICETREE),$(TF_A_DEVICETREE),$(TF_A_DEVICETREE_$(1)))" ; \
echo " extra optionflags: $(if $(TF_A_EXTRA_OPTFLAGS),$(TF_A_EXTRA_OPTFLAGS),$(TF_A_EXTRA_OPTFLAGS_$(1)))" ; \
echo " binary basename : $(if $(TF_A_BINARY),$(TF_A_BINARY),$(TF_A_BINARY_$(1)) (TF_A_BINARY_$(1)))" ; \
echo " tf-a build target: $(if $(TF_A_MAKE_TARGET),$(TF_A_MAKE_TARGET),$(TF_A_MAKE_TARGET_$(1)))" ;
endef
# Configure TF-A make rules
define tf-rules
tf-$(1): $2
@mkdir -p $(BLD_PATH)/$(1)
@$(foreach dt, $(if $(TF_A_DEVICETREE),$(TF_A_DEVICETREE),$(TF_A_DEVICETREE_$(1))), \
$(MAKE) $(EXTRA_OEMAKE) -C $(SRC_PATH) \
BUILD_PLAT=$(BLD_PATH)/$(1) \
DTB_FILE_NAME=$(dt).dtb \
$(if $(TF_A_EXTRA_OPTFLAGS),$(TF_A_EXTRA_OPTFLAGS),$(TF_A_EXTRA_OPTFLAGS_$(1))) \
$(if $(TF_A_MAKE_TARGET),$(TF_A_MAKE_TARGET),$(TF_A_MAKE_TARGET_$(1))) \
$(foreach soc, stm32mp15 stm32mp13 ,$(if $(findstring $(soc),$(dt)),$(shell echo $(soc) | tr a-z A-Z)=1,)) ; \
)
endef
# Configure TF-A deploy rules
define deploy-rules
deploy-$(1): tf-$(1)
@mkdir -p $(DEPLOYDIR)
@mkdir -p $(DEPLOYDIR)/debug
@$(foreach dt, $(if $(TF_A_DEVICETREE),$(TF_A_DEVICETREE),$(TF_A_DEVICETREE_$(1))), \
if [ -f $(BLD_PATH)/$(1)/$(2)-$(dt).stm32 ]; then \
cp -f $(BLD_PATH)/$(1)/$(2)-$(dt).stm32 $(DEPLOYDIR)/$(2)-$(dt)-$(1).stm32 ; \
if [ "$(TF_A_ENABLE_DEBUG_WRAPPER)" = "1" ] ; then \
stm32wrapper4dbg -s $(BLD_PATH)/$(1)/$(2)-$(dt).stm32 -d $(DEPLOYDIR)/debug/debug-$(2)-$(dt)-$(1).stm32 ; \
fi ; \
fi ; \
if [ -f $(BLD_PATH)/$(1)/bl32.bin ] ; then \
mkdir -p $(BL32_DEPLOYDIR) ; \
cp -f $(BLD_PATH)/$(1)/bl32.bin $(BL32_DEPLOYDIR)/$(2)-bl32$(strip $(foreach soc, stm32mp15 stm32mp13 ,$(if $(findstring $(soc),$(dt)),-$(soc),))).bin ; \
if [ -f $(BLD_PATH)/$(1)/fdts/$(dt)-bl32.dtb ]; then \
cp -f $(BLD_PATH)/$(1)/fdts/$(dt)-bl32.dtb $(BL32_DEPLOYDIR)/ ; \
fi ; \
if [ -f $(BLD_PATH)/$(1)/bl32/bl32.elf ]; then \
mkdir -p $(BL32_DEPLOYDIR)/debug ; \
mv -f $(BLD_PATH)/$(1)/bl32/bl32.elf $(BL32_DEPLOYDIR)/debug/$(2)-bl32$(strip $(foreach soc, stm32mp15 stm32mp13 ,$(if $(findstring $(soc),$(dt)),-$(soc),))).elf ; \
fi ; \
fi ; \
if [ -f $(BLD_PATH)/$(1)/fdts/$(dt)-fw-config.dtb ]; then \
mkdir -p $(FWCONFIG_DEPLOYDIR) ; \
cp -f $(BLD_PATH)/$(1)/fdts/$(dt)-fw-config.dtb $(FWCONFIG_DEPLOYDIR)/$(dt)-fw-config-$(1).dtb ; \
fi ; \
if [ -f $(BLD_PATH)/$(1)/bl2/bl2.elf ] ; then \
cp -f $(BLD_PATH)/$(1)/bl2/bl2.elf $(DEPLOYDIR)/debug/$(2)-bl2-$(1).elf ; \
fi ; \
if [ -f $(BLD_PATH)/$(1)/bl32/bl32.elf ] ; then \
cp -f $(BLD_PATH)/$(1)/bl32/bl32.elf $(DEPLOYDIR)/debug/$(2)-bl32-$(1).elf ; \
fi ; \
)
endef
# Set dependencies list for building all
DEPS = $(addprefix deploy-,$(TF_A_CONFIG))
#DEPS += fip
DEPS += metadata
help:
@echo
@echo "TF-A configuration:"
@echo " TF_A_CONFIG = $(TF_A_CONFIG)"
@echo "Config details:"
@$(foreach config, $(TF_A_CONFIG), $(call tf-configs,$(config)))
@echo
@echo "Note that each TF-A configuration settings can be updated through overall or specific config var:"
@echo " TF_A_DEVICETREE"
@echo " TF_A_EXTRA_OPTFLAGS"
@echo " TF_A_BINARY"
@echo " TF_A_MAKE_TARGET"
@echo
@echo "TF-A features configuration:"
@echo " TF_A_ENABLE_DEBUG_WRAPPER = $(TF_A_ENABLE_DEBUG_WRAPPER) ('1' to generate tf-a for debugging)"
@echo
@echo "TF-A folder configuration:"
@echo " SRC_PATH = $(SRC_PATH)"
@echo " BLD_PATH = $(BLD_PATH)"
@echo " DEPLOYDIR = $(DEPLOYDIR)"
@echo " BL32_DEPLOYDIR = $(DEPLOYDIR)/bl32"
@echo " FWCONFIG_DEPLOYDIR = $(DEPLOYDIR)/fwconfig"
@echo
@echo "FIP configuration:"
@echo " Do not forget to set FIP deploydir folders (such as FIP_DEPLOYDIR_ROOT) to provide path to needed binaries"
@echo
@echo "METADATA configuration:"
@echo " TF_A_METADATA_JSON = $(TF_A_METADATA_JSON)"
@echo
@echo "Available targets:"
@echo " all : build TF-A binaries for defined config(s)"
@echo " fip : build FIP binaries"
@echo " metadata : build the TF-A metadata binary"
@echo " stm32 : build TF-A stm32 binaries"
@echo " clean : clean build directories from generated files"
@echo
all: $(DEPS)
host_tools:
@$(MAKE) --no-print-directory -C $(SRC_PATH)/tools/stm32image
# Set TF-A make rules
$(foreach config, $(TF_A_CONFIG), $(eval $(call tf-rules,$(config),host_tools)))
# Set TF-A deploy rules
$(foreach config, $(TF_A_CONFIG), $(eval $(call deploy-rules,$(config),$(if $(TF_A_BINARY),$(TF_A_BINARY),$(TF_A_BINARY_$(config))))))
fip: $(addprefix deploy-,$(TF_A_CONFIG))
for config in $(TF_A_CONFIG) ; do \
if [ "$$config" = "trusted" ]; then \
FIP_DEPLOYDIR_TFA=$(BL32_DEPLOYDIR) FIP_DEPLOYDIR_FWCONF=$(FWCONFIG_DEPLOYDIR) FIP_DEVICETREE="$(if $(TF_A_DEVICETREE),$(TF_A_DEVICETREE),$(TF_A_DEVICETREE_trusted))" FIP_CONFIG="trusted" FIP_BL32_CONF="tfa" fiptool-stm32mp ; \
fi ; \
if [ "$$config" = "optee" ]; then \
FIP_DEPLOYDIR_TFA=$(BL32_DEPLOYDIR) FIP_DEPLOYDIR_FWCONF=$(FWCONFIG_DEPLOYDIR) FIP_DEVICETREE="$(if $(TF_A_DEVICETREE),$(TF_A_DEVICETREE),$(TF_A_DEVICETREE_optee))" FIP_CONFIG="optee" FIP_BL32_CONF="optee" fiptool-stm32mp ; \
fi ; \
done
stm32: $(addprefix deploy-,$(TF_A_CONFIG))
metadata:
@mkdir -p $(DEPLOYDIR)
$(SRC_PATH)/tools/fwu_gen_metadata/fwumd_tool.py jsonparse "$(TF_A_METADATA_JSON)" -b $(DEPLOYDIR)/metadata.bin
clean:
@for config in $(TF_A_CONFIG) ; do \
echo "Removing $(BLD_PATH)/$$config ..." ; \
rm -rf $(BLD_PATH)/$$config ; \
done
@echo "Removing $(DEPLOYDIR) ..."
@rm -rf $(DEPLOYDIR)
@echo