This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Having trouble including cc310 library into Zephyr on ncs v1.3.0 release

So with my NRF52840 board I am trying to use the cc310 backend in zephyr. My project did work until I recently tried to upgrade to ncs v 1.3.0 . The issue was that the build would terminate at the linking stage because it could not find the definition for any of the cc310 backend operations (like mbedtls_sha256_init). 

I went through all the cmakelist files and kconfigs and whatnot. Ultimately I changed line 202 in \nrfxlib\nrf_security\src\mbedtls\CMakeLists.txt

from

target_link_libraries(mbedtls_base_vanilla PRIVATE mbedcrypto_cc310)

to

target_link_libraries(mbedtls_base_vanilla PRIVATE mbedcrypto_cc310_imported)

And everything linked fine.

I am not a cmake expert by any means.  I really barely understand whats going on sometimes. I see where a few lines up at 175, you add the cc310 sub-directory, and that cmakelist file does this:

set(cc310_libs
mbedcrypto_cc310_imported
mbedcrypto_cc310_noglue
)

combine_archives(mbedcrypto_cc310 "${cc310_libs}")

So that would suggest to me that the mbedcrypto_cc310_imported and mbedcrypto_cc310_no glue libraries were combined together into a single mbedcrypto_cc310 library. And That would make you version of line 202 make sense. However nothing from mbedcrypto_cc310_imported was getting linked.

In my build output, I could see modules/nrfxlib/nrf_security/src/mbedtls/cc310/libmbedcrypto_cc310.a being linked against at the end, but that file is almost empty (990 bytes). It certainly did not contain the entirety of

mbedcrypto_cc310_imported

which for me is 

nrfxlib/crypto/nrf_cc310_mbedcrypto/lib/cortex-m4/soft-float/no-interrupts/libnrf_cc310_mbedcrypto_0.9.2.a 

which is 401KB

Anyway maybe I am configuring something wrong, but my guess is there is an issue in the cmake list files.

I am not sure how the combine archives function works, but my guess is the problem is there. But I don't really know.

And like I said, my work around does the job, but I don't want to have to fork the repo just to make this one fix. So hopefully you can do a new release or tell me what I am doing wrong.

Let me know if you want any more info

Thanks

Parents
  • Hi, and thanks for the report.

    Sadly, I have not had much time to look at it today but will come back tomorrow for a deeper look at the issue.

    Are you building a sample or a custom application?

    Do you have a simple sample that demonstrates the issue?

    Best regards,

    Didrik

  • Ok I created a simple example and the problem (and my work around) persist.

    I used this board file

    zephyr/boards/arm/nrf52840dk_nrf52840

    I have attached a zip file with my files. I had to rename the extension to get it to load. So just change it back to zip.

    I am using the following repo versions in my west file

    - name: ncs
    url-base: https://github.com/nrfconnect
    - name: armmbed
    url-base: https://github.com/ARMmbed

    - name: zephyr
    repo-path: sdk-zephyr
    revision: v2.3.0-rc1-ncs1
    remote: ncs

    - name: nrfxlib
    path: nrfxlib
    revision: v1.3.0
    repo-path: sdk-nrfxlib
    remote: ncs

    - name: mbedtls-nrf
    path: mbedtls
    repo-path: mbedtls
    revision: mbedtls-2.16.6
    remote: armmbed

    PK�P�P�
    4��CMakeLists.txt��Ok�@��}���A9T���Wi
    �e,cH.�x5�6��]Ѹ�߽#��@)��v�{����4�H�(��`D��Aj�C�kV�>��?���,����m��@2�t�S�C���ͳH�X֛q�ZW0����s4��1dT����M:^b���<ö��4���X|����׍����̆���]���z�
    ����"`�(��4�g�S{<RR�>���U�N=�r*Ɓ@Yh�~��l��l�5�e�#<
    .�_�?AAQ��d����0ú�p����O�:��ք���mzd)�5�������#�{��LY����������~�݉�ES��Oe��Ϗ�Ӄט��VaS�m�^-oE���']�I��7���|
    ��?��0(�x�?!��'�B�<K�)�� Y�H��V�ž�
    *[�<{�z	<�s{>�
    w#�ߓ�q|�PK
    �P�P��3//Kconfig
        	
    source "$ZEPHYR_BASE/Kconfig.zephyr"
    PK�L�Pyo� �main.c]��
    �@��-�;vٕ�
    ��R��Bl]���J�޽=���03��Or!�]3�x7���n�\t�\���U�L��b�8[�Uգ�p|��mdNǠ���W]ܙ"��#P��鰄�@+�Ir�����'<W�z�{��3�V-zA�̦��`�A$��Y�|9�PK�P�P�Lq@V�prj.confm�;
    �0E�>���A;��$�`�@�ف���(�{��i�Jr�Eʇ�ű�"ۺ��W�l�Iv`��8���4C���O��PK?�P�P�
    4��$ CMakeLists.txt
     �8�`��8�`�zr���`�PK?
    �P�P��3//$ �Kconfig
     8�/<�`�8�/<�`�K���`�PK?�L�Pyo� �$ <main.c
     ~4Q�`�~4Q�`�$����`�PK?�P�P�Lq@V�$ prj.conf
     �1�`��1�`��ֲ��`�PKk|

  • Thanks for the sample.

    To me, it looks like the problem is specific to Segger Embedded Studio. Is that what you are using to build?

    Do you see the same problem if you build from the command line with West?

    Also, regarding your workaround for the mbedtls config name, that too seems like a SES problem. Another customer has proposed another solution to that problem here: https://devzone.nordicsemi.com/f/nordic-q-a/63888/there-is-a-bug-in-sdk-1-3-0-when-compile-the-mbedtls-under-the-path-of-modules-nrfxlib-nrf_security-src-mbedtls-i-get-the-following-error-mbedtls-library-chacha20-c-29-10-error-include-expects-filename-or

    Anyway, I'll report both issues internally so that they can be fixed.

  • Sorry I never wrote back. Yes building from the command line does work. So that's good. Its frustrating that SES has so many issues. There are many things I like about it, but many things that don't work right also. It crashes all the time for me. And they almost never respond if I post issues on their board.

Reply Children
No Data
Related