Merge branch 'refs/heads/master' into add-feather-833
bootloader/circuitplayground_nrf52840/circuitplayground_nrf52840_bootloader-0.6.2_s140_6.1.1.hex bootloader/circuitplayground_nrf52840/circuitplayground_nrf52840_bootloader-0.6.2_s140_6.1.1.zip bootloader/circuitplayground_nrf52840/circuitplayground_nrf52840_bootloader-0.7.0_s140_6.1.1.hex bootloader/circuitplayground_nrf52840/circuitplayground_nrf52840_bootloader-0.7.0_s140_6.1.1.zip bootloader/circuitplayground_nrf52840/circuitplayground_nrf52840_bootloader-0.9.0_s140_6.1.1.zip bootloader/clue_nrf52840/clue_nrf52840_bootloader-0.6.2_s140_6.1.1.hex bootloader/clue_nrf52840/clue_nrf52840_bootloader-0.6.2_s140_6.1.1.zip bootloader/clue_nrf52840/clue_nrf52840_bootloader-0.7.0_s140_6.1.1.hex bootloader/clue_nrf52840/clue_nrf52840_bootloader-0.7.0_s140_6.1.1.zip bootloader/clue_nrf52840/clue_nrf52840_bootloader-0.9.0_s140_6.1.1.hex bootloader/feather_nrf52832/feather_nrf52832_bootloader-0.6.2_s132_6.1.1.hex bootloader/feather_nrf52832/feather_nrf52832_bootloader-0.6.2_s132_6.1.1.zip bootloader/feather_nrf52832/feather_nrf52832_bootloader-0.7.0_s132_6.1.1.hex bootloader/feather_nrf52832/feather_nrf52832_bootloader-0.7.0_s132_6.1.1.zip bootloader/feather_nrf52832/feather_nrf52832_bootloader-0.9.0_s132_6.1.1.hex bootloader/feather_nrf52832/feather_nrf52832_bootloader-0.9.0_s132_6.1.1.zip bootloader/feather_nrf52840_express/feather_nrf52840_express_bootloader-0.7.0_s140_6.1.1.hex bootloader/feather_nrf52840_express/feather_nrf52840_express_bootloader-0.7.0_s140_6.1.1.zip bootloader/feather_nrf52840_express/feather_nrf52840_express_bootloader-0.9.0_s140_6.1.1.hex bootloader/feather_nrf52840_sense/feather_nrf52840_sense_bootloader-0.7.0_s140_6.1.1.hex bootloader/feather_nrf52840_sense/feather_nrf52840_sense_bootloader-0.7.0_s140_6.1.1.zip bootloader/feather_nrf52840_sense/feather_nrf52840_sense_bootloader-0.9.0_s140_6.1.1.hex bootloader/feather_nrf52840_sense/feather_nrf52840_sense_bootloader-0.9.0_s140_6.1.1.zip bootloader/itsybitsy_nrf52840_express/itsybitsy_nrf52840_express_bootloader-0.6.2_s140_6.1.1.hex bootloader/itsybitsy_nrf52840_express/itsybitsy_nrf52840_express_bootloader-0.6.2_s140_6.1.1.zip bootloader/itsybitsy_nrf52840_express/itsybitsy_nrf52840_express_bootloader-0.7.0_s140_6.1.1.hex bootloader/itsybitsy_nrf52840_express/itsybitsy_nrf52840_express_bootloader-0.7.0_s140_6.1.1.zip bootloader/itsybitsy_nrf52840_express/itsybitsy_nrf52840_express_bootloader-0.9.0_s140_6.1.1.hex bootloader/itsybitsy_nrf52840_express/itsybitsy_nrf52840_express_bootloader-0.9.0_s140_6.1.1.zip bootloader/ledglasses_nrf52840/ledglasses_nrf52840_bootloader-0.6.2_s140_6.1.1.zip bootloader/ledglasses_nrf52840/ledglasses_nrf52840_bootloader-0.9.0_s140_6.1.1.hex bootloader/ledglasses_nrf52840/ledglasses_nrf52840_bootloader-0.9.0_s140_6.1.1.zip bootloader/metro_nrf52840_express/metro_nrf52840_express_bootloader-0.7.0_s140_6.1.1.hex bootloader/metro_nrf52840_express/metro_nrf52840_express_bootloader-0.7.0_s140_6.1.1.zip bootloader/metro_nrf52840_express/metro_nrf52840_express_bootloader-0.9.0_s140_6.1.1.zip bootloader/particle_xenon/particle_xenon_bootloader-0.6.2_s140_6.1.1.hex bootloader/particle_xenon/particle_xenon_bootloader-0.6.2_s140_6.1.1.zip bootloader/particle_xenon/particle_xenon_bootloader-0.7.0_s140_6.1.1.hex bootloader/particle_xenon/particle_xenon_bootloader-0.9.0_s140_6.1.1.hex bootloader/raytac_mdbt50q_rx/raytac_mdbt50q_rx_bootloader-0.6.2_s140_6.1.1.hex bootloader/raytac_mdbt50q_rx/raytac_mdbt50q_rx_bootloader-0.6.2_s140_6.1.1.zip bootloader/raytac_mdbt50q_rx/raytac_mdbt50q_rx_bootloader-0.7.0_s140_6.1.1.zip bootloader/raytac_mdbt50q_rx/raytac_mdbt50q_rx_bootloader-0.9.0_s140_6.1.1.hex bootloader/raytac_mdbt50q_rx/raytac_mdbt50q_rx_bootloader-0.9.0_s140_6.1.1.zip
This commit is contained in:
103 files changed
+44709
-43877
No files matched your search
+36
-25
@@ -2,7 +2,6 @@ import os
|
||||
import glob
|
||||
import sys
|
||||
import subprocess
|
||||
from subprocess import Popen, PIPE
|
||||
import time
|
||||
from multiprocessing import Pool
|
||||
|
||||
@@ -22,6 +21,7 @@ default_boards = [
|
||||
'feather52840sense',
|
||||
'itsybitsy52840'
|
||||
]
|
||||
build_boards = []
|
||||
|
||||
def get_sd(name):
|
||||
if '52832' in name:
|
||||
@@ -32,31 +32,34 @@ def get_sd(name):
|
||||
# most of the board is 52840
|
||||
return 's140v6'
|
||||
|
||||
# return [succeeded, failed, skipped]
|
||||
def build_sketch(variant, sketch):
|
||||
def build_a_example(arg):
|
||||
variant = arg[0]
|
||||
sketch = arg[1]
|
||||
|
||||
fqbn = "adafruit:nrf52:{}:softdevice={},debug=l0".format(variant, get_sd(variant))
|
||||
|
||||
# succeeded, failed, skipped
|
||||
ret = [0, 0, 0]
|
||||
|
||||
# skip TinyUSB library examples for nRF52832
|
||||
if variant == 'feather52832' and "libraries/Adafruit_TinyUSB_Arduino" in sketch:
|
||||
return ret
|
||||
|
||||
start_time = time.monotonic()
|
||||
|
||||
# Skip if contains: ".board.test.skip" or ".all.test.skip"
|
||||
# Skip if not contains: ".board.test.only" for a specific board
|
||||
sketchdir = os.path.dirname(sketch)
|
||||
if os.path.exists(sketchdir + '/.all.test.skip') or os.path.exists(sketchdir + '/.' + variant + '.test.skip') or \
|
||||
(glob.glob(sketchdir + "/.*.test.only") and not os.path.exists(sketchdir + '/.' + variant + '.test.only')):
|
||||
if os.path.exists(sketchdir + '/.all.test.skip') or os.path.exists(sketchdir + '/.' + variant + '.test.skip'):
|
||||
success = SKIPPED
|
||||
ret[2] = 1
|
||||
elif glob.glob(sketchdir + "/.*.test.only") and not os.path.exists(sketchdir + '/.' + variant + '.test.only'):
|
||||
success = SKIPPED
|
||||
ret[2] = 1
|
||||
else:
|
||||
build_result = subprocess.run("arduino-cli compile --warnings all --fqbn {} {}".format(fqbn, sketch),
|
||||
shell=True, stdout=PIPE, stderr=PIPE)
|
||||
build_result = subprocess.run("arduino-cli compile --warnings all --fqbn {} {}".format(fqbn, sketch), shell=True,
|
||||
stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
||||
|
||||
# get stderr into a form where warning/error was output to stderr
|
||||
if build_result.returncode != 0:
|
||||
success = FAILED
|
||||
ret[1] = 1
|
||||
success = FAILED
|
||||
else:
|
||||
ret[0] = 1
|
||||
if build_result.stderr:
|
||||
@@ -67,6 +70,7 @@ def build_sketch(variant, sketch):
|
||||
build_duration = time.monotonic() - start_time
|
||||
print(build_format.format(sketch.split(os.path.sep)[1], os.path.basename(sketch), success,
|
||||
'{:5.2f}s'.format(build_duration)))
|
||||
|
||||
if success != SKIPPED:
|
||||
# Build failed
|
||||
if build_result.returncode != 0:
|
||||
@@ -74,11 +78,14 @@ def build_sketch(variant, sketch):
|
||||
|
||||
# Build with warnings
|
||||
if build_result.stderr:
|
||||
print(f"::group::warning-message")
|
||||
print(build_result.stderr.decode("utf-8"))
|
||||
print(f"::endgroup::")
|
||||
|
||||
return ret
|
||||
|
||||
# return [succeeded, failed, skipped]
|
||||
def build_variant(variant):
|
||||
|
||||
def build_all_examples(variant):
|
||||
print('\n')
|
||||
print(build_separator)
|
||||
print('| {:^84} |'.format('Board ' + variant))
|
||||
@@ -86,35 +93,39 @@ def build_variant(variant):
|
||||
print(build_format.format('Library', 'Example', '\033[39mResult\033[0m', 'Time'))
|
||||
print(build_separator)
|
||||
|
||||
with Pool(processes=os.cpu_count()) as pool:
|
||||
pool_args = list((map(lambda e, b=variant: [b, e], all_examples)))
|
||||
result = pool.starmap(build_sketch, pool_args)
|
||||
args = [[variant, s] for s in all_examples]
|
||||
with Pool() as pool:
|
||||
result = pool.map(build_a_example, args)
|
||||
# sum all element of same index (column sum)
|
||||
return list(map(sum, list(zip(*result))))
|
||||
|
||||
if __name__ == '__main__':
|
||||
build_boards = []
|
||||
|
||||
if __name__ == "__main__":
|
||||
# build all variants if input not existed
|
||||
if len(sys.argv) > 1:
|
||||
build_boards.append(sys.argv[1])
|
||||
else:
|
||||
build_boards = default_boards
|
||||
|
||||
# All examples in libraries except TinyUSB which has its own ci to build
|
||||
all_examples = list(glob.iglob('libraries/**/*.ino', recursive=True))
|
||||
all_examples = [i for i in all_examples if "Adafruit_TinyUSB_Arduino" not in i]
|
||||
all_examples.sort()
|
||||
|
||||
total_time = time.monotonic()
|
||||
build_time = time.monotonic()
|
||||
|
||||
# succeeded, failed, skipped
|
||||
total_result = [0, 0, 0]
|
||||
|
||||
for board in build_boards:
|
||||
ret = build_variant(board)
|
||||
total_result = list(map(lambda x, y: x + y, total_result, ret))
|
||||
fret = build_all_examples(board)
|
||||
if len(fret) == len(total_result):
|
||||
total_result = [total_result[i] + fret[i] for i in range(len(fret))]
|
||||
|
||||
build_time = time.monotonic() - build_time
|
||||
|
||||
print(build_separator)
|
||||
total_time = time.monotonic() - total_time
|
||||
print("Build Summary: {} {}, {} {}, {} {} and took {:.2f}s".format(total_result[0], SUCCEEDED, total_result[1],
|
||||
FAILED, total_result[2], SKIPPED, total_time))
|
||||
print("Build Summary: {} {}, {} {}, {} {} and took {:.2f}s".format(total_result[0], SUCCEEDED, total_result[1], FAILED, total_result[2], SKIPPED, build_time))
|
||||
print(build_separator)
|
||||
|
||||
sys.exit(total_result[1])
|
||||
+109
-100
@@ -38,18 +38,18 @@ def get_mcu(name):
|
||||
def build_upload(name):
|
||||
mcu = get_mcu(name)
|
||||
print("# Upload")
|
||||
print("%s.bootloader.tool=bootburn" % name)
|
||||
print("%s.upload.tool=nrfutil" % name)
|
||||
print("%s.upload.protocol=nrfutil" % name)
|
||||
print(f"{name}.bootloader.tool=bootburn")
|
||||
print(f"{name}.upload.tool=nrfutil")
|
||||
print(f"{name}.upload.protocol=nrfutil")
|
||||
if mcu == 52832:
|
||||
print("%s.upload.use_1200bps_touch=false" % name)
|
||||
print("%s.upload.wait_for_upload_port=false" % name)
|
||||
print("%s.upload.native_usb=false" % name)
|
||||
print(f"{name}.upload.use_1200bps_touch=false")
|
||||
print(f"{name}.upload.wait_for_upload_port=false")
|
||||
print(f"{name}.upload.native_usb=false")
|
||||
else:
|
||||
print("%s.upload.use_1200bps_touch=true" % name)
|
||||
print("%s.upload.wait_for_upload_port=true" % name)
|
||||
print("%s.upload.maximum_size=%d" % (name, mcu_dict[mcu]['flash_size']))
|
||||
print("%s.upload.maximum_data_size=%d" % (name, mcu_dict[mcu]['data_size']))
|
||||
print(f"{name}.upload.use_1200bps_touch=true")
|
||||
print(f"{name}.upload.wait_for_upload_port=true")
|
||||
print(f"{name}.upload.maximum_size={mcu_dict[mcu]['flash_size']}")
|
||||
print(f"{name}.upload.maximum_data_size={mcu_dict[mcu]['data_size']}")
|
||||
print()
|
||||
|
||||
|
||||
@@ -57,90 +57,88 @@ def build_header(name, variant, vendor_name, product_name, boarddefine, vid, pid
|
||||
prettyname = vendor_name + " " + product_name
|
||||
print()
|
||||
print("# -----------------------------------")
|
||||
print("# %s" % prettyname)
|
||||
print(f"# {prettyname}")
|
||||
print("# -----------------------------------")
|
||||
print("%s.name=%s" % (name, prettyname))
|
||||
print(f"{name}.name={prettyname}")
|
||||
print()
|
||||
|
||||
print("# VID/PID for Bootloader, Arduino & CircuitPython")
|
||||
for i in range(len(pid_list)):
|
||||
print("%s.vid.%d=%s" % (name, i, vid))
|
||||
print("%s.pid.%d=%s" % (name, i, pid_list[i]))
|
||||
print(f"{name}.vid.{i}={vid}")
|
||||
print(f"{name}.pid.{i}={pid_list[i]}")
|
||||
print()
|
||||
|
||||
build_upload(name)
|
||||
|
||||
print("# Build")
|
||||
print("%s.build.mcu=cortex-m4" % name)
|
||||
print("%s.build.f_cpu=64000000" % name)
|
||||
print("%s.build.board=%s" % (name, boarddefine))
|
||||
print("%s.build.core=nRF5" % name)
|
||||
print("%s.build.variant=%s" % (name, variant))
|
||||
print('%s.build.usb_manufacturer="%s"' % (name, vendor_name))
|
||||
print('%s.build.usb_product="%s"' % (name, product_name))
|
||||
print(f"{name}.build.mcu=cortex-m4")
|
||||
print(f"{name}.build.f_cpu=64000000")
|
||||
print(f"{name}.build.board={boarddefine}")
|
||||
print(f"{name}.build.core=nRF5")
|
||||
print(f"{name}.build.variant={variant}")
|
||||
print(f'{name}.build.usb_manufacturer="{vendor_name}"')
|
||||
print(f'{name}.build.usb_product="{product_name}"')
|
||||
|
||||
mcu = get_mcu(name)
|
||||
mcu_info = mcu_dict[mcu]
|
||||
print("%s.build.extra_flags=%s" % (name, mcu_info['extra_flags']))
|
||||
print("%s.build.ldscript=%s" % (name, mcu_info['ldscript']))
|
||||
print(f"{name}.build.extra_flags={mcu_info['extra_flags']}")
|
||||
print(f"{name}.build.ldscript={mcu_info['ldscript']}")
|
||||
print(f"{name}.build.openocdscript=scripts/openocd/daplink_nrf52.cfg")
|
||||
if mcu != 52832:
|
||||
print("%s.build.vid=%s" % (name, vid))
|
||||
print("%s.build.pid=%s" % (name, pid_list[0]))
|
||||
print("%s.build.uf2_family=%s" % (name, mcu_info['uf2_family']))
|
||||
print(f"{name}.build.vid={vid}")
|
||||
print(f"{name}.build.pid={pid_list[0]}")
|
||||
print(f"{name}.build.uf2_family={mcu_info['uf2_family']}")
|
||||
print()
|
||||
|
||||
|
||||
def build_softdevice(name):
|
||||
print("# SoftDevice Menu")
|
||||
print("# Menu: SoftDevice")
|
||||
mcu = get_mcu(name)
|
||||
if mcu == 52832:
|
||||
print("%s.menu.softdevice.s132v6=S132 6.1.1" % name)
|
||||
print("%s.menu.softdevice.s132v6.build.sd_name=s132" % name)
|
||||
print("%s.menu.softdevice.s132v6.build.sd_version=6.1.1" % name)
|
||||
print("%s.menu.softdevice.s132v6.build.sd_fwid=0x00B7" % name)
|
||||
print(f"{name}.menu.softdevice.s132v6=S132 6.1.1")
|
||||
print(f"{name}.menu.softdevice.s132v6.build.sd_name=s132")
|
||||
print(f"{name}.menu.softdevice.s132v6.build.sd_version=6.1.1")
|
||||
print(f"{name}.menu.softdevice.s132v6.build.sd_fwid=0x00B7")
|
||||
elif mcu == 52833:
|
||||
print("%s.menu.softdevice.s140v7=S140 7.3.0" % name)
|
||||
print("%s.menu.softdevice.s140v7.build.sd_name=s140" % name)
|
||||
print("%s.menu.softdevice.s140v7.build.sd_version=7.3.0" % name)
|
||||
print("%s.menu.softdevice.s140v7.build.sd_fwid=0x0123" % name)
|
||||
else:
|
||||
# 52840
|
||||
print("%s.menu.softdevice.s140v6=S140 6.1.1" % name)
|
||||
print("%s.menu.softdevice.s140v6.build.sd_name=s140" % name)
|
||||
print("%s.menu.softdevice.s140v6.build.sd_version=6.1.1" % name)
|
||||
print("%s.menu.softdevice.s140v6.build.sd_fwid=0x00B6" % name)
|
||||
print(f"{name}.menu.softdevice.s140v7=S140 7.3.0")
|
||||
print(f"{name}.menu.softdevice.s140v7.build.sd_name=s140")
|
||||
print(f"{name}.menu.softdevice.s140v7.build.sd_version=7.3.0")
|
||||
print(f"{name}.menu.softdevice.s140v7.build.sd_fwid=0x0123")
|
||||
elif mcu == 52840:
|
||||
print(f"{name}.menu.softdevice.s140v6=S140 6.1.1")
|
||||
print(f"{name}.menu.softdevice.s140v6.build.sd_name=s140")
|
||||
print(f"{name}.menu.softdevice.s140v6.build.sd_version=6.1.1")
|
||||
print(f"{name}.menu.softdevice.s140v6.build.sd_fwid=0x00B6")
|
||||
print()
|
||||
|
||||
|
||||
def build_debug(name):
|
||||
print("# Debug Menu")
|
||||
print("%s.menu.debug.l0=Level 0 (Release)" % name)
|
||||
print("%s.menu.debug.l0.build.debug_flags=-DCFG_DEBUG=0" % name)
|
||||
print("%s.menu.debug.l1=Level 1 (Error Message)" % name)
|
||||
print("%s.menu.debug.l1.build.debug_flags=-DCFG_DEBUG=1" % name)
|
||||
print("%s.menu.debug.l2=Level 2 (Full Debug)" % name)
|
||||
print("%s.menu.debug.l2.build.debug_flags=-DCFG_DEBUG=2" % name)
|
||||
print("%s.menu.debug.l3=Level 3 (Segger SystemView)" % name)
|
||||
print("%s.menu.debug.l3.build.debug_flags=-DCFG_DEBUG=3" % name)
|
||||
print("%s.menu.debug.l3.build.sysview_flags=-DCFG_SYSVIEW=1" % name)
|
||||
print("# Menu: Debug Level")
|
||||
print(f"{name}.menu.debug.l0=Level 0 (Release)")
|
||||
print(f"{name}.menu.debug.l0.build.debug_flags=-DCFG_DEBUG=0")
|
||||
print(f"{name}.menu.debug.l1=Level 1 (Error Message)")
|
||||
print(f"{name}.menu.debug.l1.build.debug_flags=-DCFG_DEBUG=1")
|
||||
print(f"{name}.menu.debug.l2=Level 2 (Full Debug)")
|
||||
print(f"{name}.menu.debug.l2.build.debug_flags=-DCFG_DEBUG=2")
|
||||
print(f"{name}.menu.debug.l3=Level 3 (Segger SystemView)")
|
||||
print(f"{name}.menu.debug.l3.build.debug_flags=-DCFG_DEBUG=3")
|
||||
print(f"{name}.menu.debug.l3.build.sysview_flags=-DCFG_SYSVIEW=1")
|
||||
print()
|
||||
|
||||
|
||||
def build_debug_output(name):
|
||||
print("# Debug Output Menu")
|
||||
print("%s.menu.debug_output.serial=Serial" % name)
|
||||
print("%s.menu.debug_output.serial.build.logger_flags=-DCFG_LOGGER=0" % name)
|
||||
print("%s.menu.debug_output.serial1=Serial1" % name)
|
||||
print("%s.menu.debug_output.serial1.build.logger_flags=-DCFG_LOGGER=1 -DCFG_TUSB_DEBUG=CFG_DEBUG" % name)
|
||||
print("%s.menu.debug_output.rtt=Segger RTT" % name)
|
||||
print(
|
||||
"%s.menu.debug_output.rtt.build.logger_flags=-DCFG_LOGGER=2 -DCFG_TUSB_DEBUG=CFG_DEBUG -DSEGGER_RTT_MODE_DEFAULT=SEGGER_RTT_MODE_BLOCK_IF_FIFO_FULL" % name)
|
||||
|
||||
print("# Menu: Debug Port")
|
||||
print(f"{name}.menu.debug_output.serial=Serial")
|
||||
print(f"{name}.menu.debug_output.serial.build.logger_flags=-DCFG_LOGGER=0")
|
||||
print(f"{name}.menu.debug_output.serial1=Serial1")
|
||||
print(f"{name}.menu.debug_output.serial1.build.logger_flags=-DCFG_LOGGER=1 -DCFG_TUSB_DEBUG=CFG_DEBUG")
|
||||
print(f"{name}.menu.debug_output.rtt=Segger RTT")
|
||||
print(f"{name}.menu.debug_output.rtt.build.logger_flags=-DCFG_LOGGER=2 -DCFG_TUSB_DEBUG=CFG_DEBUG -DSEGGER_RTT_MODE_DEFAULT=SEGGER_RTT_MODE_BLOCK_IF_FIFO_FULL")
|
||||
|
||||
def build_global_menu():
|
||||
print("menu.softdevice=SoftDevice")
|
||||
print("menu.debug=Debug")
|
||||
print("menu.debug_output=Debug Output")
|
||||
print("menu.debug=Debug Level")
|
||||
print("menu.debug_output=Debug Port")
|
||||
|
||||
|
||||
def make_board(name, variant, vendor_name, product_name, boarddefine, vid, pid_list):
|
||||
@@ -150,60 +148,71 @@ def make_board(name, variant, vendor_name, product_name, boarddefine, vid, pid_l
|
||||
build_debug_output(name)
|
||||
|
||||
|
||||
# ------------------------------
|
||||
# main
|
||||
# ------------------------------
|
||||
build_global_menu()
|
||||
|
||||
make_board("cluenrf52840", "clue_nrf52840", "Adafruit", "CLUE", "NRF52840_CLUE",
|
||||
"0x239A", ["0x8071", "0x0071", "0x8072"])
|
||||
# ------------------------------
|
||||
# Adafruit Boards
|
||||
# ------------------------------
|
||||
|
||||
make_board("cplaynrf52840", "circuitplayground_nrf52840", "Adafruit", "Circuit Playground Bluefruit",
|
||||
"NRF52840_CIRCUITPLAY",
|
||||
"0x239A", ["0x8045", "0x0045", "0x8046"])
|
||||
adafruit_boards_list = [
|
||||
["feather52832", "feather_nrf52832", "Adafruit", "Feather nRF52832", "NRF52832_FEATHER",
|
||||
"0x239A", []],
|
||||
|
||||
make_board("feather52832", "feather_nrf52832", "Adafruit", "Feather nRF52832", "NRF52832_FEATHER",
|
||||
"0x239A", [])
|
||||
["feather52840", "feather_nrf52840_express", "Adafruit", "Feather nRF52840 Express", "NRF52840_FEATHER",
|
||||
"0x239A", ["0x8029", "0x0029", "0x002A", "0x802A"]],
|
||||
|
||||
make_board("feather52840", "feather_nrf52840_express", "Adafruit", "Feather nRF52840 Express", "NRF52840_FEATHER",
|
||||
"0x239A", ["0x8029", "0x0029", "0x002A", "0x802A"])
|
||||
["feather52840sense", "feather_nrf52840_sense", "Adafruit", "Feather nRF52840 Sense", "NRF52840_FEATHER_SENSE",
|
||||
"0x239A", ["0x8087", "0x0087", "0x0088", "0x8088"]],
|
||||
|
||||
make_board("feather52840sense", "feather_nrf52840_sense", "Adafruit", "Feather nRF52840 Sense",
|
||||
"NRF52840_FEATHER_SENSE",
|
||||
"0x239A", ["0x8087", "0x0087", "0x0088", "0x8088"])
|
||||
["feather_nrf52840_sense_tft", "feather_nrf52840_sense_tft", "Adafruit", "Feather nRF52840 Sense TFT", "NRF52840_FEATHER_SENSE_TFT",
|
||||
"0x239A", ["0x8087", "0x0087", "0x0088", "0x8088"]], # TODO shared VID with sense for now
|
||||
|
||||
make_board("itsybitsy52840", "itsybitsy_nrf52840_express", "Adafruit", "ItsyBitsy nRF52840 Express",
|
||||
"NRF52840_ITSYBITSY -DARDUINO_NRF52_ITSYBITSY",
|
||||
"0x239A", ["0x8051", "0x0051", "0x0052", "0x8052"])
|
||||
["itsybitsy52840", "itsybitsy_nrf52840_express", "Adafruit", "ItsyBitsy nRF52840 Express", "NRF52840_ITSYBITSY -DARDUINO_NRF52_ITSYBITSY",
|
||||
"0x239A", ["0x8051", "0x0051", "0x0052", "0x8052"]],
|
||||
|
||||
make_board("ledglasses_nrf52840", "ledglasses_nrf52840", "Adafruit", "LED Glasses Driver nRF52840",
|
||||
"NRF52840_LED_GLASSES",
|
||||
"0x239A", ["0x810D", "0x010D", "0x810E"])
|
||||
["cplaynrf52840", "circuitplayground_nrf52840", "Adafruit", "Circuit Playground Bluefruit", "NRF52840_CIRCUITPLAY",
|
||||
"0x239A", ["0x8045", "0x0045", "0x8046"]],
|
||||
|
||||
make_board("mdbt50qrx", "raytac_mdbt50q_rx", "Raytac", "nRF52840 Dongle", "MDBT50Q_RX",
|
||||
"0x239A", ["0x810B", "0x010B", "0x810C"])
|
||||
["cluenrf52840", "clue_nrf52840", "Adafruit", "CLUE", "NRF52840_CLUE",
|
||||
"0x239A", ["0x8071", "0x0071", "0x8072"]],
|
||||
|
||||
print()
|
||||
print("# -------------------------------------------------------")
|
||||
print("#")
|
||||
print("# Boards not yet in production")
|
||||
print("#")
|
||||
print("# -------------------------------------------------------")
|
||||
["ledglasses_nrf52840", "ledglasses_nrf52840", "Adafruit", "LED Glasses Driver nRF52840", "NRF52840_LED_GLASSES",
|
||||
"0x239A", ["0x810D", "0x010D", "0x810E"]],
|
||||
|
||||
make_board("metro52840", "metro_nrf52840_express", "Adafruit", "Metro nRF52840 Express", "NRF52840_METRO",
|
||||
"0x239A", ["0x803F", "0x003F", "0x0040", "0x8040"])
|
||||
["mdbt50qrx", "raytac_mdbt50q_rx", "Raytac", "nRF52840 Dongle", "MDBT50Q_RX",
|
||||
"0x239A", ["0x810B", "0x010B", "0x810C"]],
|
||||
|
||||
# TODO currently shared PID with nrf52840
|
||||
make_board("feather52833", "feather_nrf52833_express", "Adafruit", "Feather nRF52833 Express", "NRF52833_FEATHER",
|
||||
"0x239A", ["0x8029", "0x0029", "0x002A", "0x802A"])
|
||||
["metro52840", "metro_nrf52840_express", "Adafruit", "Metro nRF52840 Express", "NRF52840_METRO",
|
||||
"0x239A", ["0x803F", "0x003F", "0x0040", "0x8040"]],
|
||||
|
||||
# ["feather52833", "feather_nrf52833_express", "Adafruit", "Feather nRF52833 Express", "NRF52833_FEATHER",
|
||||
# "0x239A", ["0x8029", "0x0029", "0x002A", "0x802A"]],
|
||||
]
|
||||
|
||||
for b in adafruit_boards_list:
|
||||
make_board(*b)
|
||||
|
||||
# ------------------------------
|
||||
# 3rd Party Boards
|
||||
# ------------------------------
|
||||
|
||||
print()
|
||||
print()
|
||||
print("# -------------------------------------------------------")
|
||||
print("#")
|
||||
print("# Boards by 3rd Party (not Adafruit)")
|
||||
print("#")
|
||||
print("# Boards that aren't made by Adafruit")
|
||||
print("# and are not officially supported")
|
||||
print("# -------------------------------------------------------")
|
||||
|
||||
make_board("particle_xenon", "particle_xenon", "Particle", "Xenon", "PARTICLE_XENON",
|
||||
"0x239A", ["0x8029", "0x0029"])
|
||||
thirdparty_boards_list = [
|
||||
["pca10056", "pca10056", "Nordic", "nRF52840 DK", "NRF52840_PCA10056",
|
||||
"0x239A", ["0x8029", "0x0029"]],
|
||||
|
||||
make_board("pca10056", "pca10056", "Nordic", "nRF52840 DK", "NRF52840_PCA10056",
|
||||
"0x239A", ["0x8029", "0x0029"])
|
||||
["particle_xenon", "particle_xenon", "Particle", "Xenon", "PARTICLE_XENON",
|
||||
"0x239A", ["0x8029", "0x0029"]],
|
||||
]
|
||||
|
||||
for b in thirdparty_boards_list:
|
||||
make_board(*b)
|
||||
+41
-44
@@ -1,7 +1,24 @@
|
||||
import os
|
||||
import shutil
|
||||
import urllib.request
|
||||
import pathlib
|
||||
from multiprocessing import Pool
|
||||
|
||||
# Get all variants
|
||||
all_variant = []
|
||||
for entry in os.scandir("variants"):
|
||||
if entry.is_dir():
|
||||
all_variant.append(entry.name)
|
||||
all_variant.sort()
|
||||
|
||||
# Detect version in platform.txt
|
||||
version = ''
|
||||
with open('platform.txt') as pf:
|
||||
platform_txt = pf.read()
|
||||
e = '{build.variant}_bootloader-'
|
||||
v1 = platform_txt.index(e) + len(e)
|
||||
v2 = platform_txt.index('_', v1)
|
||||
version = platform_txt[v1:v2]
|
||||
|
||||
print(f'version {version}')
|
||||
|
||||
|
||||
def get_sd(name):
|
||||
@@ -14,53 +31,33 @@ def get_sd(name):
|
||||
return 's140_6.1.1'
|
||||
|
||||
|
||||
# Get all variants
|
||||
all_variant = []
|
||||
for entry in os.scandir("variants"):
|
||||
if entry.is_dir():
|
||||
all_variant.append(entry.name)
|
||||
all_variant.sort()
|
||||
|
||||
# Detect version in platform.txt
|
||||
version = '';
|
||||
with open('platform.txt') as pf:
|
||||
platform_txt = pf.read()
|
||||
e = '{build.variant}_bootloader-'
|
||||
v1 = platform_txt.index(e) + len(e)
|
||||
v2 = platform_txt.index('_', v1)
|
||||
version = platform_txt[v1:v2]
|
||||
|
||||
print('version {}'.format(version))
|
||||
|
||||
for variant in all_variant:
|
||||
# Download a variant's bootloader
|
||||
def download_variant(variant):
|
||||
sd = get_sd(variant)
|
||||
|
||||
# Download from bootloader release
|
||||
name = '{}_bootloader-{}'.format(variant, version)
|
||||
url = 'https://github.com/adafruit/Adafruit_nRF52_Bootloader/releases/download/{}/'.format(version)
|
||||
f_zip = f'{variant}_bootloader-{version}_{sd}.zip'
|
||||
f_hex = f'{variant}_bootloader-{version}_{sd}.hex'
|
||||
f_uf2 = f'update-{variant}_bootloader-{version}_nosd.uf2'
|
||||
url_prefix = f'https://github.com/adafruit/Adafruit_nRF52_Bootloader/releases/download/{version}/'
|
||||
|
||||
# Download zip, hex and uf2 if not 832
|
||||
fzip = '{}_{}.zip'.format(name, sd)
|
||||
fhex = '{}_{}.hex'.format(name, sd)
|
||||
fuf2 = 'update-{}_nosd.uf2'.format(name, sd)
|
||||
# remove existing bootloader files
|
||||
if os.path.exists(f'bootloader/{variant}'):
|
||||
for item in os.listdir(f'bootloader/{variant}'):
|
||||
os.remove(os.path.join(f'bootloader/{variant}', item))
|
||||
else:
|
||||
os.makedirs(f'bootloader/{variant}')
|
||||
|
||||
print("Downloading ", fzip)
|
||||
urllib.request.urlretrieve(url + fzip, fzip)
|
||||
print(f"Downloading {f_zip}")
|
||||
urllib.request.urlretrieve(url_prefix + f_zip, f'bootloader/{variant}/{f_zip}')
|
||||
|
||||
print("Downloading ", fhex)
|
||||
urllib.request.urlretrieve(url + fhex, fhex)
|
||||
print(f"Downloading {f_hex}")
|
||||
urllib.request.urlretrieve(url_prefix + f_hex, f'bootloader/{variant}/{f_hex}')
|
||||
|
||||
if variant != 'feather_nrf52832':
|
||||
print("Downloading ", fuf2)
|
||||
urllib.request.urlretrieve(url + fuf2, fuf2)
|
||||
if 's132' not in sd:
|
||||
print(f"Downloading {f_uf2}")
|
||||
urllib.request.urlretrieve(url_prefix + f_uf2, f'bootloader/{variant}/{f_uf2}')
|
||||
|
||||
# remove existing bootloader and copy new files
|
||||
boot_path = pathlib.Path('bootloader/{}'.format(variant))
|
||||
shutil.rmtree(boot_path, ignore_errors=True)
|
||||
os.mkdir(boot_path)
|
||||
|
||||
# move file
|
||||
os.rename(fzip, boot_path / fzip)
|
||||
os.rename(fhex, boot_path / fhex)
|
||||
if variant != 'feather_nrf52832':
|
||||
os.rename(fuf2, boot_path / fuf2)
|
||||
if __name__ == "__main__":
|
||||
with Pool() as p:
|
||||
p.map(download_variant, all_variant)
|
||||
Reference in new issue
Block a user