diff mbox series

[v2,3/8] boot/arm-trusted-firmware: support debug mode

Message ID 1552951269-16967-3-git-send-email-etienne.carriere@linaro.org
State Accepted
Headers show
Series [v2,1/8] boot/arm-trusted-firmware: support 32bit Arm targets | expand

Commit Message

Etienne Carriere March 18, 2019, 11:21 p.m. UTC
When the trusted firmware is built with debug support (DEBUG defined),
the generated images are located at a specific path. The non debug
images are located in generated directory build/<platform>/release/
while the debug images are located in generated directory
build/<platform>/debug/.

This change introduces boolean BR2_TARGET_ARM_TRUSTED_FIRMWARE_DEBUG
to define whether the release or debug configuration is used to build
trusted firmware. Note that enabling trusted firmware debug support, i.e
BR2_TARGET_ARM_TRUSTED_FIRMWARE_ADDITIONAL_VARIABLES="... DEBUG=1 ..."
without enabling BR2_TARGET_ARM_TRUSTED_FIRMWARE_DEBUG will fail since
Buildroot will get generated files from the wrong path.

Signed-off-by: Etienne Carriere <etienne.carriere@linaro.org>
---
Changes v1 -> v2:
 - No change

---
 boot/arm-trusted-firmware/Config.in               | 7 +++++++
 boot/arm-trusted-firmware/arm-trusted-firmware.mk | 6 ++++++
 2 files changed, 13 insertions(+)

Comments

Thomas Petazzoni March 20, 2019, 9:59 p.m. UTC | #1
Hello Etienne,

On Tue, 19 Mar 2019 00:21:04 +0100
Etienne Carriere <etienne.carriere@linaro.org> wrote:

> When the trusted firmware is built with debug support (DEBUG defined),
> the generated images are located at a specific path. The non debug
> images are located in generated directory build/<platform>/release/
> while the debug images are located in generated directory
> build/<platform>/debug/.
> 
> This change introduces boolean BR2_TARGET_ARM_TRUSTED_FIRMWARE_DEBUG
> to define whether the release or debug configuration is used to build
> trusted firmware. Note that enabling trusted firmware debug support, i.e
> BR2_TARGET_ARM_TRUSTED_FIRMWARE_ADDITIONAL_VARIABLES="... DEBUG=1 ..."
> without enabling BR2_TARGET_ARM_TRUSTED_FIRMWARE_DEBUG will fail since
> Buildroot will get generated files from the wrong path.
> 
> Signed-off-by: Etienne Carriere <etienne.carriere@linaro.org>

I've applied with a few minor tweaks.

> +config BR2_TARGET_ARM_TRUSTED_FIRMWARE_DEBUG
> +	bool "Debug mode of the trusted firmware"

"of the trusted firmware" is not really useful: options are already
indented under the package they apply to, so there's no need to repeat
the package name.

> +	default n

"default n" is the default, so it's not needed.

> +	help
> +	  Enable this directive if trusted firmware is built in debug
> +	  mode.

The wording is strange: you don't want to enable this option (not
directive) if trusted firmware is built in debug mode. You want to
enable it to build ATF in debug mode.

Thanks,

Thomas
diff mbox series

Patch

diff --git a/boot/arm-trusted-firmware/Config.in b/boot/arm-trusted-firmware/Config.in
index a1a0c54..9a152b9 100644
--- a/boot/arm-trusted-firmware/Config.in
+++ b/boot/arm-trusted-firmware/Config.in
@@ -136,4 +136,11 @@  config BR2_TARGET_ARM_TRUSTED_FIRMWARE_ADDITIONAL_VARIABLES
 	  Additional parameters for the ATF build
 	  E.G. 'DEBUG=1 LOG_LEVEL=20'
 
+config BR2_TARGET_ARM_TRUSTED_FIRMWARE_DEBUG
+	bool "Debug mode of the trusted firmware"
+	default n
+	help
+	  Enable this directive if trusted firmware is built in debug
+	  mode.
+
 endif
diff --git a/boot/arm-trusted-firmware/arm-trusted-firmware.mk b/boot/arm-trusted-firmware/arm-trusted-firmware.mk
index 0ea4c0e..68be00d 100644
--- a/boot/arm-trusted-firmware/arm-trusted-firmware.mk
+++ b/boot/arm-trusted-firmware/arm-trusted-firmware.mk
@@ -28,7 +28,13 @@  endif
 ARM_TRUSTED_FIRMWARE_INSTALL_IMAGES = YES
 
 ARM_TRUSTED_FIRMWARE_PLATFORM = $(call qstrip,$(BR2_TARGET_ARM_TRUSTED_FIRMWARE_PLATFORM))
+
+ifeq ($(BR2_TARGET_ARM_TRUSTED_FIRMWARE_DEBUG),y)
+ARM_TRUSTED_FIRMWARE_MAKE_OPTS += DEBUG=1
+ARM_TRUSTED_FIRMWARE_IMG_DIR = $(@D)/build/$(ARM_TRUSTED_FIRMWARE_PLATFORM)/debug
+else
 ARM_TRUSTED_FIRMWARE_IMG_DIR = $(@D)/build/$(ARM_TRUSTED_FIRMWARE_PLATFORM)/release
+endif
 
 ARM_TRUSTED_FIRMWARE_MAKE_OPTS += \
 	CROSS_COMPILE="$(TARGET_CROSS)" \