Beware that this post is related to an SDK in maintenance mode
More Info: Consider nRF Connect SDK for new designs

Example ble_app_hrs fails to compile

Background Info

  • nRF5_SDK_17.1.0
  • nRF52840DK
  • SES 7.12a

EDIT: This was due to user-error, see following post for update.

I'm trying to test the ble_peripheral/ble_app_hrs example, but I'm having issues either compiling or running it.

At first I was trying the example located at ble_peripheral/ble_app_hrs/pca10056/s140, but after clearing up the errors regarding __printf_tag_ptr and .text/.rodata flash sizes, I'm stuck on this error.

Output/Debug/Obj/ble_app_hrs_pca10056_s140/nrf_crypto_hmac.o: file not recognized: file format not recognized

I also tried the example located at ble_peripheral/ble_app_hrs/pca10056/ser_s140_uart, and while that one manages to compile without any errors, I run into an issue where the devkit doesn't complete the initialization sequence and seeming just hangs without throwing any errors. I've tried debugging to see what's going on, and the code execution appears to just stop when this is reached.

nrf_sdh_ble.c:130

ret_code = sd_ble_cfg_set(BLE_CONN_CFG_GAP, &ble_cfg, *p_ram_start);

How would I go about resolving the compiler error in the first case for the s140 example?

Additionally, why would the ser_s140_uart example hang during the initialization sequence?

