ARMmbed / mbed-os-tf-m-regression-tests

An Mbed OS application that runs the TF-M regression tests
2 stars 12 forks source link

Can't building the TF-M Regression Test suite #117

Closed jeromecoutant closed 2 years ago

jeromecoutant commented 3 years ago

Following https://github.com/ARMmbed/mbed-os-tf-m-regression-tests#building-the-tf-m-regression-test-suite I tried python3 build_tfm.py -m ARM_MUSCA_B1 -t GNUARM -c RegressionIPC

But it is failing:

[Build-TF-M] 17:35:00: [516/913] Building C object test/test_services/tfm_ps_test_service/CMakeFiles/tfm_psa_rot_partition_ps_test.dir/e54117c4759e20253631b698b86d3b6a/auto_generated/intermedia_tfm_ps_test_serv.ce.o
[Build-TF-M] 17:35:00: [517/913] Building C object test/test_services/tfm_secure_client_service/CMakeFiles/tfm_psa_rot_partition_secure_client_service.dir/__/__/__/generated/test_services/tfm_secure_client_serv.ce/auto_generated/intermedia_tfm_secure_client_service.o
[Build-TF-M] 17:35:00: FAILED: test/test_services/tfm_secure_client_service/CMakeFiles/tfm_psa_rot_partition_secure_client_service.dir/__/__/__/generated/test_services/tfm_secure_client_service/auto_generated/i.termedia_tfm_secure_client_service.o
[Build-TF-M] 17:35:00: C:\PROGRA~2\GNUARM~1\92020-~1\bin\AR19DD~1.EXE -DBL2 -DDAUTH_CHIP_DEFAULT -DMCUBOOT_IMAGE_NUMBER=2 -DMCUBOOT_SIGN_RSA -DMCUBOOT_SIGN_RSA_LEN=3072 -DPS_CREATE_FLASH_LAYOUT -DPS_CRYPTO_AEAD_ALG=PSA_ALG_GCM -DPS_ENCRYPTION -DPS_MAX_ASSET_SIZE=2048 -DPS_NUM_ASSETS=10 -DPS_ROLLBACK_PROTECTION -DPS_TEST_NV_COUNTERS -DPS_VALIDATE_METADATA_FROM_FLASH -DTFM_FIH_PROFILE_OFF -DTFM_LVL=1 -DTFM_PARTITION_CRYPTO -DTFM_PARTITION_FFM11 -DTFM_PARTITION_FIRMWARE_UPDATE -DTFM_PARTITION_INITIAL_ATTESTATION -DTFM_PARTITION_INTERNAL_TRUSTED_STORAGE -DTFM_PARTITION_LOG_LEVEL=TFM_PARTITION_LOG_LEVEL_SILENCE -DTFM_PARTITION_PLATFORM -DTFM_PARTITION_PROTECTED_STORAGE -DTFM_PARTITION_TEST_CORE -DTFM_PARTITION_TEST_CORE_IPC -DTFM_PARTITION_TEST_PS -DTFM_PARTITION_TEST_SECURE_SERVICES -DTFM_PSA_API -DTFM_SPM_LOG_LEVEL=TFM_SPM_LOG_LEVEL_SILENCE -Ilib/ext/tfm_test_repo-src/test/test_services/tfm_secure_client_service/. -Igenerated/test_services/tfm_secure_client_service -I../secure_fw/spm/include -I../secure_fw/spm/model_ipc/include -I../secure_fw/spm/arch/include -I../secure_fw/include -I../secure_fw/partitions/initial_attestation/. -I../secure_fw/partitions/protected_storage -I../secure_fw/partitions/internal_trusted_storage/../protected_storage -Ilib/ext/tfm_test_repo-src/test/test_services/tfm_core_test/. -Ilib/ext/tfm_test_repo-src/test/test_services/tfm_core_test_2/. -Ilib/ext/tfm_test_repo-src/test/test_services/tfm_ps_test_service/. -Ilib/ext/tfm_test_repo-src/test/test_services/tfm_secure_client_2/. -Ilib/ext/tfm_test_repo-src/test/test_services/tfm_ipc_service/. -Ilib/ext/tfm_test_repo-src/test/test_services/tfm_ipc_client/. -I../secure_fw/spm/cmsis_psa/arch -I../interface/include -Igenerated/interface/include -I../interface/include/os_wrapper -I../platform/ext/target/musca_b1/sse_200/. -I../platform/ext/target/musca_b1/sse_200/CMSIS_Driver -I../platform/ext/target/musca_b1/sse_200/CMSIS_Driver/Config -I../platform/ext/target/musca_b1/sse_200/Device/Config -I../platform/ext/target/musca_b1/sse_200/Device/Include -I../platform/ext/target/musca_b1/sse_200/Native_Driver -I../platform/ext/target/musca_b1/sse_200/partition -I../platform/ext/target/musca_b1/sse_200/services/include -I../platform/ext/target/musca_b1/sse_200/../common/Libraries -I../platform/ext/target/musca_b1/sse_200/../common/Native_Driver -I../platform/include -I../platform/ext -I../platform/ext/common -I../platform/ext/driver -I../platform/ext/cmsis -I../platform/ext/accelerator/interface -I../lib/fih/inc -Ilib/ext/tfm_test_repo-src/test/framework -I../interface/include/log -Ilib/ext/tfm_test_repo-src/test/suites/attestation/secure -Ilib/ext/tfm_test_repo-src/test/suites/crypto/secure -Ilib/ext/tfm_test_repo-src/test/suites/its/secure -Ilib/ext/tfm_test_repo-src/test/suites/ps/secure -Ilib/ext/tfm_test_repo-src/test/suites/platform/secure -Ilib/ext/tfm_test_repo-src/test/suites/fwu/secure -Ilib/ext/tfm_test_repo-src/test/suites/ipc/secure -I../secure_fw/spm -I../secure_fw/spm/cmsis_psa -I../secure_fw/spm/cmsis_psa/include -mcpu=cortex-m33 -O3 -DNDEBUG --specs=nano.specs -Wall -Wno-format -Wno-return-type -Wno-unused-but-set-variable -c -fdata-sections -ffunction-sections -fno-builtin -fshort-enums -funsigned-char -mthumb -nostdlib -std=c99 -msoft-float -mcmse -MD -MT test/test_services/tfm_secure_client_service/CMakeFiles/tfm_psa_rot_partition_secure_client_service.dir/__/__/__/generated/test_services/tfm_secure_client_service/auto_generated/intermedia_tfm_secure_client_service.o -MF test\test_services\tfm_secure_client_service\CMakeFiles\tfm_psa_rot_partition_secure_client_service.dir\__\__\__\generated\test_services\tfm_secure_client_service\auto_generated\intermedia_tfm_secure_client_service.o.d -o test/test_services/tfm_secure_client_service/CMakeFiles/tfm_psa_rot_partition_secure_client_service.dir/__/__/__/generated/test_services/tfm_secure_client_service/auto_generated/intermedia_tfm_secure_client_service.o -c generated/test_services/tfm_secure.client_service/auto_generated/intermedia_tfm_secure_client_service.c
[Build-TF-M] 17:35:00: generated/test_services/tfm_secure_client_service/auto_generated/intermedia_tfm_secure_client_service.c:12:1: fatal error: opening dependency file test\test_services\tfm_secure_client_service\CMakeFiles\tfm_psa_rot_partition_secure_client_service.dir\__\__\__\generated\test_services\tfm_secure_client_service\auto_generated\intermedia_tfm_secure_client_service.o.d: No such file or directory.
[Build-TF-M] 17:35:00:    12 | uint8_t tfm_sp_secure_test_partition_stack[0x0D00] __attribute__((aligned(8)));.
[Build-TF-M] 17:35:00:       | ^~~~~~~.
.Build-TF-M] 17:35:00: compilation terminated.
LDong-Arm commented 3 years ago

