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

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

Build regression failure with ARMCLANG #52

Closed ccli8 closed 3 years ago

ccli8 commented 4 years ago

Environment

mbed-os-tf-m-regression-tests 57a5054383965c0a297133de0030e5d6046e5ae8

mbed-os 0db72d0cf26539016efbe38f80d6f2cb7a3d4414 (mbed-os-6.3.0-rc2)

ARMCLANG ARM Compiler 6.13.1

Steps to reproduce

Build TF-M and regression test OK:

# python3 build_tfm.py -m ARM_MUSCA_B1 -t ARMCLANG -c ConfigRegressionIPC.cmake
[Build-TF-M] 17:16:58: Using folder C:\ccli8\iot\mbed\mbed-tfm\mbed-os-tf-m-regression-tests\mbed-os\platform/FEATURE_EXPERIMENTAL_API/FEATURE_PSA/TARGET_TFM/TARGET_TFM_V1_1\TARGET_IGNORE.
[Build-TF-M] 17:16:58: Cloning trusted-firmware-m repo.
[Build-TF-M] 17:17:31: Cloned trusted-firmware-m repo successfully.
[Build-TF-M] 17:17:31: Cloning mbed-crypto repo.
[Build-TF-M] 17:18:15: Cloned mbed-crypto repo successfully.
[Build-TF-M] 17:18:15: Cloning mcuboot repo.
[Build-TF-M] 17:18:23: Cloned mcuboot repo successfully.
[Build-TF-M] 17:18:23: Cloning tf-m-tests repo.
[Build-TF-M] 17:18:29: Cloned tf-m-tests repo successfully.
[Build-TF-M] 17:18:30: TF-M version: a630d86e91a8.
[Build-TF-M] 17:18:30: Building TF-M for target ARM_MUSCA_B1 using toolchain ARMCLANG.

......

[Build-TF-M] 17:27:55: -- Installing: C:/CCLi8/IoT/mbed/mbed-tfm/mbed-os-tf-m-regression-tests/mbed-os/platform/FEATURE_EXPERIMENTAL_API/FEATURE_PSA/TARGET_TFM/TARGET_TFM_V1_1/TARGET_IGNORE/trusted-firmware-m/cmake_build/install/outputs/fvp/tfm_ns.elf.
[Build-TF-M] 17:27:55: -- Installing: C:/CCLi8/IoT/mbed/mbed-tfm/mbed-os-tf-m-regression-tests/mbed-os/platform/FEATURE_EXPERIMENTAL_API/FEATURE_PSA/TARGET_TFM/TARGET_TFM_V1_1/TARGET_IGNORE/trusted-firmware-m/cmake_build/install/export/tfm/test/lib/libtfm_non_secure_tests.a.
[Build-TF-M] 17:27:55: -- Installing: C:/CCLi8/IoT/mbed/mbed-tfm/mbed-os-tf-m-regression-tests/mbed-os/platform/FEATURE_EXPERIMENTAL_API/FEATURE_PSA/TARGET_TFM/TARGET_TFM_V1_1/TARGET_IGNORE/trusted-firmware-m/cmake_build/install/outputs/MUSCA_B1/mcuboot.axf.
[Build-TF-M] 17:27:55: -- Installing: C:/CCLi8/IoT/mbed/mbed-tfm/mbed-os-tf-m-regression-tests/mbed-os/platform/FEATURE_EXPERIMENTAL_API/FEATURE_PSA/TARGET_TFM/TARGET_TFM_V1_1/TARGET_IGNORE/trusted-firmware-m/cmake_build/install/outputs/MUSCA_B1/mcuboot.bin.
[Build-TF-M] 17:27:55: -- Installing: C:/CCLi8/IoT/mbed/mbed-tfm/mbed-os-tf-m-regression-tests/mbed-os/platform/FEATURE_EXPERIMENTAL_API/FEATURE_PSA/TARGET_TFM/TARGET_TFM_V1_1/TARGET_IGNORE/trusted-firmware-m/cmake_build/install/outputs/MUSCA_B1/mcuboot.hex.
[Build-TF-M] 17:27:55: -- Installing: C:/CCLi8/IoT/mbed/mbed-tfm/mbed-os-tf-m-regression-tests/mbed-os/platform/FEATURE_EXPERIMENTAL_API/FEATURE_PSA/TARGET_TFM/TARGET_TFM_V1_1/TARGET_IGNORE/trusted-firmware-m/cmake_build/install/outputs/MUSCA_B1/mcuboot.elf.
[Build-TF-M] 17:27:55: -- Installing: C:/CCLi8/IoT/mbed/mbed-tfm/mbed-os-tf-m-regression-tests/mbed-os/platform/FEATURE_EXPERIMENTAL_API/FEATURE_PSA/TARGET_TFM/TARGET_TFM_V1_1/TARGET_IGNORE/trusted-firmware-m/cmake_build/install/outputs/fvp/mcuboot.axf.
[Build-TF-M] 17:27:55: -- Installing: C:/CCLi8/IoT/mbed/mbed-tfm/mbed-os-tf-m-regression-tests/mbed-os/platform/FEATURE_EXPERIMENTAL_API/FEATURE_PSA/TARGET_TFM/TARGET_TFM_V1_1/TARGET_IGNORE/trusted-firmware-m/cmake_build/install/outputs/fvp/mcuboot.bin.
[Build-TF-M] 17:27:55: -- Installing: C:/CCLi8/IoT/mbed/mbed-tfm/mbed-os-tf-m-regression-tests/mbed-os/platform/FEATURE_EXPERIMENTAL_API/FEATURE_PSA/TARGET_TFM/TARGET_TFM_V1_1/TARGET_IGNORE/trusted-firmware-m/cmake_build/install/outputs/fvp/mcuboot.hex.
[Build-TF-M] 17:27:55: -- Installing: C:/CCLi8/IoT/mbed/mbed-tfm/mbed-os-tf-m-regression-tests/mbed-os/platform/FEATURE_EXPERIMENTAL_API/FEATURE_PSA/TARGET_TFM/TARGET_TFM_V1_1/TARGET_IGNORE/trusted-firmware-m/cmake_build/install/outputs/fvp/mcuboot.elf.
[Build-TF-M] 17:27:55: Copying platform\FEATURE_EXPERIMENTAL_API\FEATURE_PSA\TARGET_TFM\TARGET_TFM_V1_1\TARGET_IGNORE\trusted-firmware-m\cmake_build\install\outputs\MUSCA_B1\tfm_s.axf to targets\TARGET_ARM_SSG\TARGET_MUSCA_B1.
[Build-TF-M] 17:27:55: Copying platform\FEATURE_EXPERIMENTAL_API\FEATURE_PSA\TARGET_TFM\TARGET_TFM_V1_1\TARGET_IGNORE\trusted-firmware-m\cmake_build\install\outputs\MUSCA_B1\tfm_s.bin to targets\TARGET_ARM_SSG\TARGET_MUSCA_B1.
[Build-TF-M] 17:27:55: Copying files/folders from TF-M to Mbed OS.
[Build-TF-M] 17:27:56: Copying files/folders from TF-M to regression test.

