Getting errors while porting SE050 on STM32MP1 platform

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Getting errors while porting SE050 on STM32MP1 platform

2,251 Views
pratik_manvar
Contributor III

Hello NXP-Team,

I am trying to create a recipe to add se050x libraries to my Yocto image for stm32mp157 but without success.

For that, I have downloaded source from NXP EdgeLock SE05x Plug & Trust Middleware (04.01.01)

I followed the steps mentioned in "Secure_chip/simw-top/doc/building/imx6.html" doc from downloaded source itself. The build is working in my x86 Linux machine. But, when I am trying to build the same source in my STM32MP1 Yocto 32bit platform, I was seeing wrong ELF class while loading the shared library libssl.so.


Can you please provide the recipe or suggest necessary modifications required to work for 32bit platform?

Below are the error logs:

---------------------------------------------------------------------------

ERROR: secure-new-1.0-r0 do_compile: Execution of 'jci-kt-x/stm32mp1/distribution-package/openstlinux-5.4-dunfell-mp1-20-06-24/build-openstlinuxweston-stm32mp1-eval/tmp-glibc/work/stm32mp1_eval-ostl-linux-gnueabi/secure-new/1.0-r0/temp/run.do_compile.32366' failed with exit code 127:
==============> Compiling secure chip source
INFO:__main__:Preprocessing jci-kt-x/stm32mp1/distribution-package/openstlinux-5.4-dunfell-mp1-20-06-24/layers/meta-jci/recipes-core/secure-new/src/secure-chip/simw-top/ext/open62541/tools/schema/Opc.Ua.NodeSet2.Minimal.xml
INFO:__main__:Generating Code for Backend: open62541
INFO:__main__:NodeSet generation code successfully printed
cmake: error while loading shared libraries: libssl.so.1.1: wrong ELF class: ELFCLASS32
cmake: error while loading shared libraries: libssl.so.1.1: wrong ELF class: ELFCLASS32
cmake: error while loading shared libraries: libssl.so.1.1: wrong ELF class: ELFCLASS32


### Cross compiled for A71CH using SCI2C
#cmake -DHostCrypto=OPENSSL -DApplet=A71CH -DHost=iMXLinux -DCMAKE_BUILD_TYPE=Debug -DSMCOM=SCI2C -DCMAKE_TOOLCHAIN_FILE=jci-kt-x/stm32mp1/distribution-package/openstlinux-5.4-dunfell-mp1-20-06-24/layers/meta-jci/recipes-core/secure-new/src/secure-chip/simw-top/scripts/../scripts/ToolchainFile_imx6.cmake


### Cross compiled for SE05x using T=1 over I2C
#cmake -DHostCrypto=OPENSSL -DApplet=SE05X_C -DHost=iMXLinux -DCMAKE_BUILD_TYPE=Debug -DSMCOM=T1oI2C -DCMAKE_TOOLCHAIN_FILE=jci-kt-x/stm32mp1/distribution-package/openstlinux-5.4-dunfell-mp1-20-06-24/layers/meta-jci/recipes-core/secure-new/src/secure-chip/simw-top/scripts/../scripts/ToolchainFile_imx6.cmake


### JRCP V1 on Linux
#cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DApplet=SE05X_C -DCMAKE_ECLIPSE_VERSION="4.5 (Mars)" -DHost=PCLinux64 -DCMAKE_BUILD_TYPE=Debug -DSMCOM=JRCP_V1 -G "Eclipse CDT4 - Unix Makefiles"
==============> Jumping in build dir imx_cc_se050_t1oi2c
==============> Start building
cmake: error while loading shared libraries: libssl.so.1.1: wrong ELF class: ELFCLASS32
WARNING: exit code 127 from a shell command.

ERROR: Logfile of failure stored in: jci-kt-x/stm32mp1/distribution-package/openstlinux-5.4-dunfell-mp1-20-06-24/build-openstlinuxweston-stm32mp1-eval/tmp-glibc/work/stm32mp1_eval-ostl-linux-gnueabi/secure-new/1.0-r0/temp/log.do_compile.32366

