NordicSemiconductor / IOS-nRF-Connect-Device-Manager

A mobile management library for devices supporting nRF Connect Device Manager.
https://www.nordicsemi.com/Software-and-tools/Software/nRF-Connect-SDK
Apache License 2.0
97 stars 41 forks source link

DFU update: invalidHeaderMagic? #47

Closed RickGroenewegen closed 1 year ago

RickGroenewegen commented 2 years ago

Hi, I'm downloading the firmware using a URL and I try to start the DFU update using that data

do { try dfuManager.start(data: URLData) } catch let error { print(error) }

However, this code prints out the following:

invalidHeaderMagic

Does anybody have an example on how I should generate the data from an URL that I can pass on to dfuManager.start()?

RickGroenewegen commented 2 years ago

Figured it out using the example app. I first had to create and pass a package instead of passing the URL:

let package = try McuMgrPackage(from: URL(string: ("file://" + fileURL))!). try dfuManager.start(images: package.images, using: dfuManagerConfiguration)

dinesharjani commented 1 year ago

So the 'invalid header magic' means the Data is not signed. So, you were maybe trying to DFU Data from a debug build, not Release. This is why it probably worked with your file instead of the Data bytes directly.