Hi @jeromecoutant, I can't reproduce this issue locally. Could you please try a clean fetch & build:

mbed-tools import mbed-os-tf-m-regression-tests
cd mbed-os-tf-m-regression-tests
python3 build_tfm.py -m ARM_MUSCA_B1 -t GNUARM -c RegressionIPC

and see if the issue persists?

jeromecoutant commented 3 years ago

Here is what I have done:

git clone https://github.com/ARMmbed/mbed-os-tf-m-regression-tests.git
cd mbed-os-tf-m-regression-tests
git clone https://github.com/ARMmbed/mbed-os.git
python build_tfm.py -m ARM_MUSCA_B1 -t GNUARM -c RegressionIPC

...

.Build-TF-M] 19:34:34: [504/913] Building C object test/test_services/tfm_core_test_2/CMakeFiles/tfm_app_rot_partition_core_test_2.dir/__/__/__/__/secure_fw/partitions/firmware_update/tfm_fwu_secure_api.o
.Build-TF-M] 19:34:34: [505/913] Building C object test/test_services/tfm_core_test/CMakeFiles/tfm_psa_rot_partition_core_test.dir/__/__/framework/test_framework_helpers.o
.Build-TF-M] 19:34:34: [506/913] Building C object test/test_services/tfm_core_test_2/CMakeFiles/tfm_app_rot_partition_core_test_2.dir/tfm_ss_core_test_2.o
.Build-TF-M] 19:34:35: [507/913] Building C object test/test_services/tfm_core_test_2/CMakeFiles/tfm_app_rot_partition_core_test_2.dir/a14cb1dd6f5bebccb743906643335f6b/intermedia_tfm_ss_core_test_2.o
.Build-TF-M] 19:34:35: [508/913] Building C object test/test_services/tfm_core_test_2/CMakeFiles/tfm_app_rot_partition_core_test_2.dir/__/__/__/__/interface/src/psa/psa_service.o
[Build-TF-M] 19:34:35: ninja: error: mkdir(test/test_services/tfm_secure_client_service/CMakeFiles/tfm_psa_rot_partition_secure_client_service.dir/__/__/__/generated/test_services/tfm_secure_client_service/auto.generated): No such file or directory
.Build-TF-M] 19:34:35: ninja: build stopped: .
[Build-TF-M] 19:34:35: Cmake build failed for target ARM_MUSCA_B1 using toolchain GNUARM.

