update bootloader version to 0.7.0, also include 833

This commit is contained in:
hathach committed 2022-07-13 19:34:40 +07:00
1 parent c73245a635
commit 820beaf926
51 files changed
+62465 -51311

No files matched your search

File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
+38 -15
View File
@@ -1,7 +1,18 @@
import os
import shutil
import urllib.request
import zipfile
import pathlib
def get_sd(name):
if '52832' in name:
return 's132_6.1.1'
elif '52833' in name:
return 's140_7.3.0'
else:
# most of the board is 52840
return 's140_6.1.1'
# Get all variants
all_variant = []
@@ -22,22 +33,34 @@ with open('platform.txt') as pf:
print('version {}'.format(version))
for variant in all_variant:
sd = get_sd(variant)
# Download from bootloader release
name = '{}_bootloader-{}.zip'.format(variant, version)
url = 'https://github.com/adafruit/Adafruit_nRF52_Bootloader/releases/download/{}/{}'.format(version, name)
print("Downloading", name)
urllib.request.urlretrieve(url, name)
name = '{}_bootloader-{}'.format(variant, version)
url = 'https://github.com/adafruit/Adafruit_nRF52_Bootloader/releases/download/{}/'.format(version)
# remove existing bootloader
shutil.rmtree('bootloader/{}'.format(variant), ignore_errors=True)
# 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)
# unzip
with zipfile.ZipFile(name, "r") as zip_ref:
zip_ref.extractall("bootloader/{}".format(variant))
print("Downloading ", fzip)
urllib.request.urlretrieve(url + fzip, fzip)
# Remove update.uf2 for 832
if variant == 'feather_nrf52832':
os.remove("bootloader/{}/update-{}_nosd.uf2".format(variant, name[:-4]))
print("Downloading ", fhex)
urllib.request.urlretrieve(url + fhex, fhex)
# remove zip file
os.remove(name)
if variant != 'feather_nrf52832':
print("Downloading ", fuf2)
urllib.request.urlretrieve(url + fuf2, fuf2)
# 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)