Skip to content

Commit e5caa99

Browse files
committed
feature: ability to generate nrf firmware manifest for Open DFU format using nrf_open_dfu build tag. Intended to fix #4089
Signed-off-by: deadprogram <[email protected]>
1 parent 17bb1fe commit e5caa99

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

builder/nrfutil.go

+14-2
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ type jsonManifest struct {
1919
DataFile string `json:"dat_file"`
2020
InitPacketData nrfInitPacket `json:"init_packet_data"`
2121
} `json:"application"`
22-
DFUVersion float64 `json:"dfu_version"` // yes, this is a JSON number, not a string
22+
DFUVersion float64 `json:"dfu_version,omitempty"` // yes, this is a JSON number, not a string
2323
} `json:"manifest"`
2424
}
2525

@@ -93,7 +93,19 @@ func makeDFUFirmwareImage(options *compileopts.Options, infile, outfile string)
9393
manifest.Manifest.Application.BinaryFile = "application.bin"
9494
manifest.Manifest.Application.DataFile = "application.dat"
9595
manifest.Manifest.Application.InitPacketData = initPacket
96-
manifest.Manifest.DFUVersion = 0.5
96+
97+
// use build tag "nrf_open_dfu" to indicate open DFU format, otherwise defaults to secure DFU
98+
openDFU := false
99+
for _, tag := range options.Tags {
100+
if tag == "nrf_open_dfu" {
101+
openDFU = true
102+
break
103+
}
104+
}
105+
106+
if !openDFU {
107+
manifest.Manifest.DFUVersion = 0.5
108+
}
97109

98110
// Write the JSON manifest to the file.
99111
jsonw, err := w.Create("manifest.json")

0 commit comments

Comments
 (0)