Maybe it is the famous long path windows issue.....

LDong-Arm commented 3 years ago

Maybe it is the famous long path windows issue.....

Sounds likely. Have you tried putting mbed-os-tf-m-regression-tests in a shallower directory on your PC?

jeromecoutant commented 3 years ago

Sounds likely. Have you tried putting mbed-os-tf-m-regression-tests in a shallower directory on your PC?

OK, I can try, but it is not the solution... :-)

jeromecoutant commented 3 years ago

No, I couldn't make it work at /c/ level

LDong-Arm commented 3 years ago

Sounds likely. Have you tried putting mbed-os-tf-m-regression-tests in a shallower directory on your PC?

OK, I can try, but it is not the solution... :-)

The CMake build paths of trusted-firmware-m (TF-M) are rather deep. When I built trusted-firmware-m manually on Windows, the path was borderline too long and moving the repository by one directory or so changed the result... Sometime CMake warns you about paths lengths being too long on Windows, earlier in the log.

Unfortunately there's not much we can do on the Mbed OS side, as we're just letting the trusted-firmware-m repo build itself. I'll raise a suggestion to shorten paths to the TF-M team.

Meantime, could you please try removing the path restriction as per the Windows 10 documentation from Microsoft? Please let us know if it works for you, thanks.

No, I couldn't make it work at /c/ level

Was it the same failure?

jeromecoutant commented 3 years ago

Patch for path restrictions doesn't work.... It is always failing at

[Build-TF-M] 09:40:58: FAILED: test/test_services/tfm_secure_client_service/CMakeFiles/tfm_psa_rot_partition_secure_client_service.dir/__/__/__/generated/test_services/tfm_secure_client_service/auto_generated/i.termedia_tfm_secure_client_service.o

Could you check https://wuhrr.wordpress.com/2011/01/20/use-subst-to-deal-with-long-path-names/ in case it could be applicable for windows user/customer?

LDong-Arm commented 3 years ago

@jeromecoutant Thanks for the suggestion, I'll try to see what's the best we can do.

The main thing is, CMake generates Ninja files and ninja does the actual build. But Ninja doesn't support long paths yet, someone has a PR open for that: https://github.com/ninja-build/ninja/pull/1939

Even if the system-wide path restriction is remove, that seems not enough - applications also need to be adjusted to take advantage of the long path support.

(Apparently "make" doesn't support it either, so switching from ninja back to make doesn't help either.)

LDong-Arm commented 3 years ago

Hi @jeromecoutant, for now if you both rename mbed-os-tf-m-regression-tests to a shorter name (e.g. mbed-tf-m) and put it in a short path (e.g. /c/work/), it'll likely let you proceed with the work at least. Before ninja properly supports long paths on Windows.

jeromecoutant commented 3 years ago

This workaround is OK:

subst.exe O: $PWD
cd /o/
python build_tfm.py -m ARM_MUSCA_B1 -t GNUARM -c RegressionIPC

Maybe it could be documented or included in the python script ?