Unable to dump debug output

Dear All,
I have been working on the development of Trusted Applications on Trusty TEE (using Jetson AGX Xavier). My model of the application needs a communication between 2 TA’s, and I am unable to dump the debug output to dmesg.

While looking around for solutions in the forum, I saw that other users were able to get the debug output from the secure world inside dmesg. like the following topic:

NOTICE: BL31: v1.3(release):tegra-l4t-r32.4.2
NOTICE: BL31: Built : 16:24:39, May 28 2020
ipc-unittest-main: 1519: Welcome to IPC unittest!!!
ipc-unittest-main: 1531: waiting forever
ipc-unittest-srv: 329: Init unittest services!!!
hwkey-agent: 40: hwkey-agent is running!!
hwkey-agent: 182: key_mgnt_processing …
hwkey-agent: 157: Init hweky-agent services!!

When compiling I use these flags:

make t186 PROJECT=t186 TARGET=t186 BUILDROOT=./t194ref TOOLCHAIN_PREFIX="${CROSS_COMPILE_AARCH64}" ARCH_arm_TOOLCHAIN_PREFIX="${CROSS_COMPILE_ARM}" ARCH_arm64_TOOLCHAIN_PREFIX="${CROSS_COMPILE_AARCH64}" DEBUG=1 DEBUG_LVL=1 DEFAULT_OTE_APP_DEBUGLEVEL=1 NOECHO=@ TRUSTY_VARIANT=l4t-public TRUSTY_MULTI_GUEST_CONFIGURATION= TARGET_SOC=t194

make BUILD_BASE=./t194ref CROSS_COMPILE="${CROSS_COMPILE_AARCH64}" DEBUG=1 LOG_LEVEL=20 PLAT=tegra SPD=trusty TARGET_SOC=t194 V=0

Is there any detailed method to follow to get the same output?

I have been stuck for a few days and I would be grateful if you can help guide me to a solution so I can continue developing.
Thank you in advance for your help!

hello n3k0m4,

you should generating the tos.img with ATF and Trusty images,
after that, had you also update the binaries with the flash.sh,
you should re-flash the TOS image using the partition update commands,
for example.
$ sudo ./flash.sh -k secure-os jetson-xavier mmcblk0p1

hello JerryChang,
Thank you for quick reply. I actually generate the tos.img with ATF and Trusty images using my compile.sh .
Compile.sh :

export CROSS_COMPILE=/home/lgiori/l4t-gcc/gcc-linaro-7.3.1-2018.05-x86_64_aarch64-linux-gnu/bin/aarch64-linux-gnu-
export CROSS_COMPILE_AARCH64=/home/lgiori/l4t-gcc/gcc-linaro-7.3.1-2018.05-x86_64_aarch64-linux-gnu/bin/aarch64-linux-gnu-
export CROSS_COMPILE_ARM=/home/lgiori/l4t-gcc/gcc-linaro-7.3.1-2018.05-x86_64_arm-linux-gnueabihf/bin/arm-linux-gnueabihf-

## Compile ATF and TOS
cd /trusty/atf/arm-trusted-firmware
make BUILD_BASE=./t194ref CROSS_COMPILE="${CROSS_COMPILE_AARCH64}" DEBUG=0 LOG_LEVEL=20 PLAT=tegra SPD=trusty TARGET_SOC=t194 V=0

cd /trusty/trusty/trusty
make t186 PROJECT=t186 TARGET=t186 BUILDROOT=./t194ref TOOLCHAIN_PREFIX="${CROSS_COMPILE_AARCH64}" ARCH_arm_TOOLCHAIN_PREFIX="${CROSS_COMPILE_ARM}" ARCH_arm64_TOOLCHAIN_PREFIX="${CROSS_COMPILE_AARCH64}" DEBUG=1 DEBUG_LVL=0 DEFAULT_OTE_APP_DEBUGLEVEL=1 NOECHO=@ TRUSTY_VARIANT=l4t-public TRUSTY_MULTI_GUEST_CONFIGURATION= TARGET_SOC=t194

