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

nrfutil crashes on generating OTA DFU

So I'm trying to follow this tutorial - https://devzone.nordicsemi.com/b/blog/posts/getting-started-with-nordics-secure-dfu-bootloader to generate secure OTA DFU

I've got an example application built from keil environment (blinky_pca10040) and generated the keys using nrfutil key generator. I have nrf52832_xxaa.hex generated under _build directory.

Now what I'm supposed to do is pack everything together using nrfutil:

nrfutil pkg generate --hw-version 52 --application-version 1 --application nrf52832_xxaa.hex --sd-req 0x98 --key-file private.key app_dfu_package.zip

Which doesn't seem to work as nrfutil fails with this:

Traceback (most recent call last):
  File "C:\Python27\Scripts\nrfutil-script.py", line 11, in <module>
    load_entry_point('nrfutil==3.5.0', 'console_scripts', 'nrfutil')()
  File "c:\python27\lib\site-packages\click\core.py", line 722, in __call__
    return self.main(*args, **kwargs)
  File "c:\python27\lib\site-packages\click\core.py", line 697, in main
    rv = self.invoke(ctx)
  File "c:\python27\lib\site-packages\click\core.py", line 1066, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "c:\python27\lib\site-packages\click\core.py", line 1066, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "c:\python27\lib\site-packages\click\core.py", line 895, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "c:\python27\lib\site-packages\click\core.py", line 535, in invoke
    return callback(*args, **kwargs)
  File "c:\python27\lib\site-packages\nordicsemi\__main__.py", line 628, in generate
    package.generate_package(zipfile_path)
  File "c:\python27\lib\site-packages\nordicsemi\dfu\package.py", line 348, in generate_package
    Package.normalize_firmware_to_bin(self.work_dir, firmware_data[FirmwareKeys.FIRMWARE_FILENAME])
  File "c:\python27\lib\site-packages\nordicsemi\dfu\package.py", line 500, in normalize_firmware_to_bin
    temp.tobinfile(new_filepath)
  File "c:\python27\lib\site-packages\nordicsemi\dfu\nrfhex.py", line 180, in tobinfile
    super(nRFHex, self).tobinfile(fobj, start=start_address, size=size)
  File "c:\python27\lib\site-packages\nordicsemi\dfu\intelhex\__init__.py", line 403, in tobinfile
    fobj.write(self._tobinstr_really(start, end, pad, size))
  File "c:\python27\lib\site-packages\nordicsemi\dfu\intelhex\__init__.py", line 375, in _tobinstr_really
    return asstr(self._tobinarray_really(start, end, pad, size).tostring())
  File "c:\python27\lib\site-packages\nordicsemi\dfu\intelhex\__init__.py", line 344, in _tobinarray_really
    raise ValueError("tobinarray: wrong value for size")
ValueError: tobinarray: wrong value for size

Am I missing something here?

Related