Thanks

  • Sorry for the double post, but just wanted to leave a comment to say that problems in the OP were due to user-error. I just now noticed that the documentation states the need to setup and make micro-ecc, modify the sdk_config.h to change the crypto backend, edit the include paths accordingly, and dragging in micro_ecc_lib_nrf52.a into the Application folder.

    After making those changes I got past the original compile error in the OP, however I'm now running into a bunch of other errors.

    What am I missing in order to start testing out the ble_peripheral/ble_app_hrs/pca10056/s140?

    Also I'm not sure which folder containing a micro_ecc_lib_nrf52.a file is meant for SES. I assume SES needs the one within nrf52nf_armgcc, since the other folders mention IAR and Keil.

    I tested ble_peripheral/ble_app_hrs/pca10056/ser_s140_uart as well (after making the required changes) and it ends up with the same compiler errors, so disregard what I was mentioning the in OP about the code hanging. I assume it was related to the micro-ecc/crypto backend not being setup as well.

  • Hi,

    It seems you still do not have the micro-ecc binary library in the expected location. The simplest way to get this done is to run the build_all.bat (Windows) or build_all.sh (Mac/Linux) under <SDK>/external/micro-ecc/. This will check-out micro-ecc and build it for all supported devices and toolchains. You need make and ARM GCC in order for it to work though, and you need to update Makefile.windows or Makefile.posix from <SDK>/components/toolchain/gcc/ so that it points to the AR GCC version you have installed. Also, do not double-click on the script, as that way it will just close if there is an error, so instead open a terminal window and run the script. Then you will see if there is an error (typically that you lack git, Make or ARM GCC).

    Also, I see you are using a very recent Segger Embedded Studio version. That is OK, but you will need to do some adjustments to the SDK code and example projects in order for it to work. If you want something that works out of the box, I would recommend sticking with the version that is mentioned in the SDK release notes (which is 5.42a for nRF5 SDK 17.1.0).

  • I believe I've done those already, but here is the output from making again

    User@DESKTOP-HM142CE ~
    $ cd "C:\Users\User\Documents\Nordic\nRF5_SDK_17.1.0_ddde560\external\micro-ecc"
    
    User@DESKTOP-HM142CE /cygdrive/c/Users/User/Documents/Nordic/nRF5_SDK_17.1.0_ddde560/external/micro-ecc
    $ ./build_all.bat
    make: Entering directory '/cygdrive/c/Users/User/Documents/Nordic/nRF5_SDK_17.1.
    0_ddde560/external/micro-ecc/nrf51_armgcc/armgcc'
    Creating library: ../../nrf51_armgcc/armgcc/micro_ecc_lib_nrf51.a
    Done
    make: Leaving directory '/cygdrive/c/Users/User/Documents/Nordic/nRF5_SDK_17.1.0
    _ddde560/external/micro-ecc/nrf51_armgcc/armgcc'
    make: Entering directory '/cygdrive/c/Users/User/Documents/Nordic/nRF5_SDK_17.1.
    0_ddde560/external/micro-ecc/nrf51_iar/armgcc'
    Creating library: ../../nrf51_iar/armgcc/micro_ecc_lib_nrf51.a
    Done
    make: Leaving directory '/cygdrive/c/Users/User/Documents/Nordic/nRF5_SDK_17.1.0
    _ddde560/external/micro-ecc/nrf51_iar/armgcc'
    make: Entering directory '/cygdrive/c/Users/User/Documents/Nordic/nRF5_SDK_17.1.
    0_ddde560/external/micro-ecc/nrf51_keil/armgcc'
    Creating library: ../../nrf51_keil/armgcc/micro_ecc_lib_nrf51.lib
    Done
    make: Leaving directory '/cygdrive/c/Users/User/Documents/Nordic/nRF5_SDK_17.1.0
    _ddde560/external/micro-ecc/nrf51_keil/armgcc'
    make: Entering directory '/cygdrive/c/Users/User/Documents/Nordic/nRF5_SDK_17.1.
    0_ddde560/external/micro-ecc/nrf52hf_armgcc/armgcc'
    Creating library: ../../nrf52hf_armgcc/armgcc/micro_ecc_lib_nrf52.a
    Done
    make: Leaving directory '/cygdrive/c/Users/User/Documents/Nordic/nRF5_SDK_17.1.0
    _ddde560/external/micro-ecc/nrf52hf_armgcc/armgcc'
    make: Entering directory '/cygdrive/c/Users/User/Documents/Nordic/nRF5_SDK_17.1.
    0_ddde560/external/micro-ecc/nrf52hf_iar/armgcc'
    Creating library: ../../nrf52hf_iar/armgcc/micro_ecc_lib_nrf52.a
    Done
    make: Leaving directory '/cygdrive/c/Users/User/Documents/Nordic/nRF5_SDK_17.1.0
    _ddde560/external/micro-ecc/nrf52hf_iar/armgcc'
    make: Entering directory '/cygdrive/c/Users/User/Documents/Nordic/nRF5_SDK_17.1.
    0_ddde560/external/micro-ecc/nrf52hf_keil/armgcc'
    Creating library: ../../nrf52hf_keil/armgcc/micro_ecc_lib_nrf52.lib
    Done
    make: Leaving directory '/cygdrive/c/Users/User/Documents/Nordic/nRF5_SDK_17.1.0
    _ddde560/external/micro-ecc/nrf52hf_keil/armgcc'
    make: Entering directory '/cygdrive/c/Users/User/Documents/Nordic/nRF5_SDK_17.1.
    0_ddde560/external/micro-ecc/nrf52nf_armgcc/armgcc'
    Creating library: ../../nrf52nf_armgcc/armgcc/micro_ecc_lib_nrf52.a
    Done
    make: Leaving directory '/cygdrive/c/Users/User/Documents/Nordic/nRF5_SDK_17.1.0
    _ddde560/external/micro-ecc/nrf52nf_armgcc/armgcc'
    make: Entering directory '/cygdrive/c/Users/User/Documents/Nordic/nRF5_SDK_17.1.
    0_ddde560/external/micro-ecc/nrf52nf_iar/armgcc'
    Creating library: ../../nrf52nf_iar/armgcc/micro_ecc_lib_nrf52.a
    Done
    make: Leaving directory '/cygdrive/c/Users/User/Documents/Nordic/nRF5_SDK_17.1.0
    _ddde560/external/micro-ecc/nrf52nf_iar/armgcc'
    make: Entering directory '/cygdrive/c/Users/User/Documents/Nordic/nRF5_SDK_17.1.
    0_ddde560/external/micro-ecc/nrf52nf_keil/armgcc'
    Creating library: ../../nrf52nf_keil/armgcc/micro_ecc_lib_nrf52.lib
    Done
    make: Leaving directory '/cygdrive/c/Users/User/Documents/Nordic/nRF5_SDK_17.1.0
    _ddde560/external/micro-ecc/nrf52nf_keil/armgcc'

    and components/toolchain/gcc/Makefile.windows

    GNU_INSTALL_ROOT := C:/Program Files (x86)/GNU Arm Embedded Toolchain/9 2020-q2-update/bin/
    GNU_VERSION := 9.3.1
    GNU_PREFIX := arm-none-eabi

    Then I take external/micro-ecc/nrf52nf_armgcc/armgcc/micro_ecc_lib_nrf52.a and drag that into the "Application" folder when I have ble_app_hrs open with SES.

    Have these under Common>Preprocessor>Include directories

    ../../../../../../external/micro-ecc/micro-ecc
    ../../../../../../external/micro-ecc/nrf52nf_armgcc/armgcc

    NRF_CRYPTO_ENABLED is set, and only NRF_CRYPTO_BACKEND_MICRO_ECC_ENABLED with the others disabled.

    I have C:\Program Files (x86)\GNU Tools ARM Embedded\4.9 2015q3 as well, which is what the documentation was suggesting to use, but I'm pretty sure I saw errors indicating it wanted 2020-q2 at the time so I ended up changing it. I tried editing the Makefile just now to use 2015q3, which appeared to run the makefile just fine, but it results in the same error when I try to compile the example.

    Okay thanks, I'll try downgrading SES as well.

  • Hi,

    I see from the output that the build all script run without issues, so that should be good then.

    kurtovic said:
    Then I take external/micro-ecc/nrf52nf_armgcc/armgcc/micro_ecc_lib_nrf52.a and drag that into the "Application" folder when I have ble_app_hrs open with SES.

    I think I may not have looked enough in your original post though, just the follow-up where you described micro-ecc.

    Do you intend to use micro-ecc? Nothing wrong with that, but it is not used in the ble_app_hrs example out of the box, and not needed (we use Oberon instead by default). So if the issue is that you were not able to run an unmodified example out of the box I suggest that you back-track a bit, or check which (accidental?) changes you have done to the example when trying to port it to work with a later SES version.

    If you downgrade SES, the ble_app_hrs example should build out of the box. If it does not, there is a more fundamental issue. If downgrading SES is not enough, please download and extract a fresh copy of the SDK and try that. And if it still does not work, perhaps you can upload the project here and the full build log so that I can have a look.

  • Honestly, I don't know. I'm just trying to follow the examples in order to understand how I can go about combining buttonless dfu with an example which supports bonding/security.
    You're right, looks like I misread the documentation and thought it was saying micro-ecc was needed, opposed to mentioning it could optionally be setup to use micro-ecc. I think I may have assumed I needed to use micro-ecc since that is what the secure bootloader would be useing.

    Downgrading SES solved the compile issues for me, thanks. Though I do have a follow up question, is there an easy way to upgrade from S140 7.2.0 to 7.3.0 without having to modify individual example projects in the SDK?

Related