## Copy Generate files into
cp /trusty/atf/arm-trusted-firmware/t194ref/tegra/t194/release/bl31.bin /home/lgiori/l4t-gcc/Linux_for_Tegra/nv_tegra/tos-scripts
cp /trusty/trusty/trusty/t194ref/build-t186/lk.bin /home/lgiori/l4t-gcc/Linux_for_Tegra/nv_tegra/tos-scripts

## Generate TOS image
cd /home/lgiori/l4t-gcc/Linux_for_Tegra/nv_tegra/tos-scripts
./gen_tos_part_img.py --monitor bl31.bin --os lk.bin tos_t194.img
## Replace the TOS image
cp tos_t194.img /home/lgiori/l4t-gcc/Linux_for_Tegra/bootloader/

## Place XAVIER in recovery mode
echo "==================================================="
echo "Place XAVIER in recovery mode AND "
echo cd /home/lgiori/l4t-gcc/Linux_for_Tegra/
echo sudo ./flash.sh -k secure-os jetson-xavier mmcblk0p1
echo "==================================================="

Then I put the board on recovery mode and flash it.

flash.sh

## Place XAVIER in recovery mode
echo "==================================================="
echo "Place XAVIER in recovery mode AND "

cd /home/lgiori/l4t-gcc/Linux_for_Tegra/
sudo ./flash.sh -k secure-os jetson-xavier mmcblk0p1
cd /trusty
echo "==================================================="

Using this I am able to get the applications up and running but I still can’t see any debug output from the secure world in dmesg.
I would like to know if there is any method to enable this output?
Thanks for your kindness and quick responses.

hello n3k0m4,

it looks incorrect file naming,
please try replace below TOS image file and re-flash secure-os partition again,
i.e. $OUT/Linux_for_Tegra/bootloader/tos-trusty_t194.img.

Hello JerryChang,
I tried changing the file names and flash again. the flash has failed and I get these errors.

Existing tbcfile(/home/lgiori/l4t-gcc/Linux_for_Tegra/bootloader/cboot_t194.bin) reused.
copying tbcdtbfile(/home/lgiori/l4t-gcc/Linux_for_Tegra/kernel/dtb/tegra194-p2888-0001-p2822-0000.dtb)... done.
copying cfgfile(/home/lgiori/l4t-gcc/Linux_for_Tegra/bootloader/t186ref/cfg/flash_t194_sdmmc.xml) to flash.xml... done.
Existing flasher(/home/lgiori/l4t-gcc/Linux_for_Tegra/bootloader/nvtboot_recovery_cpu_t194.bin) reused.
Existing flashapp(/home/lgiori/l4t-gcc/Linux_for_Tegra/bootloader/tegraflash.py) reused.
*** Updating [secure-os] with  ***
*** Error: the file for writing secure-os or signing is not specified. ****

Also before changing the names, tos_t194.img was actually pointing to tos-trusty_t194.img. That’s why I guess the flash was successful and the applications were running fine.

lrwxrwxrwx 1 lgiori lgiori          14 févr. 19 17:47 tos.img -> tos-trusty.img
-rw-r--r-- 1 lgiori lgiori       83360 févr. 19 17:47 tos-mon-only.img
-rw-r--r-- 1 lgiori lgiori       86960 févr. 19 17:47 tos-mon-only_t194.img
-rw-r--r-- 1 lgiori lgiori      394672 févr. 19 17:47 tos-trusty.img
lrwxrwxrwx 1 lgiori lgiori          19 févr. 19 17:47 tos_t194.img -> tos-trusty_t194.img

Thanks again for your quick replies.

hello n3k0m4,

oh, sorry, I’m not reading your question carefully.
this paragraph, it’s actually pop-up during bootloader stage, it’s before CBoot. (dmesg it only shows kernel logs.)

so,
please use J501, a micro-USB connector provides access to the UART console.
you may gather bootloader logs to have more details.
thanks

hello JerryChang,
Thanks for your quick reply. I will test the port and get back to you shortly.

Hello JerryChang,
I would like to thank you for you fast and effective replies.
I was able to get the communicate with the UART console with the help of this topic. And to get the boot data dumped I had to enable the DEBUG_LOAD_TRUSTY_APP flag mentioned in this topic.
Thanks,

1 Like

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.