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

DFU update fails with message "INVALID OBJECT"

Hello,


I want to evaluate the ble_app_buttonless_dfu example (C:\nRF5SDK160098a08e\examples\ble_peripheral\ble_app_buttonless_dfu).
I am using the nRF5 SDK 16.0.0, IAR EWARM 7.80 and a nrf52833 board.
That’s what I am doing:


1. generate private key:
nrfutil keys generate private.key


2. generate public key:
nrfutil keys display --key pk --format code private.key --out_file dfu_public_key.c


3. copy dfu_public_key.c to C:\nRF5SDK160098a08e\examples\dfu


4. build the secure_bootloader with IAR using the following project:
secure_bootloader_ble_s132_pca10040.ewp to get: secure_bootloader_ble_s132_pca10040.hex


5. build the ble_app_buttonless_dfu application with IAR using the following project: ble_app_buttonless_dfu_pca10040_s132.ewp to get: ble_app_buttonless_dfu_pca10040_s132.hex


6. generate bootloader settings:
nrfutil settings generate --family NRF52 --application ble_app_buttonless_dfu_pca10040_s132.hex --application-version 1 --bootloader-version 0 --bl-settings-version 1 bootloader_setting.hex


7. merge application, bootloader, softdevice and bootloader-settings:
mergehex --merge s132_nrf52_7.0.1_softdevice.hex ble_app_buttonless_dfu_pca10040_s132.hex secure_bootloader_ble_s132_pca10040.hex bootloader_setting.hex --output my_ble_app_buttonless_dfu_without_bonds_s132_with_setting_page.hex


8. generate the zip file
nrfutil pkg generate --hw-version 52 --application-version 1 --application ble_app_buttonless_dfu_pca10040_s132.hex --sd-req 0xCB --key-file private.key my_ble_app_buttonless_dfu_without_bonds_s132.zip


8. use nRF Connect/ Programmer to flash my_ble_app_buttonless_dfu_without_bonds_s132_with_setting_page.hex into the nrf52833


9. Copy my_ble_app_buttonless_dfu_without_bonds_s132.zip to the smartphone and start the nRF Toolbox/DFU, SELECT DEVICE (DfuTarg), SELECT FILE (my_ble_app_buttonless_dfu_without_bonds_s132.zip) and start press UPLOAD. The upload process failed with the following message “INVALID OBJECT”

In the directory C:\nRF5SDK160098a08e\examples\dfu\secure_dfu_test_images\ble\nrf52832
I found 2 files that are working fine.
ble_app_buttonless_dfu_without_bonds_s132_with_setting_page.hex

ble_app_buttonless_dfu_without_bonds_s132.zip


What do I wrong ? How can I get a working ble_app_buttonless_dfu example out of the source code ?

See my hex- and zip File in the attachment.


Thank you for your support !

my_ble_app_buttonless_dfu_without_bonds_s132.zipmy_ble_app_buttonless_dfu_without_bonds_s132_with_setting_page.hex