Build Mbed OS+TF-M regression test failed:

# mbed compile -m ARM_MUSCA_B1 -t ARMC6
Building project mbed-os-tf-m-regression-tests (ARM_MUSCA_B1, ARMC6)
Scan: mbed-os-tf-m-regression-tests
Configuration error: Bootloader not supported on this target. ROM start not found in targets.json.
Configuration error: Bootloader not supported on this target. RAM start not found in targets.json.
Compile [  0.3%]: irq_armv8mml.S
Compile [  0.6%]: cmsis_os1.c
Compile [  0.9%]: RTX_Config.c
Compile [  1.2%]: rtx_evr.c

......

Compile [ 98.5%]: sleep_api.c
Compile [ 98.8%]: tfm_ioctl_ns_api.c
Compile [ 99.1%]: os_wrapper_cmsis_rtos_v2.c
Compile [ 99.4%]: serial_api.c
Compile [ 99.7%]: pinmap_ns.c
[Warning] RTX_Config.h@575,9: 'OS_THREAD_LIBSPACE_NUM' macro redefined [-Wmacro-redefined]
Compile [100.0%]: us_ticker.c
Link: mbed-os-tf-m-regression-tests
[Warning] @0,0: L3912W: Option 'legacyalign' is deprecated.
[Error] @0,0: L6218E: Undefined symbol CMSDK_TIMER0_DEV_S (referred from ./test/lib/TOOLCHAIN_ARMC6/libtfm_non_secure_tests.ar(plat_test.o)).
Warning: L3912W: Option 'legacyalign' is deprecated.
Error: L6218E: Undefined symbol CMSDK_TIMER0_DEV_S (referred from ./test/lib/TOOLCHAIN_ARMC6/libtfm_non_secure_tests.ar(plat_test.o)).
Finished: 0 information, 1 warning and 1 error messages.
[ERROR] Warning: L3912W: Option 'legacyalign' is deprecated.
Error: L6218E: Undefined symbol CMSDK_TIMER0_DEV_S (referred from ./test/lib/TOOLCHAIN_ARMC6/libtfm_non_secure_tests.ar(plat_test.o)).
Finished: 0 information, 1 warning and 1 error messages.

[mbed] Working path "C:\ccli8\iot\mbed\mbed-tfm\mbed-os-tf-m-regression-tests" (program)
[mbed] WARNING: Could not find mbed program in current path "C:\ccli8\iot\mbed\mbed-tfm\mbed-os-tf-m-regression-tests".
       You can fix this by calling "mbed new ." in the root of your program.
---
[mbed] ERROR: "c:\python37\python.exe" returned error.
       Code: 1
       Path: "C:\ccli8\iot\mbed\mbed-tfm\mbed-os-tf-m-regression-tests"
       Command: "c:\python37\python.exe -u C:\ccli8\iot\mbed\mbed-tfm\mbed-os-tf-m-regression-tests\mbed-os\tools\make.py -t ARMC6 -m ARM_MUSCA_B1 --source . --build .\BUILD\ARM_MUSCA_B1\ARMC6"
       Tip: You could retry the last command with "-v" flag for verbose output
---

If I change toolchain to GCC, it is OK.

LDong-Arm commented 3 years ago

@ccli8 Thanks for raising this issue. It turns out that CMSDK_TIMER0_DEV_S is really undefined, but its caller is unused either so we don't need this CMSDK_TIMER0_DEV_S in the final application binary. The Arm linker doesn't handle this scenario. To have that symbol defined, we can enable the macro CMSDK_TIMER0_S in https://github.com/ARMmbed/mbed-os/blob/36df9d10436487625810a43f922b7fb975e5eec7/targets/TARGET_ARM_SSG/TARGET_MUSCA_B1/device/device_definition.c#L358-L364