1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2025-08-02 20:08:31 +00:00

support simplified nrfutil, more universal package update

This commit is contained in:
tychovrahe 2023-09-11 13:42:45 +02:00
parent f0ff6cbca9
commit b8ec994fe3
2 changed files with 23 additions and 17 deletions

View File

@ -463,14 +463,14 @@ program_pkg = env.Command(
target='ble_firmware.zip',
source=program_hex,
action=[
f'python ../../pc-nrfutil/nordicsemi/ pkg generate --hw-version 52 --sd-req=0x100 --application $SOURCE --app-boot-validation VALIDATE_ECDSA_P256_SHA256 --key-file ./embed/ble_bootloader/priv.pem $TARGET --application-version-string {tools.get_version("embed/ble_firmware/version.h")}'
f'python ../../pc-nrfutil/nordicsemi/ pkg generate --hw-version 52 --sd-req=0x100 --application $SOURCE --key-file ./embed/ble_bootloader/priv.pem $TARGET --application-version-string {tools.get_version("embed/ble_firmware/version.h")} --sd-id=0x100 --softdevice ./embed/sdk/nrf52/components/softdevice/s140/hex/s140_nrf52_7.2.0_softdevice.hex '
],
)
settings = env.Command(
target='settings.hex',
source=program_hex,
action=f'python ../../pc-nrfutil/nordicsemi/ settings generate --family NRF52 --application $SOURCE --app-boot-validation VALIDATE_ECDSA_P256_SHA256 --application-version-string {tools.get_version("embed/ble_firmware/version.h")} --bootloader-version {tools.get_version_int("embed/ble_bootloader/version.h")} --bl-settings-version 2 --sd-boot-validation VALIDATE_ECDSA_P256_SHA256 --softdevice ./embed/sdk/nrf52/components/softdevice/s140/hex/s140_nrf52_7.2.0_softdevice.hex --key-file ./embed/ble_bootloader/priv.pem $TARGET',
action=f'python ../../pc-nrfutil/nordicsemi/ settings generate --family NRF52 --application $SOURCE --application-version-string {tools.get_version("embed/ble_firmware/version.h")} --bootloader-version {tools.get_version_int("embed/ble_bootloader/version.h")} --softdevice ./embed/sdk/nrf52/components/softdevice/s140/hex/s140_nrf52_7.2.0_softdevice.hex --key-file ./embed/ble_bootloader/priv.pem $TARGET',
)
program_merge = env.Command(

View File

@ -14,6 +14,7 @@
# You should have received a copy of the License along with this library.
# If not, see <https://www.gnu.org/licenses/lgpl-3.0.html>.
import json
import sys
import zipfile
from typing import TYPE_CHECKING, BinaryIO
@ -45,8 +46,13 @@ def update(
"""Upload new BLE firmware to device."""
with zipfile.ZipFile(package) as archive:
binfile = archive.read("ble_firmware.bin")
datfile = archive.read("ble_firmware.dat")
manifest = archive.read("manifest.json")
mainfest_data = json.loads(manifest.decode("utf-8"))["manifest"]
for k in mainfest_data.keys():
binfile = archive.read(mainfest_data[k]["bin_file"])
datfile = archive.read(mainfest_data[k]["dat_file"])
"""Perform the final act of loading the firmware into Trezor."""
try: