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

AES example in SDK version 17.0.0 does not compile out of the box

Hello.

Trying to compile the AES CBC MAC example out of the box, we get the ferror below.

Your help would be appreciated.

Many thanks,

Andrew

Building ‘nrf_crypto_aes_cbc_mac_pca10040’ from solution ‘nrf_crypto_aes_cbc_mac_pca10040’ in configuration ‘Release’

....

Linking nrf_crypto_aes_cbc_mac_pca10040.elf
    cannot find ../../../../../../../../external/micro-ecc/nrf52hf_armgcc/armgcc/micro_ecc_lib_nrf52.a: No such file or directory
Build failed

Parents
  • Thanks.

    I am afraid make will conflict with another compiler we have and we don't have the gss arm compiler installed. Is it feasible just to obtain the missing library file  to drop into the relevant  folder ?

  • Hi Hakon.

    OK, so in desperation I avae take your advice:

    1, I loaded  the 2019 gcc ARM distribution to my Win7 development platform

    2. Also the the corresponding gcc make

    3. I made sure the binaries for both of the above are in the current path, with make having precedence over the path to any other installed make (designed to stop a clash with Embarcadero C++ Builder make)

    3. I went into the micor_ecc folder and edited build_al.bal to just make  rf52nf_armgcc

    4. I executed build_all.bat from the command line

    5. Make seems to start, but then gives the error below which I have been unable  resolve (full error report at the end of this missive  but the key report is :

    Process_begin: CreateProcess(NULL, mkdir _build, ...) failed.
    make (e=2): The system cannot find the file specified.

    Note that when I ran build_all the first time, git seemed to do its expected downloads.

    Any help would be gratefully received.

    Many thanks,

    Andrew

    C:\Projects\Bluetooth Communicator\Tools\Nordic\SDK\nRF5_SDK_17.0.0_9d13099\external\micro-ecc>build_all
    make: Entering directory `C:/Projects/Bluetooth Communicator/Tools/Nordic/SDK/nRF5_SDK_17.0.0_9d13099/external/micro-ecc/nrf52nf_armgcc/armgcc'
    mkdir _build
    process_begin: CreateProcess(NULL, mkdir _build, ...) failed.
    make (e=2): The system cannot find the file specified.
    make: *** [_build] Error 2
    make: Leaving directory `C:/Projects/Bluetooth Communicator/Tools/Nordic/SDK/nRF5_SDK_17.0.0_9d13099/external/micro-ecc/nrf52nf_armgcc/armgcc'
    C:\Projects\Bluetooth Communicator\Tools\Nordic\SDK\nRF5_SDK_17.0.0_9d13099\external\micro-ecc>

  • Hi Hakon,

    just had to try before going home. I have now progressed but even though I have gone through and disabled all ECC backends exvcepting the mico-ecc backends shown in the Nordic documentation (the main enable plus the various c urve enables), I am getting errors. I am not sure if it is required to literally disable all backends osuch as the hash and random number backends or whether those are exempt ?

    Anyway, sorry to ask, but is there any chance you could supply the sdk_config.h that will compile with the crypto example  rrf_crypto_aes_cbc_mac_pca10040’  ? I can then do a file compare to see what I might be doing wrong ?

    Many thanks,

    Andrew

  • Hi Hakon,

    over the weekend I reinstalled the SDK (17.0.0) and that has, for whatever reason, allowed me to move forward to the point where the linker is only complaining that it can't find nrf_log_backend_rtt_init for the example nrf_crypto_aes_cbc_mac_pca10040 - see the end of this post for the linker report.

    OK, so it looks like micro-ecc may be resolved (not sure why it is needed for AES only, but never mind).

    I went looking for nrf_log_backend_rtt_init, and noted that the file inventory in Segger includes nrf_log_backend_rtt.c.

    There is also post on this issue issue raised by someone else, and the solution provided was to 'look at the uart example'. So I tried to compile the uart example and found it comes up with the very same error.

    Noting that nrf_log_backend_rtt.c is called up in both the aes example and and uart example, I went on the hunt.

    I first found the associated .h file which has the prototype for the missing call, and then one level down, found the .c file but discovered it to be empty - file size 0.

    Is that supposed to be the case, and if so, where does the function nrf_log_backend_rtt_init  live ? I haven't been able to find it, and it is odd that at least two examples exhibit the exact same error.

    Many thanks,

    Andrew

    ++++++++++++++++++++++++++++++++++++++++++

    Building ‘nrf_crypto_aes_cbc_mac_pca10040’ from solution ‘nrf_crypto_aes_cbc_mac_pca10040’ in configuration ‘Release’
      Linking nrf_crypto_aes_cbc_mac_pca10040.elf
        Output/nrf_crypto_aes_cbc_mac_pca10040 Release/Obj/nrf_log_default_backends.o: in function `nrf_log_default_backends_init':
        undefined reference to `nrf_log_backend_rtt_init'
        Output/nrf_crypto_aes_cbc_mac_pca10040 Release/Obj/nrf_log_default_backends.o:C:\Projects\Bluetooth Communicator\Tools\Nordic\SDK\nRF5_SDK_17.0.0_9d13099\components\libraries\log\src/nrf_log_default_backends.c:50: undefined reference to `nrf_log_backend_rtt_api'
    Build failed

  • Hi,

     

    As long as micro-ecc is present, this example, nRF5_SDK_17.0.0_9d13099\examples\crypto\nrf_crypto\aes\aes_cbc_mac\pca10040\blank\ses, shall compile without any issues. I did a clean install of SDK v17, cloned and built micro-ecc, and I cannot reproduce the error you are seeing. Have you added/changed something in the example?

     

    Kind regards,

    Håkon

  • Hello Hakon,

    it is a real mystery.

    Per my last post, with a clean reinstall for 17.0.0 I didn't touch/change anything. I have made no changes to the Segger compiler either.

    Oddly, the micro-ecc thing seems to be sorted and there are no errors regarding that - OK, so let us assume  I had accidentally modified something.

    However now, without making any code mods whatsover,  both the uart and aes mac examples (Segger) give the same link-time error related to RTT as follows:

    Output/ble_app_uart_pca10040_s132 Release/Obj/nrf_log_default_backends.o:C:\Projects\Bluetooth Communicator\Tools\Nordic\SDK\nRF5_SDK_17.0.0_9d13099\components\libraries\log\src/nrf_log_default_backends.c:50: undefined reference to `nrf_log_backend_rtt_api'

    When I go to line 50 in nrf_log_default_backends.c I find NRF_LOG_BACKEND_RTT_DEF(rtt_log_backend);

    When I right click to go to the definition of NRF_LOG_BACKEND_RTT_DEF or  rtt_log_backend, Segger takes me to the first line of the nrf_log_backend_rtt.h so I am guessing that is wehat happens when it cannot find what it is looking for.

    A solution search for NRF_LOG_BACKEND_RTT_DEF returns just the one reference on line 50. There doesn't seem to be a macro definition in the solution.

    So whatever the linker wants. I just don't seem to be able to supply it.

    Many thanks,

    Andrew

  • Thanks Hakon.

    The problem with mico-ecc went a way after a clean install. I'll just have to assume I had introduced the error during setup. Mea culpa.

    The remaining problem with the uart  aes_mac examples has also been tracked down to a missing declaration in nrf_log_backend_rtt.c in the 17.0.0 distribution as follows:

            const nrf_log_backend_api_t nrf_log_backend_rtt_api;

    Only the .h file reference to the strcuture was found in the distribution:

           extern const nrf_log_backend_api_t nrf_log_backend_rtt_api.

    Naturally the linker was complaining, and assoon as  we added the declaration to the the .c file, we got a clean compile.

    Regards,

    Andrew

Reply
  • Thanks Hakon.

    The problem with mico-ecc went a way after a clean install. I'll just have to assume I had introduced the error during setup. Mea culpa.

    The remaining problem with the uart  aes_mac examples has also been tracked down to a missing declaration in nrf_log_backend_rtt.c in the 17.0.0 distribution as follows:

            const nrf_log_backend_api_t nrf_log_backend_rtt_api;

    Only the .h file reference to the strcuture was found in the distribution:

           extern const nrf_log_backend_api_t nrf_log_backend_rtt_api.

    Naturally the linker was complaining, and assoon as  we added the declaration to the the .c file, we got a clean compile.

    Regards,

    Andrew

Children
  • Hello.

    The micro-ecc problem has resurfaced at linker level now.

    What I didn't realise when I got the clean compile above was that mcro-ecc was disabled. When I enable it and disable all the other backends, it runs trhough to the linking stage but I get the error below which from what I can see means there is a  floating point clash between the snRF2K target (supporting VFP register usage) and the library .a file you provided (the one I have been unable to compile) which does not.

    Can you please advise how to resolve this ?

    Regards,

    Andrew

    ++++++++++++++++++++++++

    Here is the error:

    Building ‘nrf_crypto_aes_cbc_mac_pca10040’ from solution ‘nrf_crypto_aes_cbc_mac_pca10040’ in configuration ‘Release’
      Linking nrf_crypto_aes_cbc_mac_pca10040.elf
        Output/Release/Exe/nrf_crypto_aes_cbc_mac_pca10040.elf uses VFP register arguments, ../../../../../../../../external/micro-ecc/nrf52nf_armgcc/armgcc/micro_ecc_lib_nrf52.a(uECC.c.o) does not
        failed to merge target specific data of file ../../../../../../../../external/micro-ecc/nrf52nf_armgcc/armgcc/micro_ecc_lib_nrf52.a(uECC.c.o)
    Build failed

  • Did you ever get this issue resolved?

    FWIW, I think it is due to inconsistent use of the floating point ABI between the library build and your project build.

Related