--------------------------------------------------------------------------------------

Thank You,

Regards,

Shivashankar Thati

0 Kudos
Reply
7 Replies

2,209 Views
pratik_manvar
Contributor III

Hi,

These are the commands used in .bb file for compiling and sharing the error logs as well.

do_compile() {
echo "==============> Compiling secure chip source"
cd ${OEROOT}/layers/meta-jci/recipes-core/secure-chip/src/secure-chip/simw-top/
python3 scripts/create_cmake_projects.py # invoke this only once
echo "==============> Jumping in build dir imx_cc_se050_t1oi2c"
cd ${OEROOT}/layers/meta-jci/recipes-core/secure-chip/src/secure-chip/simw-top_build/imx_cc_se050_t1oi2c
cmake -L  

make install
ldconfig /usr/local/lib

}

======>

Sharing you the output of  cmake -L .Please find the logs below .

 

-- BUILD_TYPE: Debug
-- Found: /home/pratik/project/jci-kt-x/stm32mp1/distribution-package/stm32mp157f-v5.4-dunfell-20-06-24/build-openstlinuxweston-stm32mp1-eval/tmp-glibc/work/stm32mp1_eval-ostl-linux-gnueabi/secure-chip/1.0-r0/recipe-sysroot-native/usr/lib/libssl.so/home/pratik/project/jci-kt-x/stm32mp1/distribution-package/stm32mp157f-v5.4-dunfell-20-06-24/build-openstlinuxweston-stm32mp1-eval/tmp-glibc/work/stm32mp1_eval-ostl-linux-gnueabi/secure-chip/1.0-r0/recipe-sysroot-native/usr/lib/libcrypto.so
-- CMAKE_CXX_COMPILER_ID = GNU
-- CMAKE_SYSTEM_NAME = Linux
-- PTMW_SE05X_Auth - None
-- CMake version: 3.16.5
-- CMake system name: Linux
-- Timestamp is 1970-01-01T00:00:00Z
accessManager is not copied to default binary directory upon install
-- Configuring done
-- Generating done
-- Build files have been written to: /home/pratik/project/jci-kt-x/stm32mp1/distribution-package/stm32mp157f-v5.4-dunfell-20-06-24/layers/meta-jci/recipes-core/secure-chip/src/secure-chip/simw-top_build/imx_cc_se050_t1oi2c
-- Cache values
CMAKE_BUILD_TYPE:STRING=Debug
CMAKE_CXX_COMPILER_ARG1:STRING= -mthumb -mfpu=neon-vfpv4 -mfloat-abi=hard -mcpu=cortex-a7 --sysroot=/home/pratik/project/jci-kt-x/stm32mp1/distribution-package/stm32mp157f-v5.4-dunfell-20-06-24/build-openstlinuxweston-stm32mp1-eval/tmp-glibc/work/stm32mp1_eval-ostl-linux-gnueabi/secure-chip/1.0-r0/recipe-sysroot
CMAKE_C_COMPILER_ARG1:STRING= -mthumb -mfpu=neon-vfpv4 -mfloat-abi=hard -mcpu=cortex-a7 --sysroot=/home/pratik/project/jci-kt-x/stm32mp1/distribution-package/stm32mp157f-v5.4-dunfell-20-06-24/build-openstlinuxweston-stm32mp1-eval/tmp-glibc/work/stm32mp1_eval-ostl-linux-gnueabi/secure-chip/1.0-r0/recipe-sysroot
CMAKE_INSTALL_PREFIX:PATH=/usr/local
LIB_ANL:FILEPATH=/usr/lib32/libanl.so
NXPInternal:BOOL=OFF
OPENSSL_ROOT_DIR:PATH=
PAHO_BUILD_DEB_PACKAGE:BOOL=FALSE
PAHO_BUILD_DOCUMENTATION:BOOL=FALSE
PAHO_BUILD_SAMPLES:BOOL=FALSE
PAHO_BUILD_SHARED:BOOL=FALSE
PAHO_BUILD_STATIC:BOOL=TRUE
PAHO_ENABLE_CPACK:BOOL=TRUE
PAHO_ENABLE_TESTING:BOOL=FALSE
PAHO_WITH_SSL:BOOL=TRUE
PTMW_A71CH_AUTH:STRING=None
PTMW_Applet:STRING=SE05X_C
PTMW_FIPS:STRING=None
PTMW_Host:STRING=iMXLinux
PTMW_HostCrypto:STRING=OPENSSL
PTMW_Log:STRING=Default
PTMW_RTOS:STRING=Default
PTMW_SBL:STRING=None
PTMW_SCP:STRING=None
PTMW_SE05X_Auth:STRING=None
PTMW_SE05X_Ver:STRING=03_XX
PTMW_SMCOM:STRING=T1oI2C
PTMW_mbedTLS_ALT:STRING=None
SSSFTR_SE05X_AES:BOOL=ON
SSSFTR_SE05X_AuthECKey:BOOL=ON
SSSFTR_SE05X_AuthSession:BOOL=ON
SSSFTR_SE05X_CREATE_DELETE_CRYPTOOBJ:BOOL=ON
SSSFTR_SE05X_ECC:BOOL=ON
SSSFTR_SE05X_KEY_GET:BOOL=ON
SSSFTR_SE05X_KEY_SET:BOOL=ON
SSSFTR_SE05X_RSA:BOOL=ON
SSSFTR_SW_AES:BOOL=ON
SSSFTR_SW_ECC:BOOL=ON
SSSFTR_SW_KEY_GET:BOOL=ON
SSSFTR_SW_KEY_SET:BOOL=ON
SSSFTR_SW_RSA:BOOL=ON
SSSFTR_SW_TESTCOUNTERPART:BOOL=ON
WithAccessMgr_UnixSocket:BOOL=OFF
WithCodeCoverage:BOOL=OFF
WithExtCustomerTPMCode:BOOL=OFF
WithNXPNFCRdLib:BOOL=OFF
WithOPCUA_open62541:BOOL=OFF
WithSharedLIB:BOOL=OFF