Parents
  • Hallo Edvin

    Thank you for you reply.

    As I described at point 3: I copied dfu_public_key.c to the BL project before building the BL (secure_bootloader_ble_s132_pca10040.hex) .

    I changed only dfu_public_key.c in the example BL project.

    What is the reason for the "invalid object" message ?

    Is there something wrong with the keys or signature ? 

    I looked in the BL map file and I see that the oberon  lib is used. Is this correct  or is uECC-lib the right one ?

    I am using a nrf52832 porject together with  nrf52833 chip, could this be the  problem ?

    I tried a lot of things but I still suck Cry.

    Regards

    Georg

  • Perhaps it doesn't like that you are using the same application-version as you already have. Try generating a new one with --application-version 2, and see if that helps. But I think by default, it should accept same version (application-version). However, it is worth a shot.

     

    Georg said:
    I am using a nrf52832 porject together with  nrf52833 chip, could this be the  problem ?

     I suggest you try using an nRF52833 project. Did you try the pca10100_s140_ble instead of pca10040_s132_ble? Actually, I didn't know until now that you were using the nRF52833. 

    Also, make sure that you use the bootloader.hex file that you have compiled, and not any of the precompiled bootloader .hex files from the SDK.

    In addition, the s132 is not certified with the nRF52833. And I am not sure it will work. Try using either the s140 or s113 projects from the SDK16\examples\dfu\secure_bootloader\pca10100_s1xx_ble.

    Can you please test the armgcc project files? I have not used IAR before, and I am not sure there are any issues with these. I am not saying you need to use it in the end, but since you already have make installed (you should have since you have built the micro-ecc libraries), just call "make" from a command line in the folder SDK\examples\dfu\secure_bootloader\pca10100_s140_ble\armgcc, and use the .hex file generated in the _build folder from that location.

    Best regards,

    Edvin

  • Hallo again,

    in the meantime I found a solution, thanks  to your help. Blush

    The problem was: that I had worked with the wrong SD/pca combination for the nrf52833.

    correct combination: s140 / pca10100

    wrong combination: s132 / pca10140

    First of all I created an IAR  "buttonless_dfu_pca10100_s140-nerf52833 " project.

    Unfortunately the  SDK16.0.0. does not provide such an example project.

    For the bootloader I am using the secure_bootloader_ble_s140_pca10100 project.

    Now it works fine.

    But there is now a new strange behaviour:Unamused

    1. Programming the "complete" hex-file  (APP + BL + SD + BL-setting) into the nrf52833

    2. When scanning I expect to see the App - "Nordic_Buttonless" but I see the bootloader - "DfuTarg"

    3. Updating the firmware with nRF Toolbox/DFU App The message "Application has been successfully transfered" appears instead of "INALVID OBJECT" Blush

    4. When scanning I see the App "Nordic_Buttonless" (as expected)

    It seems that there is something wrong with the bootloader settings in the "complete" hex -file.

    After executing an DFU update the  bootloader settings seems to be corrected.

    When debugging into the "buttonless_dfu" APP (after step 1.),  the

    bootloader_addr = 0xFFFFFFFF!

    uint32_t nrf_dfu_svci_vector_table_set(void)
    {
        uint32_t err_code;
        uint32_t bootloader_addr = BOOTLOADER_ADDRESS;
    
        if (bootloader_addr != 0xFFFFFFFF)
        {
            NRF_LOG_INFO("Setting vector table to bootloader: 0x%08x", bootloader_addr);
            err_code = sd_softdevice_vector_table_base_set(bootloader_addr);
            if (err_code != NRF_SUCCESS)
            {
                NRF_LOG_ERROR("Failed running sd_softdevice_vector_table_base_set");
                return err_code;
            }
    
            return NRF_SUCCESS;
        }

    Commands to build the complete.hex and the app.zip

    1. generate bootloader settings:

    nrfutil settings generate --family NRF52 --application ble_app_buttonless_dfu_pca10100_s140.hex --application-version 1 --bootloader-version 0 --bl-settings-version 2 bootloader_setting.hex

    2. merge application, bootloader, softdevice and bootloader-settings


    mergehex --merge bootloader_setting.hex secure_bootloader_ble_s140_pca10100.hex s140_nrf52_7.0.1_softdevice.hex --output bl.hex
    mergehex --merge bl.hex ble_app_buttonless_dfu_pca10100_s140.hex --output complete.hex

    3. generate the zip file
    nrfutil pkg generate --hw-version 52 --application-version 1 --application ble_app_buttonless_dfu_pca10100_s140.hex --sd-req 0xCA --key-file private.key app.zip

    Any Ideas ?

    Thank you !

    Best Regards

    Georg

  • Hello Georg,

    If you program the bl_settings.hex, and the device advertises as "DfuTarg", it means that the application is rejected by the bootloader, and the device is in DFU mode. 

    1: Can you try to not merge the .hex files, but program them separately using "nrfjprog --program ...", or nRF Connect -> Programmer. The reason I ask you to test this is that I have seen some compatibility issues with mergehex and .hex files generated from IAR.

    By separately, I don't mean that you need to program them one at a time, but program each file instead of the merged file:

    2: Are you sure that the bootloader settings are generated using the exact same application as the one you programmed? Please note that if you recompile, you need to generate the bootloader settings again.

    As a last resort, try to run the attached script from the location SDK\examples\dfu\secure_bootloader\pca10100_s140_ble\armgcc.

    make -j9 
    make -j9 -C ..\..\..\..\ble_peripheral\ble_app_uart\pca10100\s140\armgcc 
    
    mkdir files
    del files\ble_app_uart.hex
    del files\bl_settings.hex
    copy ..\..\..\..\ble_peripheral\ble_app_uart\pca10100\s140\armgcc\_build\nrf52833_xxaa.hex files\ble_app_uart.hex
    nrfutil settings generate --family NRF52 --application files\ble_app_uart.hex --application-version 1 --bootloader-version 1 --bl-settings-version 1 --key-file ..\..\..\private.key files\bl_settings.hex
    
    nrfjprog -e
    nrfjprog --program ..\..\..\..\..\components\softdevice\s140\hex\s140_nrf52_7.2.0_softdevice.hex --verify
    nrfjprog --program _build\nrf52833_xxaa_s140.hex --verify
    nrfjprog --program files\bl_settings.hex --verify
    nrfjprog --program files\ble_app_uart.hex --verify
    nrfjprog --reset

    Best regards,

    Edvin

Reply
  • Hello Georg,

    If you program the bl_settings.hex, and the device advertises as "DfuTarg", it means that the application is rejected by the bootloader, and the device is in DFU mode. 

    1: Can you try to not merge the .hex files, but program them separately using "nrfjprog --program ...", or nRF Connect -> Programmer. The reason I ask you to test this is that I have seen some compatibility issues with mergehex and .hex files generated from IAR.

    By separately, I don't mean that you need to program them one at a time, but program each file instead of the merged file:

    2: Are you sure that the bootloader settings are generated using the exact same application as the one you programmed? Please note that if you recompile, you need to generate the bootloader settings again.

    As a last resort, try to run the attached script from the location SDK\examples\dfu\secure_bootloader\pca10100_s140_ble\armgcc.

    make -j9 
    make -j9 -C ..\..\..\..\ble_peripheral\ble_app_uart\pca10100\s140\armgcc 
    
    mkdir files
    del files\ble_app_uart.hex
    del files\bl_settings.hex
    copy ..\..\..\..\ble_peripheral\ble_app_uart\pca10100\s140\armgcc\_build\nrf52833_xxaa.hex files\ble_app_uart.hex
    nrfutil settings generate --family NRF52 --application files\ble_app_uart.hex --application-version 1 --bootloader-version 1 --bl-settings-version 1 --key-file ..\..\..\private.key files\bl_settings.hex
    
    nrfjprog -e
    nrfjprog --program ..\..\..\..\..\components\softdevice\s140\hex\s140_nrf52_7.2.0_softdevice.hex --verify
    nrfjprog --program _build\nrf52833_xxaa_s140.hex --verify
    nrfjprog --program files\bl_settings.hex --verify
    nrfjprog --program files\ble_app_uart.hex --verify
    nrfjprog --reset

    Best regards,

    Edvin

Children
Related