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 3
3
import sys
4
4
import crccheck
5
5
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]" )
8
9
sys .exit ()
9
10
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 ]
12
14
13
15
# Read the binary file
14
16
in_file = open (ifile , "rb" )
15
17
bin_data = bytearray (in_file .read ())
16
18
in_file .close ()
17
19
18
20
# 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 ()
21
31
22
32
# Version field (byte array of size 8)
23
33
version = bytearray (8 )
24
- print (version )
25
34
26
35
# Prepend magic number and version field to payload
27
36
bin_data_complete = magic_number + version + bin_data
You can’t perform that action at this time.
0 commit comments