error logs :
[ 27%] Built target a7x_utils
| [ 29%] Built target se05x
| [ 37%] Built target SSS_APIs
| /home/pratik/project/jci-kt-x/stm32mp1/distribution-package/stm32mp157f-v5.4-dunfell-20-06-24/build-openstlinuxweston-stm32mp1-eval/tmp-glibc/work/stm32mp1_eval-ostl-linux-gnueabi/secure-chip/1.0-r0/recipe-sysroot-native/usr/lib/libssl.so: file not recognized: file format not recognized
| collect2: error: ld returned 1 exit status
| /home/pratik/project/jci-kt-x/stm32mp1/distribution-package/stm32mp157f-v5.4-dunfell-20-06-24/build-openstlinuxweston-stm32mp1-eval/tmp-glibc/work/stm32mp1_eval-ostl-linux-gnueabi/secure-chip/1.0-r0/recipe-sysroot-native/usr/lib/libssl.so: file not recognized: file format not recognized
| collect2: error: ld returned 1 exit status
| hostlib/hostLib/accessManager/CMakeFiles/accessManager.dir/build.make:132: recipe for target 'bin/accessManager' failed
| make[2]: *** [bin/accessManager] Error 1
| hostlib/hostLib/rjct/CMakeFiles/jrcpv1_server.dir/build.make:117: recipe for target 'bin/jrcpv1_server' failed
| make[2]: *** [bin/jrcpv1_server] Error 1
| CMakeFiles/Makefile2:1683: recipe for target 'hostlib/hostLib/accessManager/CMakeFiles/accessManager.dir/all' failed
| make[1]: *** [hostlib/hostLib/accessManager/CMakeFiles/accessManager.dir/all] Error 2
| make[1]: *** Waiting for unfinished jobs....
| CMakeFiles/Makefile2:1655: recipe for target 'hostlib/hostLib/rjct/CMakeFiles/jrcpv1_server.dir/all' failed
| make[1]: *** [hostlib/hostLib/rjct/CMakeFiles/jrcpv1_server.dir/all] Error 2
| [ 41%] Built target ex_common
| [ 41%] Linking C shared library libsssapisw.so
| /home/pratik/project/jci-kt-x/stm32mp1/distribution-package/stm32mp157f-v5.4-dunfell-20-06-24/build-openstlinuxweston-stm32mp1-eval/tmp-glibc/work/stm32mp1_eval-ostl-linux-gnueabi/secure-chip/1.0-r0/recipe-sysroot-native/usr/lib/libssl.so: file not recognized: file format not recognized
| collect2: error: ld returned 1 exit status
| sss/CMakeFiles/sssapisw.dir/build.make:420: recipe for target 'sss/libsssapisw.so' failed
| make[2]: *** [sss/libsssapisw.so] Error 1
| CMakeFiles/Makefile2:1741: recipe for target 'sss/CMakeFiles/sssapisw.dir/all' failed
| make[1]: *** [sss/CMakeFiles/sssapisw.dir/all] Error 2
| Makefile:151: recipe for target 'all' failed
| make: *** [all] Error 2
| WARNING: exit code 2 from a shell command.

 

