@@ -222,26 +222,18 @@ def create_upload_data(fqbn, installed_cores): # noqa: C901
222
222
return upload_data
223
223
224
224
225
- def generate_boards_json (input_data , arduino_cli_path ):
225
+ def generate_boards_json (input_data , arduino_cli_path , new_boards ):
226
+ # List of old boards that need precompiled sketch data and uploader information obtained through platform.txt.
227
+ old_boards = [
228
+ "arduino:samd:mkr1000" ,
229
+ "arduino:samd:mkrwifi1010" ,
230
+ "arduino:samd:nano_33_iot" ,
231
+ "arduino:samd:mkrvidor4000" ,
232
+ "arduino:megaavr:uno2018" ,
233
+ "arduino:mbed_nano:nanorp2040connect" ,
234
+ ]
235
+
226
236
boards = {
227
- "arduino:samd:mkr1000" : {"fqbn" : "arduino:samd:mkr1000" , "firmware" : []},
228
- "arduino:samd:mkrwifi1010" : {
229
- "fqbn" : "arduino:samd:mkrwifi1010" ,
230
- "firmware" : [],
231
- },
232
- "arduino:samd:nano_33_iot" : {
233
- "fqbn" : "arduino:samd:nano_33_iot" ,
234
- "firmware" : [],
235
- },
236
- "arduino:samd:mkrvidor4000" : {
237
- "fqbn" : "arduino:samd:mkrvidor4000" ,
238
- "firmware" : [],
239
- },
240
- "arduino:megaavr:uno2018" : {"fqbn" : "arduino:megaavr:uno2018" , "firmware" : []},
241
- "arduino:mbed_nano:nanorp2040connect" : {
242
- "fqbn" : "arduino:mbed_nano:nanorp2040connect" ,
243
- "firmware" : [],
244
- },
245
237
"arduino:renesas_uno:unor4wifi" : {
246
238
"fqbn" : "arduino:renesas_uno:unor4wifi" ,
247
239
"firmware" : [],
@@ -252,15 +244,27 @@ def generate_boards_json(input_data, arduino_cli_path):
252
244
},
253
245
}
254
246
255
- # List of old boards that need precompiled sketch data and uploader information obtained through platform.txt.
256
- old_boards = [
257
- "arduino:samd:mkr1000" ,
258
- "arduino:samd:mkrwifi1010" ,
259
- "arduino:samd:nano_33_iot" ,
260
- "arduino:samd:mkrvidor4000" ,
261
- "arduino:megaavr:uno2018" ,
262
- "arduino:mbed_nano:nanorp2040connect" ,
263
- ]
247
+ if not new_boards :
248
+ boards = {
249
+ "arduino:samd:mkr1000" : {"fqbn" : "arduino:samd:mkr1000" , "firmware" : []},
250
+ "arduino:samd:mkrwifi1010" : {
251
+ "fqbn" : "arduino:samd:mkrwifi1010" ,
252
+ "firmware" : [],
253
+ },
254
+ "arduino:samd:nano_33_iot" : {
255
+ "fqbn" : "arduino:samd:nano_33_iot" ,
256
+ "firmware" : [],
257
+ },
258
+ "arduino:samd:mkrvidor4000" : {
259
+ "fqbn" : "arduino:samd:mkrvidor4000" ,
260
+ "firmware" : [],
261
+ },
262
+ "arduino:megaavr:uno2018" : {"fqbn" : "arduino:megaavr:uno2018" , "firmware" : []},
263
+ "arduino:mbed_nano:nanorp2040connect" : {
264
+ "fqbn" : "arduino:mbed_nano:nanorp2040connect" ,
265
+ "firmware" : [],
266
+ },
267
+ }
264
268
265
269
# Gets the installed cores
266
270
res = arduino_cli (cli_path = arduino_cli_path , args = ["core" , "list" , "--format" , "json" ])
@@ -316,18 +320,31 @@ def generate_boards_json(input_data, arduino_cli_path):
316
320
help = "Path to arduino-cli executable" ,
317
321
required = True ,
318
322
)
323
+ parser .add_argument (
324
+ "--new" ,
325
+ action = argparse .BooleanOptionalAction ,
326
+ default = True ,
327
+ help = "Generate the index for old boards" ,
328
+ )
319
329
args = parser .parse_args (sys .argv [1 :])
320
330
331
+ if args .new :
332
+ input_file = "new_boards.json"
333
+ output_file = "plugin_firmware_index.json"
334
+ else :
335
+ input_file = "boards.json"
336
+ output_file = "module_firmware_index.json"
337
+
321
338
# raw_boards.json has been generated using --get_available_for FirmwareUploader (version 0.1.8) flag.
322
339
# It has been edited a bit to better handle parsing.
323
- with open ("boards.json" , "r" ) as f :
340
+ with open (input_file , "r" ) as f :
324
341
boards = json .load (f )
325
342
326
- boards_json = generate_boards_json (boards , args .arduino_cli )
343
+ boards_json = generate_boards_json (boards , args .arduino_cli , args . new )
327
344
328
345
Path ("boards" ).mkdir ()
329
346
330
- with open ("boards/module_firmware_index.json" , "w" ) as f :
347
+ with open ("boards/" + output_file , "w" ) as f :
331
348
json .dump (boards_json , f , indent = 2 )
332
349
333
350
# board_index.json must be formatted like so:
0 commit comments