Hi Matt,

Thanks for your investigation!
Will feedback this helpful information to psa arch test team to see if we can do some improvements on this : )

Thanks again.
Summer



From: Matt <majun.china@126.com>
Sent: Thursday, July 1, 2021 2:43 PM
To: Summer Qin <Summer.Qin@arm.com>
Cc: tf-m@lists.trustedfirmware.org <tf-m@lists.trustedfirmware.org>; nd <nd@arm.com>
Subject: Re:Re: [TF-M] How to build psa-arch-tests to debug mode with debug symbols
 
Hi summer,

Thanks for your reply.
Yes, The first step is to build psa-arch tests to produce val_nspe.a, pal_nspe.a and test_combine.a. And then none secure side will link these three static libraries to produce NSPE binary during TFM build.

I have found the CMAKE script file ARMCLANG.cmake under psa-arch-tests\api-tests\tools\cmake\compiler, and found the root cause of this issue.
In this file, there is a hardcode line as follows:
set(CMAKE_C_FLAGS              "--target=arm-arm-none-eabi ${TARGET_SWITCH} -Wall -Werror -Wextra -fshort-enums -fshort-wchar -funsigned-char -fdata-sections -ffunction-sections -mno-unaligned-access -mfpu=none")

After adding a new flag -gdwarf-3, the debug symbols will be produced for val_nspe.a, pal_nspe.a and test_combine.a, and so I can debug the psa-arch-test.

set(CMAKE_C_FLAGS              "--target=arm-arm-none-eabi ${TARGET_SWITCH} -Wall -Werror -Wextra -fshort-enums -fshort-wchar -funsigned-char -fdata-sections -ffunction-sections -mno-unaligned-access -mfpu=none -gdwarf-3")

Thanks,
Matt



At 2021-07-01 14:08:13, "Summer Qin" <Summer.Qin@arm.com> wrote:

Hi Matt,

Do you want to just build psa-arch tests alone?
I check the psa-arch-tests build command documentation (api-tests/dev_apis/README.md), it doesn't mention '-DCMAKE_BUILD_TYPE'.

Usually, we build it from TF-M side. It has debug symbols if you build from TF-M with '-DCMAKE_BUILD_TYPE=Debug'.
Also, you can build debug variant through the DS-5 environment. It also works.


BR,
Summer


From: TF-M <tf-m-bounces@lists.trustedfirmware.org> on behalf of Matt via TF-M <tf-m@lists.trustedfirmware.org>
Sent: Thursday, July 1, 2021 9:11 AM
To: tf-m@lists.trustedfirmware.org <tf-m@lists.trustedfirmware.org>
Subject: [TF-M] How to build psa-arch-tests to debug mode with debug symbols
 
Hi All experts,
I want to build psa-arch-tests to debug mode with debug symbols. I have tried the following command, but it does not take effect.

cmake ../ -G"<generator_name>" -DTARGET=<platform_name> -DCPU_ARCH=<cpu_architecture_version> -DCMAKE_BUILD_TYPE=Debug -DSUITE=<suite_name> -DPSA_INCLUDE_PATHS="<include_path1>;<include_path2>;...;<include_pathn>"
cmake --build .

How can I build psa-arch-tests to debug mode with debug symbols?

Thanks,
Matt