File tree Expand file tree Collapse file tree 1 file changed +16
-7
lines changed Expand file tree Collapse file tree 1 file changed +16
-7
lines changed Original file line number Diff line number Diff line change 33import sys
44import crccheck
55
6- if len (sys .argv ) != 3 :
7- print ("Usage: bin2ota.py sketch.bin sketch.ota" )
6+ if len (sys .argv ) != 4 :
7+ print ("Usage: bin2ota.py BOARD sketch.bin sketch.ota" )
8+ print (" BOARD = [MKR_WIFI_1010 | NANO_33_IOT]" )
89 sys .exit ()
910
10- ifile = sys .argv [1 ]
11- ofile = sys .argv [2 ]
11+ board = sys .argv [1 ]
12+ ifile = sys .argv [2 ]
13+ ofile = sys .argv [3 ]
1214
1315# Read the binary file
1416in_file = open (ifile , "rb" )
1517bin_data = bytearray (in_file .read ())
1618in_file .close ()
1719
1820# Magic number (VID/PID), hard coded for MKR VIDOR 4000 right now
19- magic_number = bytearray ([0x23 , 0x41 , 0x80 , 0x54 ])
20- print (magic_number )
21+ magic_number_mkr_wifi_1010 = bytearray ([0x23 , 0x41 , 0x80 , 0x54 ])
22+ magic_number_nano_33_iot = bytearray ([0x23 , 0x41 , 0x80 , 0x57 ])
23+
24+ if board == "MKR_WIFI_1010" :
25+ magic_number = magic_number_mkr_wifi_1010
26+ elif board == "NANO_33_IOT" :
27+ magic_number = magic_number_nano_33_iot
28+ else :
29+ print ("Error," , board , "is not a supported board type" )
30+ sys .exit ()
2131
2232# Version field (byte array of size 8)
2333version = bytearray (8 )
24- print (version )
2534
2635# Prepend magic number and version field to payload
2736bin_data_complete = magic_number + version + bin_data
You can’t perform that action at this time.
0 commit comments