Regards,

Shivashankar Thati

0 Kudos
Reply

2,197 Views
Kan_Li
NXP TechSupport
NXP TechSupport

Hi @pratik_manvar ,

 

Thanks for the information!

 

I found the system time had not been updated to the latest, Did you synchronize the time before building? 

-- Timestamp is 1970-01-01T00:00:00Z

 

Please kindly clarify.

 

Have a great day,
Kan


-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!
- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

0 Kudos
Reply

2,157 Views
pratik_manvar
Contributor III

Hi @Kan_Li,

Thanks for your reply.

Yes, I have checked the timestamp of my Linux machine using date command and it is showing current time and date.

But, when I build using bitbake, I don't have any idea why it is showing epoch time.

Please help us to build the code .

 

Regards,

Shivashankar Thati

0 Kudos
Reply

2,154 Views
Kan_Li
NXP TechSupport
NXP TechSupport

Hi @pratik_manvar ,

 

Actually it is hard to reproduce this issue here as we have no STM32MP1 platform, but the MW can be built successfully on i.MX platform as well as Raspberry Pi, and we don't use bitbake in the building, so is it possible to build the MW without bitbake from your side? Is the problem still there? Please kindly clarify.

 

Have a great day,
Kan


-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!
- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

0 Kudos
Reply

2,142 Views
pratik_manvar
Contributor III

Hi @Kan_Li,

Yes, I understand. I guess both i.MX and Raspberry Pi both are 64-bit platforms.

Our STM32MP1 platform is 32-bit platform. But, it is trying to build for 64-bit platform.

That's why it is failing to link 32-bit library (libssl.so in our case).

So, we are trying to find the flag in CMakeFiles.txt to build to 32-bit platform. Can you please help us to find any way (e.g., some flags in CMakeFiles.txt) to build for 32-bit platform instead of 64-bit platform?

If we are able to find out the way to build for 32-bit platform, we will be able to get rid of this issue I guess.

Thank you for your help.

Regards,

Pratik Manvar 

0 Kudos
Reply

2,139 Views
Kan_Li
NXP TechSupport
NXP TechSupport

Hi @pratik_manvar ,

 

Actually I am not expertise on cmake, but maybe you can try the solution as mentioned below:

https://stackoverflow.com/questions/5805874/the-proper-way-of-forcing-a-32-bit-compile-using-cmake 

 

Hope that helps,

 

Have a great day,
Kan


-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!
- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

0 Kudos
Reply

2,220 Views
Kan_Li
NXP TechSupport
NXP TechSupport

Hi @pratik_manvar ,

 

Thanks for reaching to us!

 

Is it possible to share your cmake options for a review? You may have it by running the following command from your build area:

cmake -L .

 

Thanks for your patience!

 

Have a great day,
Kan


-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!
- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

0 Kudos
Reply