This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

nRF52805 Secure bootloader with iar embedded workbench.

Hi,

I am using s112_nrf52_7.2.0_softdevice with nRF5_SDK_17.1.0 and iar embedded workbench. I can flash and run the application without any problem but when i try to program secure_bootloader_ble_s112_pca10040e or secure_bootloader_ble_s112_pca10040e_debug I get harfault exception (A coprocessor access error has occurred (CFSR.NOCP) while i am using FLOAT_ABI_SOFT. Here is my linker configuration. 

Parents
  • Yes, I followed the link.

  • Could you try this address instead, 0x27fff

  • Still the same harfault exception.

  • Did you select nRF52805 in the General Options?

    Also note this from the SDK release notes:

    *****
    Note for IAR 8 users:
    
    When using IAR 8, you must apply the following workaround in the MDK:
    
    - Apply a patch to modules/nrfx/mdk/compiler_abstraction.h at line 140
     (fix the '__ALIGN()' macro definition): use the argument 'n' in the macro expansion instead of 'x'.
    
    -------------------
    
    Libraries for IAR 8 require wchar_t to be of size 32 bits while IAR 7 requires 16 bits.
      
    To run a project using IAR 8, follow these instructions:
     1. Open the IAR project in IAR 8. The IAR workbench will automatically generate an IAR 8 compatible project file.
     2. If the project contains one of the precompiled libraries listed below, replace it
        with the IAR 8 compatible alternative (there are no projects targeting nRF51 in this SDK).
     3. Save the project.
     4. When building the project, you might get the warning: "The header file 'cmsis_iar.h' is obsolete and should not be used. [...]".
        - The problem is described in DevZone post: https://devzone.nordicsemi.com/f/nordic-q-a/31123/iar-ewarm-8-22-1-complains-about-cmsis_iar-h
          The solution is to remove all occurrences of #include <cmsis_iar.h>.
         
    The affected libraries are:
     - micro-ecc crypto:
        - IAR7: Includes library located in the folder named “…_iar\…”.
        - IAR8: Switch to using the library from the folder named “…_armgcc\…”.
     - nrf_cc310, nrf_cc310_bl, and nrf_oberon:
        - IAR7: Link to a library where “short_wchar” is part of the folder name.
        - IAR8: Link to a library without “short_wchar” in the folder name.
     - Gazell, NFC Tag, and 802.15.4:
        - IAR7: Includes the library where the file name ends with “_iar”.
        - IAR8: Switch to using the library with similar file name that ends with “_gcc”.
    *****

  • I already have the latest MDK, and I used crypto libs with iar 8 before but with nrf52840 and I fixed these problems, and yes I set the nrf52805.

    The problem is i am not geting anywhere in the bootloader its not even coming to the main. when I program the bootloadrer and get the harfault , I flashed the application, but its geting the same hardfault as well, so i have to erase the chip and reprogram softdevice and the app again.

  • nahro said:
    I flashed the application, but its geting the same hardfault as well, so i have to erase the chip and reprogram softdevice and the app again.

    If you erase the chip, and program SoftDevice and Bootloader, does the bootloader start as normal then?

Reply
  • nahro said:
    I flashed the application, but its geting the same hardfault as well, so i have to erase the chip and reprogram softdevice and the app again.

    If you erase the chip, and program SoftDevice and Bootloader, does the bootloader start as normal then?

Children
  • No, I get the same hardfault. Can you send me a hex bootloader to test it? I want to use NRF_BL_DFU_ENTER_METHOD_GPREGRET.

  • nahro said:
    Can you send me a hex bootloader to test it?

    Here you go:

    test_hex.zip

    I also set this in sdk_config.h so that it works on boards without LF crystal:

    NRF_SDH_CLOCK_LF_SRC 0
    NRF_SDH_CLOCK_LF_RC_CTIV 16
    NRF_SDH_CLOCK_LF_RC_TEMP_CTIV 2
    NRF_SDH_CLOCK_LF_ACCURACY 1
    

    nahro said:
    I want to use NRF_BL_DFU_ENTER_METHOD_GPREGRET.

    This is the default behavior (NRF_BL_DFU_ENTER_METHOD_GPREGRET is set to 1 in sdk_config.h), you don't need to modify the source code for this(looks like you have done this looking at the screenshot you posted.)

    PS: You should remove DEVELOP_IN_NRF52832 and NRFX_COREDEP_DELAY_US_LOOP_CYCLES defines when testing on a nRF52805 device.

  • Your DFU works fine and advertising, but never starts the application. Have generated it with IAR 8?  app adress is  0x19000 to 0x28000. Can you attach the IAR project? if you generated it with IAR.

  • nahro said:
    Have generated it with IAR 8? 

    Yes.

    nahro said:
    Can you attach the IAR project? if you generated it with IAR.

    I just used the IAR project found in folder: \nRF5_SDK_17.1.0_ddde560\examples\dfu\secure_bootloader

  • I found the problem, I had old version of  micro-ecc lib, I installed and build the latest one, every thing works just fine. Thank you Sigurd.

Related