Flashing .bin file using nrfjprog command line

Hi,

I am using nordic52840 dk board.

And i want to flash a bin file using nrfjprog command line.

For Hex file i am using below command

nrfjprog --reset --program blinky_pca10056.hex --family NRF52

But what changes requires to flash .bin instead of .hex file.

Regards

Parents Reply Children
  • Hehe I actually checked this before I answered, but I guess I have an older version installed than you. This is what mine said:

         --program <hex_file> [--sectorerase | --chiperase | --sectoranduicrerase |
                                  --recover] [--qspisectorerase | --qspichiperase]
                                 Programs the specified image_file into the device.
                                 If the target area to program is not erased, the
                                 --program operation will fail unless an erase
                                 option is given. Valid erase operations for
                                 the internal flash memory are --recover,
                                  --sectorerase, --sectoranduicrerase and
                                  --chiperase. If --chiperase is given, all the
                                 available user non-volatile memory, including
                                 UICR, will be erased before programming. If
                                 --recover is given, all the available user
                                 non-volatile memory, including UICR, will
                                 be erased before programming, even if the
                                 device is readback protected.
                                 If --sectorerase is given, only the targeted
                                 non-volatile memory pages excluding UICR will
                                 be erased. If --sectoranduicrerase is given,
                                 only the targeted non-volatile memory pages
                                 including UICR will be erased. Note that the
                                 --sectoranduicrerase and --sectorerase
                                 operations normally take significantly longer time
                                 compared to --chiperase operation so use them with
                                 caution. If your device is equipped witha QSPI
                                 peripheral and an external memory device is
                                 present, data targeting the XIP region will be
                                 written to the external memory device.
                                 The first address of the XIP region
                                 is considered as address 0 of the external memory
                                 device. To determine if an external memory device
                                 is present, nrfjprog checks the MemSize paramter
                                 from QspiDefault.ini file or from the QSPI
                                 configuration ini file given with the --qspiini
                                 option. If the target area to program is not
                                 erased, the --program operation will fail unless
                                 an erase option is given. Valid erase operations
                                 for the external memory device are --qspichiperase
                                 and --qspisectorerase. If --qspichiperase is
                                 given, the external memory device will be erased.
                                 If the --qspisectorerase is given, only 4kB pages
                                 pages from the targeted external memory device
                                 will be erased. Note that --qspichiperase
                                 operation may take several minutes. The --program
                                 command can be combined with the --verify
                                 operation. It can also be combined with either the
                                 --reset or the --debugreset operations. the reset
                                 will occur after the flash operation in order to
                                 start the execution.
                                 Limitations:
                                 For nRF51 devices, the --sectoranduicrerase
                                 operation is not available.
                                 For nRF51 devices, if the image_file provided
                                 contains sectors belonging to region 0, the
                                 --program operation will fail.
                                 For nRF51 devices, the --qspisectorerase and
                                 --qspichiperase operations are not available.
                                 For nRF52 devices, the --qspisectorerase and
                                 --qspichiperase operations are not available
                                 unless the device is equipped with a QSPI
                                 peripheral and an external memory is connected. To
                                 determine if an external memory is present, the
                                 MemSize parameter from QspiDefault.ini file or
                                 from the QSPI configuration ini file given with
                                 the --qspiini option is evaluated.
                                 For nRF91 devices, the --qspisectorerase and
                                 --qspichiperase operations are not available.

    (I am currently using version 10.12.1)

    If it says that .bin files are supported, then I guess you can just replace the .hex file with the bin file in your nrfjprog command:

    nrfjprog --reset --program blinky_pca10056.hex --family NRF52

    Did you test?

  • Yes i tried it. but didn't work for me as well.

    I have the new version of nrfjprog.

    And in the previous answer you mentioned the link to convert bin to hex file.

    arm-none-eabi-objcopy -I binary -O ihex filename.bin filename.hex
    by using this command.

    So my question is where i need to run this command "arm-none-eabi-objcopy"...?
    or Do i need to install something for this.

    because i simply try it to run in command line only where i used to run nrfjprog commands.

    Correct me if the way i am doing is not correct!

    Regards
    Rohit Saini


  • Hmm. I also see that it doesn't work using v 10.15.2 external. I'll look into this internally.

    But what compiler do you use if it doesn't provide a .hex file?

    arm-none-eabi is part of GCC (not nrfjprog). If you have it installed on your computer, you will probably find it in:
    C:\Program files (x86)\GNU Tools ARM Embedded\<version>\bin\arm-none-eabi-objcopy.exe

    Make sure to add the path, wich in my case is "C:\Program Files (x86)\GNU Tools ARM Embedded\9 2019-q4-major\" to path:

    Best regards,

    Edvin

  • Using ICC ARM only. and its creating .hex file as well.

    ANd i can also create .bin as well. But the issue is sometime there is the difference between the .hex and .bin. Thats y i want to load the .bin file from nrfjprog.

    But anyway i am able to flash .bin with J-flash lite tool.

    And thanks for "arm-none-eabi-objcopy" command. 

    Rregards

    Rohit Saini

  • Ok, so I got to test this today. Using the objcopy tool from armgcc 9 2019-q4-major I could convert the bin file to a hex file. I then programmed that generated hex file, and it worked as expected:

    I have reported the issue with --program .bin files internally to our nRF Command Line tools team. Thank you for reporting this.

    Best regards,

    Edvin

Related