From 1c0393421c03c3c0fb4fa4b0d1632076a9a50e26 Mon Sep 17 00:00:00 2001 From: Niklas Dusenlund Date: Mon, 1 Jun 2026 13:26:56 +0200 Subject: [PATCH 1/4] Rename Plus internals to Nova Replace internal Plus platform and product symbols with Nova names across C, Rust, Python, tests, and build helpers. Keep identifying protocol strings, target names, magic values, and platform byte values unchanged. --- .github/workflows/ci-common.yml | 14 +++---- Makefile | 22 +++++----- py/bitbox02/bitbox02/bitbox02/bootloader.py | 16 +++---- .../communication/bitbox_api_protocol.py | 12 +++--- py/bitbox02/bitbox02/communication/devices.py | 16 +++---- releases/describe_signed_firmware.py | 8 ++-- ...{set-bb02plus.jlink => set-bb02nova.jlink} | 0 src/CMakeLists.txt | 34 +++++++-------- src/bootloader/bootloader.c | 18 ++++---- src/bootloader/bootloader.h | 2 +- src/bootloader/startup.c | 28 ++++++------- src/factorysetup.c | 4 +- src/firmware.c | 2 +- src/hww.c | 6 +-- src/memory/memory.c | 4 +- src/memory/memory_shared.c | 2 +- src/memory/memory_shared.h | 2 +- src/platform/driver_init.c | 6 +-- src/platform/platform_config.h | 26 ++++++------ src/platform/platform_init.c | 14 +++---- src/platform/platform_init.h | 2 +- src/rust/bitbox-hal/src/memory.rs | 2 +- src/rust/bitbox02-rust-c/Cargo.toml | 16 +++---- src/rust/bitbox02-rust-c/src/lib.rs | 6 +-- .../bitbox02-rust/src/communication_mode.rs | 6 +-- .../bitbox02-rust/src/hww/api/bluetooth.rs | 2 +- .../bitbox02-rust/src/hww/api/device_info.rs | 2 +- src/rust/bitbox02-rust/src/hww/transport.rs | 4 +- src/rust/bitbox02-rust/src/main_loop.rs | 2 +- src/rust/bitbox02-rust/src/reset.rs | 2 +- src/rust/bitbox02-sys/build.rs | 2 +- src/rust/bitbox02/src/hal/memory.rs | 6 +-- src/rust/bitbox02/src/memory.rs | 4 +- src/system.c | 4 +- src/ui/components/ui_images.c | 42 +++++++++---------- ...bitbox02plus.h => usb_desc_bitbox02nova.h} | 38 ++++++++--------- src/usb/usb.c | 16 +++---- test/hardware-fakes/src/fake_memory.c | 2 +- test/unit-test/test_memory.c | 8 ++-- 39 files changed, 201 insertions(+), 201 deletions(-) rename scripts/{set-bb02plus.jlink => set-bb02nova.jlink} (100%) rename src/usb/class/{usb_desc_bitbox02plus.h => usb_desc_bitbox02nova.h} (81%) diff --git a/.github/workflows/ci-common.yml b/.github/workflows/ci-common.yml index 8663c95a42..459ce85f53 100644 --- a/.github/workflows/ci-common.yml +++ b/.github/workflows/ci-common.yml @@ -207,13 +207,13 @@ jobs: - bootloader-btc - bootloader-btc-development - bootloader-btc-production - - bootloader-plus - - bootloader-plus-development - - bootloader-plus-production - - bootloader-plus-debug - - bootloader-plus-btc - - bootloader-plus-btc-development - - bootloader-plus-btc-production + - bootloader-nova + - bootloader-nova-development + - bootloader-nova-production + - bootloader-nova-debug + - bootloader-nova-btc + - bootloader-nova-btc-development + - bootloader-nova-btc-production - firmware - firmware-btc - factory-setup diff --git a/Makefile b/Makefile index 7a32c7c85e..335585bc9e 100644 --- a/Makefile +++ b/Makefile @@ -70,20 +70,20 @@ bootloader-btc-development: | build bootloader-btc-production: | build $(MAKE) -C build bb02-bl-btconly-production.elf -bootloader-plus: | build +bootloader-nova: | build $(MAKE) -C build bb02p-bl-multi.elf -bootloader-plus-development: | build +bootloader-nova-development: | build $(MAKE) -C build bb02p-bl-multi-development.elf -bootloader-plus-production: | build +bootloader-nova-production: | build $(MAKE) -C build bb02p-bl-multi-production.elf -bootloader-plus-debug: | build-debug +bootloader-nova-debug: | build-debug $(MAKE) -C build-debug bb02p-bl-multi-development.elf -bootloader-plus-btc: | build +bootloader-nova-btc: | build $(MAKE) -C build bb02p-bl-btconly.elf -bootloader-plus-btc-development: | build +bootloader-nova-btc-development: | build $(MAKE) -C build bb02p-bl-btconly-development.elf -bootloader-plus-btc-production: | build +bootloader-nova-btc-production: | build $(MAKE) -C build bb02p-bl-btconly-production.elf factory-setup: | build @@ -125,9 +125,9 @@ flash-dev-firmware: ./py/load_firmware.py build/bin/firmware.bin --debug jlink-flash-bootloader-development: | build JLinkExe -NoGui 1 -if SWD -device ATSAMD51J20 -speed 4000 -autoconnect 1 -CommanderScript ./build/scripts/bb02-bl-multi-development.jlink -jlink-flash-bootloader-plus-development: | build +jlink-flash-bootloader-nova-development: | build JLinkExe -NoGui 1 -if SWD -device ATSAMD51J20 -speed 4000 -autoconnect 1 -CommanderScript ./build/scripts/bb02p-bl-multi-development.jlink -jlink-flash-bootloader-btc-plus-development: | build +jlink-flash-bootloader-btc-nova-development: | build JLinkExe -NoGui 1 -if SWD -device ATSAMD51J20 -speed 4000 -autoconnect 1 -CommanderScript ./build/scripts/bb02p-bl-btconly-development.jlink jlink-flash-bootloader-development-locked: | build JLinkExe -NoGui 1 -if SWD -device ATSAMD51J20 -speed 4000 -autoconnect 1 -CommanderScript ./build/scripts/bb02-bl-multi-development-locked.jlink @@ -153,8 +153,8 @@ jlink-flash-reset-version: JLinkExe -NoGui 1 -if SWD -device ATSAMD51J20 -speed 4000 -autoconnect 1 -CommanderScript ./scripts/reset-version.jlink jlink-flash-set-securechip-optiga: JLinkExe -NoGui 1 -if SWD -device ATSAMD51J20 -speed 4000 -autoconnect 1 -CommanderScript ./scripts/set-securechip-optiga.jlink -jlink-flash-set-bb02plus: - JLinkExe -NoGui 1 -if SWD -device ATSAMD51J20 -speed 4000 -autoconnect 1 -CommanderScript ./scripts/set-bb02plus.jlink +jlink-flash-set-bb02nova: + JLinkExe -NoGui 1 -if SWD -device ATSAMD51J20 -speed 4000 -autoconnect 1 -CommanderScript ./scripts/set-bb02nova.jlink jlink-flash-bb02-set-factory-randomness: JLinkExe -NoGui 1 -if SWD -device ATSAMD51J20 -speed 4000 -autoconnect 1 -CommanderScript ./scripts/bb02-set-factory-randomness.jlink jlink-erase-firmware-quick: diff --git a/py/bitbox02/bitbox02/bitbox02/bootloader.py b/py/bitbox02/bitbox02/bitbox02/bootloader.py index 5834bd360b..f0936b498f 100644 --- a/py/bitbox02/bitbox02/bitbox02/bootloader.py +++ b/py/bitbox02/bitbox02/bitbox02/bootloader.py @@ -17,8 +17,8 @@ parse_device_version, BB02MULTI_BOOTLOADER, BB02BTC_BOOTLOADER, - BITBOX02PLUS_MULTI_BOOTLOADER, - BITBOX02PLUS_BTC_BOOTLOADER, + BITBOX02NOVA_MULTI_BOOTLOADER, + BITBOX02NOVA_BTC_BOOTLOADER, ) BOOTLOADER_CMD = 0x80 + 0x40 + 0x03 @@ -33,8 +33,8 @@ SIGDATA_MAGIC_BITBOX02_MULTI = struct.pack(">I", 0x653F362B) SIGDATA_MAGIC_BITBOX02_BTCONLY = struct.pack(">I", 0x11233B0B) -SIGDATA_MAGIC_BITBOX02PLUS_MULTI = struct.pack(">I", 0x5B648CEB) -SIGDATA_MAGIC_BITBOX02PLUS_BTCONLY = struct.pack(">I", 0x48714774) +SIGDATA_MAGIC_BITBOX02NOVA_MULTI = struct.pack(">I", 0x5B648CEB) +SIGDATA_MAGIC_BITBOX02NOVA_BTCONLY = struct.pack(">I", 0x48714774) MAGIC_LEN = 4 @@ -68,8 +68,8 @@ def parse_signed_firmware(firmware: bytes) -> typing.Tuple[bytes, bytes, bytes]: if magic not in ( SIGDATA_MAGIC_BITBOX02_MULTI, SIGDATA_MAGIC_BITBOX02_BTCONLY, - SIGDATA_MAGIC_BITBOX02PLUS_MULTI, - SIGDATA_MAGIC_BITBOX02PLUS_BTCONLY, + SIGDATA_MAGIC_BITBOX02NOVA_MULTI, + SIGDATA_MAGIC_BITBOX02NOVA_BTCONLY, ): raise ValueError("invalid magic") @@ -87,8 +87,8 @@ def __init__(self, transport: TransportLayer, device_info: DeviceInfo): self.expected_magic = { BB02MULTI_BOOTLOADER: SIGDATA_MAGIC_BITBOX02_MULTI, BB02BTC_BOOTLOADER: SIGDATA_MAGIC_BITBOX02_BTCONLY, - BITBOX02PLUS_MULTI_BOOTLOADER: SIGDATA_MAGIC_BITBOX02PLUS_MULTI, - BITBOX02PLUS_BTC_BOOTLOADER: SIGDATA_MAGIC_BITBOX02PLUS_BTCONLY, + BITBOX02NOVA_MULTI_BOOTLOADER: SIGDATA_MAGIC_BITBOX02NOVA_MULTI, + BITBOX02NOVA_BTC_BOOTLOADER: SIGDATA_MAGIC_BITBOX02NOVA_BTCONLY, }.get(device_info["product_string"]) self.version = parse_device_version(device_info["serial_number"]) # Delete the prelease part, as it messes with the comparison (e.g. 3.0.0-pre < 3.0.0 is diff --git a/py/bitbox02/bitbox02/communication/bitbox_api_protocol.py b/py/bitbox02/bitbox02/communication/bitbox_api_protocol.py index 04446d761a..c2c07600dd 100644 --- a/py/bitbox02/bitbox02/communication/bitbox_api_protocol.py +++ b/py/bitbox02/bitbox02/communication/bitbox_api_protocol.py @@ -18,7 +18,7 @@ from .devices import parse_device_version, DeviceInfo from .communication import TransportLayer -from .devices import BITBOX02MULTI, BITBOX02BTC, BITBOX02PLUS_MULTI, BITBOX02PLUS_BTC +from .devices import BITBOX02MULTI, BITBOX02BTC, BITBOX02NOVA_MULTI, BITBOX02NOVA_BTC try: from .generated import hww_pb2 as hww @@ -202,7 +202,7 @@ class Platform(enum.Enum): """Available hardware platforms""" BITBOX02 = "bitbox02" - BITBOX02PLUS = "bitbox02-plus" + BITBOX02NOVA = "bitbox02-plus" BITBOX03 = "bitbox03" @@ -563,9 +563,9 @@ def __init__( if device_info is not None: version = device_info["serial_number"] - if device_info["product_string"] in (BITBOX02MULTI, BITBOX02PLUS_MULTI): + if device_info["product_string"] in (BITBOX02MULTI, BITBOX02NOVA_MULTI): edition = BitBox02Edition.MULTI - elif device_info["product_string"] in (BITBOX02BTC, BITBOX02PLUS_BTC): + elif device_info["product_string"] in (BITBOX02BTC, BITBOX02NOVA_BTC): edition = BitBox02Edition.BTCONLY else: raise Exception("Invalid product string") @@ -715,13 +715,13 @@ def get_info( platform_byte, response = response[0], response[1:] platform = { 0x00: Platform.BITBOX02, - 0x02: Platform.BITBOX02PLUS, + 0x02: Platform.BITBOX02NOVA, 0x03: Platform.BITBOX03, }[platform_byte] edition_byte, response = response[0], response[1:] edition: Union[BitBox02Edition] - if platform in (Platform.BITBOX02, Platform.BITBOX02PLUS, Platform.BITBOX03): + if platform in (Platform.BITBOX02, Platform.BITBOX02NOVA, Platform.BITBOX03): edition = {0x00: BitBox02Edition.MULTI, 0x01: BitBox02Edition.BTCONLY}[edition_byte] else: raise Exception("Unknown platform: {}".format(platform)) diff --git a/py/bitbox02/bitbox02/communication/devices.py b/py/bitbox02/bitbox02/communication/devices.py index 3d8b92b7d3..f1f7253ae2 100644 --- a/py/bitbox02/bitbox02/communication/devices.py +++ b/py/bitbox02/bitbox02/communication/devices.py @@ -15,10 +15,10 @@ BITBOX02MULTI = "BitBox02" BITBOX02BTC = "BitBox02BTC" -BITBOX02PLUS_MULTI_BOOTLOADER = "BitBox02 Nova Multi bl" -BITBOX02PLUS_BTC_BOOTLOADER = "BitBox02 Nova BTC-only bl" -BITBOX02PLUS_MULTI = "BitBox02 Nova Multi" -BITBOX02PLUS_BTC = "BitBox02 Nova BTC-only" +BITBOX02NOVA_MULTI_BOOTLOADER = "BitBox02 Nova Multi bl" +BITBOX02NOVA_BTC_BOOTLOADER = "BitBox02 Nova BTC-only bl" +BITBOX02NOVA_MULTI = "BitBox02 Nova Multi" +BITBOX02NOVA_BTC = "BitBox02 Nova BTC-only" class TooManyFoundException(Exception): @@ -105,8 +105,8 @@ def get_any_bitbox02s() -> List[DeviceInfo]: """ devices = get_bitbox02multi_devices() devices.extend(get_bitbox02btc_devices()) - devices.extend(get_devices(BITBOX02PLUS_MULTI)) - devices.extend(get_devices(BITBOX02PLUS_BTC)) + devices.extend(get_devices(BITBOX02NOVA_MULTI)) + devices.extend(get_devices(BITBOX02NOVA_BTC)) return devices @@ -134,8 +134,8 @@ def get_any_bitbox02_bootloaders() -> List[DeviceInfo]: """ devices = get_bitbox02multi_bootloaders() devices.extend(get_bitbox02btc_bootloaders()) - devices.extend(get_devices(BITBOX02PLUS_MULTI_BOOTLOADER)) - devices.extend(get_devices(BITBOX02PLUS_BTC_BOOTLOADER)) + devices.extend(get_devices(BITBOX02NOVA_MULTI_BOOTLOADER)) + devices.extend(get_devices(BITBOX02NOVA_BTC_BOOTLOADER)) return devices diff --git a/releases/describe_signed_firmware.py b/releases/describe_signed_firmware.py index e024992d8d..0ba6547efd 100755 --- a/releases/describe_signed_firmware.py +++ b/releases/describe_signed_firmware.py @@ -14,8 +14,8 @@ MAGIC_LEN = 4 MAGIC_MULTI = struct.pack(">I", 0x653F362B) MAGIC_BTCONLY = struct.pack(">I", 0x11233B0B) -MAGIC_BITBOX02PLUS_MULTI = struct.pack(">I", 0x5B648CEB) -MAGIC_BITBOX02PLUS_BTCONLY = struct.pack(">I", 0x48714774) +MAGIC_BITBOX02NOVA_MULTI = struct.pack(">I", 0x5B648CEB) +MAGIC_BITBOX02NOVA_BTCONLY = struct.pack(">I", 0x48714774) MAX_FIRMWARE_SIZE = 884736 NUM_ROOT_KEYS = 3 @@ -49,9 +49,9 @@ def main() -> int: print("This is a BitBox02 Multi firmware.") elif magic == MAGIC_BTCONLY: print("This is a BitBox02 Bitcoin-only firmware.") - elif magic == MAGIC_BITBOX02PLUS_MULTI: + elif magic == MAGIC_BITBOX02NOVA_MULTI: print("This is a BitBox02 Nova Multi firmware") - elif magic == MAGIC_BITBOX02PLUS_BTCONLY: + elif magic == MAGIC_BITBOX02NOVA_BTCONLY: print("This is a BitBox02 Nova Bitcoin-only firmware.") else: print( diff --git a/scripts/set-bb02plus.jlink b/scripts/set-bb02nova.jlink similarity index 100% rename from scripts/set-bb02plus.jlink rename to scripts/set-bb02nova.jlink diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index deb4e45a54..07e20739f4 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -120,14 +120,14 @@ set(QTOUCH-SOURCES ) set(QTOUCH-SOURCES ${QTOUCH-SOURCES} PARENT_SCOPE) -# The additional files required for the plus platform -set(PLATFORM-BITBOX02-PLUS-SOURCES +# The additional files required for the Nova platform +set(PLATFORM-BITBOX02-NOVA-SOURCES ${CMAKE_SOURCE_DIR}/src/da14531/da14531.c ${CMAKE_SOURCE_DIR}/src/da14531/da14531_protocol.c ${CMAKE_SOURCE_DIR}/src/da14531/da14531_handler.c ${CMAKE_SOURCE_DIR}/src/uart.c ) -set(PLATFORM-BITBOX02-PLUS-SOURCES ${PLATFORM-BITBOX02-PLUS-SOURCES} PARENT_SCOPE) +set(PLATFORM-BITBOX02-NOVA-SOURCES ${PLATFORM-BITBOX02-NOVA-SOURCES} PARENT_SCOPE) set(PLATFORM-BITBOX02-SOURCES ${CMAKE_SOURCE_DIR}/src/sd_mmc/sd_mmc_start.c @@ -192,7 +192,7 @@ set(FIRMWARE-SOURCES ${DRIVER-SOURCES} ${QTOUCH-SOURCES} ${SECURECHIP-SOURCES} - ${PLATFORM-BITBOX02-PLUS-SOURCES} + ${PLATFORM-BITBOX02-NOVA-SOURCES} ${CMAKE_SOURCE_DIR}/src/common_main.c ) @@ -292,7 +292,7 @@ set(BOOTLOADERS-BITBOX02 bb02-bl-btconly-development # Runs signed/unsigned firmware and has bootloader menu bb02-bl-btconly-production # Runs signed (btc-only keys) firmware and bootloader is locked ) -set(BOOTLOADERS-BITBOX02PLUS +set(BOOTLOADERS-BITBOX02NOVA bb02p-bl-multi # Runs signed firmware bb02p-bl-multi-development # Runs signed/unsigned firmware and has bootloader menu bb02p-bl-multi-development-locked # Runs signed/unsigned firmware, has bootloader menu and bootloader is locked @@ -303,7 +303,7 @@ set(BOOTLOADERS-BITBOX02PLUS ) set(BOOTLOADERS ${BOOTLOADERS-BITBOX02} - ${BOOTLOADERS-BITBOX02PLUS} + ${BOOTLOADERS-BITBOX02NOVA} ) set(BOOTLOADERS ${BOOTLOADERS} PARENT_SCOPE) @@ -438,15 +438,15 @@ if(CMAKE_CROSSCOMPILING) target_link_libraries(${elf} PRIVATE -Wl,--print-memory-usage) endforeach(bootloader) - foreach(bootloader ${DEVDEVICE-BOOTLOADERS} ${BOOTLOADERS-BITBOX02PLUS}) + foreach(bootloader ${DEVDEVICE-BOOTLOADERS} ${BOOTLOADERS-BITBOX02NOVA}) set(elf ${bootloader}.elf) target_link_libraries(${elf} PRIVATE ${QTOUCHLIB_A} ${QTOUCHLIB_B} ${QTOUCHLIB_T}) target_sources(${elf} PRIVATE ${QTOUCH-SOURCES}) endforeach(bootloader) - foreach(bootloader ${BOOTLOADERS-BITBOX02PLUS}) + foreach(bootloader ${BOOTLOADERS-BITBOX02NOVA}) set(elf ${bootloader}.elf) - target_sources(${elf} PRIVATE ${PLATFORM-BITBOX02-PLUS-SOURCES}) + target_sources(${elf} PRIVATE ${PLATFORM-BITBOX02-NOVA-SOURCES}) target_link_libraries(${bootloader}.elf PRIVATE embedded-swd) endforeach(bootloader) @@ -466,20 +466,20 @@ if(CMAKE_CROSSCOMPILING) target_compile_definitions(bb02-bl-btconly-production.elf PRIVATE PRODUCT_BITBOX_BTCONLY BOOTLOADER_PRODUCTION) set_property(TARGET bb02-bl-btconly-production.elf PROPERTY EXCLUDE_FROM_ALL ON) - # BB02PLUS definitions + # BB02NOVA definitions - target_compile_definitions(bb02p-bl-multi.elf PRIVATE PRODUCT_BITBOX_PLUS_MULTI) - target_compile_definitions(bb02p-bl-multi-development.elf PRIVATE PRODUCT_BITBOX_PLUS_MULTI BOOTLOADER_DEVDEVICE) - target_compile_definitions(bb02p-bl-multi-development-locked.elf PRIVATE PRODUCT_BITBOX_PLUS_MULTI BOOTLOADER_DEVDEVICE BOOTLOADER_PRODUCTION) + target_compile_definitions(bb02p-bl-multi.elf PRIVATE PRODUCT_BITBOX_NOVA_MULTI) + target_compile_definitions(bb02p-bl-multi-development.elf PRIVATE PRODUCT_BITBOX_NOVA_MULTI BOOTLOADER_DEVDEVICE) + target_compile_definitions(bb02p-bl-multi-development-locked.elf PRIVATE PRODUCT_BITBOX_NOVA_MULTI BOOTLOADER_DEVDEVICE BOOTLOADER_PRODUCTION) set_property(TARGET bb02p-bl-multi-development-locked.elf PROPERTY EXCLUDE_FROM_ALL ON) - target_compile_definitions(bb02p-bl-multi-production.elf PRIVATE PRODUCT_BITBOX_PLUS_MULTI BOOTLOADER_PRODUCTION) + target_compile_definitions(bb02p-bl-multi-production.elf PRIVATE PRODUCT_BITBOX_NOVA_MULTI BOOTLOADER_PRODUCTION) set_property(TARGET bb02p-bl-multi-production.elf PROPERTY EXCLUDE_FROM_ALL ON) - target_compile_definitions(bb02p-bl-btconly.elf PRIVATE PRODUCT_BITBOX_PLUS_BTCONLY) - target_compile_definitions(bb02p-bl-btconly-development.elf PRIVATE PRODUCT_BITBOX_PLUS_BTCONLY BOOTLOADER_DEVDEVICE) - target_compile_definitions(bb02p-bl-btconly-production.elf PRIVATE PRODUCT_BITBOX_PLUS_BTCONLY BOOTLOADER_PRODUCTION) + target_compile_definitions(bb02p-bl-btconly.elf PRIVATE PRODUCT_BITBOX_NOVA_BTCONLY) + target_compile_definitions(bb02p-bl-btconly-development.elf PRIVATE PRODUCT_BITBOX_NOVA_BTCONLY BOOTLOADER_DEVDEVICE) + target_compile_definitions(bb02p-bl-btconly-production.elf PRIVATE PRODUCT_BITBOX_NOVA_BTCONLY BOOTLOADER_PRODUCTION) set_property(TARGET bb02p-bl-btconly-production.elf PROPERTY EXCLUDE_FROM_ALL ON) foreach(firmware ${FIRMWARES}) diff --git a/src/bootloader/bootloader.c b/src/bootloader/bootloader.c index 3ebbd7b348..50997610a4 100644 --- a/src/bootloader/bootloader.c +++ b/src/bootloader/bootloader.c @@ -26,12 +26,12 @@ #include #include -#if defined(BOOTLOADER_DEVDEVICE) || PLATFORM_BITBOX02PLUS == 1 +#if defined(BOOTLOADER_DEVDEVICE) || PLATFORM_BITBOX02NOVA == 1 #include #include #endif -#if PLATFORM_BITBOX02PLUS == 1 +#if PLATFORM_BITBOX02NOVA == 1 #include #include #include @@ -133,7 +133,7 @@ static const uint8_t _empty_bare_flash_hash[SHA256_DIGEST_LENGTH] = { #error "FLASH_APP_LEN changed; recompute _empty_bare_flash_hash" #endif -#if PLATFORM_BITBOX02PLUS == 1 +#if PLATFORM_BITBOX02NOVA == 1 extern struct RustByteQueue* uart_write_queue; #endif @@ -180,7 +180,7 @@ static const uint8_t _root_pubkeys[BOOT_NUM_ROOT_SIGNING_KEYS][BOOT_PUBKEY_LEN] 0xf0, 0xca, 0xde, 0x45, 0xd6, 0x1c, 0x51, 0x4d, 0x86, 0x09, 0xfc, 0xa7, 0x64, 0x1c, 0x9e, 0xe2, } }; -#elif PRODUCT_BITBOX_PLUS_BTCONLY == 1 +#elif PRODUCT_BITBOX_NOVA_BTCONLY == 1 static const uint8_t _root_pubkeys[BOOT_NUM_ROOT_SIGNING_KEYS][BOOT_PUBKEY_LEN] = { // order is important { 0x42, 0xeb, 0x2f, 0xfa, 0x68, 0xd8, 0xc4, 0x62, 0x5a, 0x01, 0x2b, 0x46, 0x7f, 0x04, 0x4a, 0xfc, @@ -201,7 +201,7 @@ static const uint8_t _root_pubkeys[BOOT_NUM_ROOT_SIGNING_KEYS][BOOT_PUBKEY_LEN] 0x1d, 0xc3, 0xd6, 0x6b, 0xc5, 0x51, 0x54, 0x67, 0xba, 0xb1, 0xc1, 0xcb, 0x24, 0x48, 0xa8, 0x7a, } }; -#elif PRODUCT_BITBOX_PLUS_MULTI == 1 +#elif PRODUCT_BITBOX_NOVA_MULTI == 1 static const uint8_t _root_pubkeys[BOOT_NUM_ROOT_SIGNING_KEYS][BOOT_PUBKEY_LEN] = { // order is important { 0x5e, 0x1b, 0x09, 0x1c, 0x8f, 0x71, 0x15, 0xaf, 0xd3, 0x3c, 0x0b, 0x72, 0xe4, 0x4b, 0x3e, 0xd0, @@ -324,7 +324,7 @@ void bootloader_render_default_screen(void) { UG_ClearBuffer(); _load_logo(); -#if PLATFORM_BITBOX02PLUS == 1 +#if PLATFORM_BITBOX02NOVA == 1 UG_PutString(0, SCREEN_HEIGHT - 9 * 2 - 5, "See the BitBoxApp"); if (rust_communication_mode_ble_enabled() && da14531_connected_state < DA14531_CONNECTED_CONNECTED_SECURED) { @@ -343,7 +343,7 @@ void bootloader_render_default_screen(void) UG_SendBuffer(); } -#if PLATFORM_BITBOX02PLUS +#if PLATFORM_BITBOX02NOVA extern bool bootloader_pairing_request; extern uint8_t bootloader_pairing_code_bytes[4]; @@ -878,7 +878,7 @@ static size_t _api_command(const uint8_t* input, uint8_t* output, const size_t m break; case OP_REBOOT: { -#if PLATFORM_BITBOX02PLUS == 1 +#if PLATFORM_BITBOX02NOVA == 1 rust_da14531_set_product(rust_util_bytes(NULL, 0), uart_write_queue); // Send it now, because we are about to reset ourselves while (rust_bytequeue_num(uart_write_queue)) { @@ -1003,7 +1003,7 @@ static bool _devdevice_enter(secbool_u32 firmware_verified) } else { UG_PutString(0, SCREEN_HEIGHT - 9, " No firmware found"); } - #if PLATFORM_BITBOX02PLUS == 1 + #if PLATFORM_BITBOX02NOVA == 1 struct da14531_firmware_version version; bool res = memory_spi_get_active_ble_firmware_version(&version); if (res) { diff --git a/src/bootloader/bootloader.h b/src/bootloader/bootloader.h index d633ca9aa8..a5319f2d4a 100644 --- a/src/bootloader/bootloader.h +++ b/src/bootloader/bootloader.h @@ -13,7 +13,7 @@ void bootloader_jump(void); */ void bootloader_render_default_screen(void); -#if PLATFORM_BITBOX02PLUS +#if PLATFORM_BITBOX02NOVA /** * Renders a BLE pairing confirmations screen. Use the `confirmed` argument to display the * "user has confirmed on bitbox" version. diff --git a/src/bootloader/startup.c b/src/bootloader/startup.c index 7b306d43eb..efc556bff0 100644 --- a/src/bootloader/startup.c +++ b/src/bootloader/startup.c @@ -14,11 +14,11 @@ #include #include -#if defined(BOOTLOADER_DEVDEVICE) || PLATFORM_BITBOX02PLUS == 1 +#if defined(BOOTLOADER_DEVDEVICE) || PLATFORM_BITBOX02NOVA == 1 #include #endif -#if PLATFORM_BITBOX02PLUS == 1 +#if PLATFORM_BITBOX02NOVA == 1 #include #include #include @@ -26,14 +26,14 @@ #include #include - #if PRODUCT_BITBOX_PLUS_MULTI == 1 + #if PRODUCT_BITBOX_NOVA_MULTI == 1 #define DEVICE_MODE "{\"p\":\"bb02p-bl-multi\",\"v\":\"" BOOTLOADER_VERSION "\"}" - #elif PRODUCT_BITBOX_PLUS_BTCONLY == 1 + #elif PRODUCT_BITBOX_NOVA_BTCONLY == 1 #define DEVICE_MODE "{\"p\":\"bb02p-bl-btconly\",\"v\":\"" BOOTLOADER_VERSION "\"}" #else #error "unknown product" #endif -#endif // PLATFORM_BITBOX02PLUS == 1 +#endif // PLATFORM_BITBOX02NOVA == 1 extern void __attribute__((noreturn)) __stack_chk_fail(void); void __attribute__((noreturn)) __stack_chk_fail(void) @@ -45,7 +45,7 @@ void __attribute__((noreturn)) __stack_chk_fail(void) uint32_t __stack_chk_guard = 0; -#if PLATFORM_BITBOX02PLUS == 1 +#if PLATFORM_BITBOX02NOVA == 1 extern volatile bool measurement_done_touch; int bootloader_pairing_request = false; uint8_t bootloader_pairing_code_bytes[4] = {0}; @@ -69,7 +69,7 @@ int main(void) platform_init(); __stack_chk_guard = rand_sync_read32(&RAND_0); screen_init(oled_set_pixel, oled_mirror, oled_clear_buffer); -#if defined(BOOTLOADER_DEVDEVICE) || PLATFORM_BITBOX02PLUS == 1 +#if defined(BOOTLOADER_DEVDEVICE) || PLATFORM_BITBOX02NOVA == 1 qtouch_init(); #endif bootloader_jump(); @@ -79,7 +79,7 @@ int main(void) uint8_t hww_data_buf[USB_REPORT_SIZE] = {0}; USB_FRAME hww_frame = {0}; -#if PLATFORM_BITBOX02PLUS == 1 +#if PLATFORM_BITBOX02NOVA == 1 uint8_t uart_read_buf[USART_0_BUFFER_SIZE] = {0}; uint16_t uart_read_buf_len = 0; @@ -117,7 +117,7 @@ int main(void) while (1) { // Do UART I/O -#if PLATFORM_BITBOX02PLUS == 1 +#if PLATFORM_BITBOX02NOVA == 1 if (rust_communication_mode_ble_enabled()) { if (uart_read_buf_len < sizeof(uart_read_buf) || rust_bytequeue_num(uart_write_queue) > 0) { @@ -134,7 +134,7 @@ int main(void) } if (!hww_data && hid_hww_read((uint8_t*)&hww_frame)) { usb_packet_process(&hww_frame); -#if PLATFORM_BITBOX02PLUS == 1 +#if PLATFORM_BITBOX02NOVA == 1 if (rust_communication_mode_ble_enabled()) { // Enqueue a power down command to the da14531 rust_da14531_power_down(uart_write_queue); @@ -147,7 +147,7 @@ int main(void) } #endif } -#if PLATFORM_BITBOX02PLUS == 1 +#if PLATFORM_BITBOX02NOVA == 1 if (rust_communication_mode_ble_enabled()) { struct da14531_protocol_frame* frame = da14531_protocol_poll( &uart_read_buf[0], &uart_read_buf_len, &hww_data, uart_write_queue); @@ -159,7 +159,7 @@ int main(void) } #endif -#if PLATFORM_BITBOX02PLUS == 1 +#if PLATFORM_BITBOX02NOVA == 1 if (!rust_communication_mode_ble_enabled()) { #endif if (hww_data) { @@ -167,12 +167,12 @@ int main(void) hww_data = NULL; } } -#if PLATFORM_BITBOX02PLUS == 1 +#if PLATFORM_BITBOX02NOVA == 1 } #endif usb_processing_process(usb_processing_hww()); -#if PLATFORM_BITBOX02PLUS == 1 +#if PLATFORM_BITBOX02NOVA == 1 qtouch_process(); if (bootloader_pairing_request) { if (!measurement_done_touch) { diff --git a/src/factorysetup.c b/src/factorysetup.c index be591eb6f5..ae79556eeb 100644 --- a/src/factorysetup.c +++ b/src/factorysetup.c @@ -1002,7 +1002,7 @@ static void _api_msg(const uint8_t* input, size_t in_len, uint8_t* output, size_ _reset_mcu(); break; case OP_BLE_RESULT: - if (memory_get_platform() == MEMORY_PLATFORM_BITBOX02_PLUS) { + if (memory_get_platform() == MEMORY_PLATFORM_BITBOX02_NOVA) { output[2] = _ble_result; out_len++; } else { @@ -1172,7 +1172,7 @@ int main(void) } } - if (memory_get_platform() == MEMORY_PLATFORM_BITBOX02_PLUS) { + if (memory_get_platform() == MEMORY_PLATFORM_BITBOX02_NOVA) { _ble_result = _setup_ble(); } diff --git a/src/firmware.c b/src/firmware.c index 3d251d0825..71557871fb 100644 --- a/src/firmware.c +++ b/src/firmware.c @@ -36,7 +36,7 @@ int main(void) qtouch_init(); common_main(); bitbox02_smarteeprom_init(); - if (memory_get_platform() == MEMORY_PLATFORM_BITBOX02_PLUS) { + if (memory_get_platform() == MEMORY_PLATFORM_BITBOX02_NOVA) { da14531_protocol_init(); } rust_main_loop(); diff --git a/src/hww.c b/src/hww.c index c85046c928..650d127375 100644 --- a/src/hww.c +++ b/src/hww.c @@ -48,9 +48,9 @@ typedef struct { * 1 byte: platform code: * - 0x00 - BitBox02 * - 0x01 - BitBoxBase (deprecated) - * - 0x02 - BitBox02Plus + * - 0x02 - BitBox02Nova * 1 byte: edition code: - * - For the BitBox02 and BitBox02Plus edition: + * - For the BitBox02 and BitBox02Nova edition: * - - 0x00 - Multi * - - 0x01 - Bitcoin-only * - For the BitBoxBase platform (deprecated): @@ -75,7 +75,7 @@ static size_t _api_info(uint8_t* buf) // 1 byte platform code switch (memory_get_platform()) { - case MEMORY_PLATFORM_BITBOX02_PLUS: + case MEMORY_PLATFORM_BITBOX02_NOVA: *current = 0x02; break; default: diff --git a/src/memory/memory.c b/src/memory/memory.c index da4ddb7f8a..4ffa9e613e 100644 --- a/src/memory/memory.c +++ b/src/memory/memory.c @@ -263,7 +263,7 @@ void memory_get_device_name(char* name_out) _read_chunk(CHUNK_1, chunk_bytes); if (chunk.fields.device_name[0] == 0xFF || !rust_util_is_name_valid(chunk.fields.device_name, MEMORY_DEVICE_MAX_LEN_WITH_NULL)) { - if (memory_get_platform() == MEMORY_PLATFORM_BITBOX02_PLUS) { + if (memory_get_platform() == MEMORY_PLATFORM_BITBOX02_NOVA) { // For Bluetooth, we want to use an unambiguous default name so this BitBox can be // identified if multiple BitBoxes are advertising at the same time. memory_random_name(name_out); @@ -383,7 +383,7 @@ bool memory_reset_hww(void) bool res = _write_chunk(CHUNK_1, chunk.bytes); // Reset bond-db and reinitialize IRK and identity address - if (memory_get_platform() == MEMORY_PLATFORM_BITBOX02_PLUS) { + if (memory_get_platform() == MEMORY_PLATFORM_BITBOX02_NOVA) { uint8_t random_bytes[32]; _interface_functions->random_32_bytes(&random_bytes[0]); chunk_shared_t chunk_shared = {0}; diff --git a/src/memory/memory_shared.c b/src/memory/memory_shared.c index cc92c08b69..2b0f055ddf 100644 --- a/src/memory/memory_shared.c +++ b/src/memory/memory_shared.c @@ -132,7 +132,7 @@ uint8_t memory_get_platform(void) uint8_t platform = chunk.fields.platform; util_zero(&chunk, sizeof(chunk)); switch (platform) { - case MEMORY_PLATFORM_BITBOX02_PLUS: + case MEMORY_PLATFORM_BITBOX02_NOVA: return platform; default: return MEMORY_PLATFORM_BITBOX02; diff --git a/src/memory/memory_shared.h b/src/memory/memory_shared.h index 14dbd3fb37..a3c628d92d 100644 --- a/src/memory/memory_shared.h +++ b/src/memory/memory_shared.h @@ -127,7 +127,7 @@ USE_RESULT uint8_t memory_get_screen_type(void); USE_RESULT uint8_t memory_get_securechip_type(void); #define MEMORY_PLATFORM_BITBOX02 0xFF -#define MEMORY_PLATFORM_BITBOX02_PLUS 0x01 +#define MEMORY_PLATFORM_BITBOX02_NOVA 0x01 USE_RESULT uint8_t memory_get_platform(void); // data must be at least MEMORY_BLE_BOND_DB_LEN long diff --git a/src/platform/driver_init.c b/src/platform/driver_init.c index b7af34a83e..89c495895a 100644 --- a/src/platform/driver_init.c +++ b/src/platform/driver_init.c @@ -368,7 +368,7 @@ void system_init(void) // USB _usb_init(); - if (memory_get_platform() == MEMORY_PLATFORM_BITBOX02_PLUS) { + if (memory_get_platform() == MEMORY_PLATFORM_BITBOX02_NOVA) { // External MX25 flash memory _spi_mem_init(); // DA14531 @@ -383,7 +383,7 @@ void bootloader_init(void) _oled_set_pins(); _ptc_clock_init(); -#if defined(BOOTLOADER_DEVDEVICE) || PLATFORM_BITBOX02PLUS == 1 +#if defined(BOOTLOADER_DEVDEVICE) || PLATFORM_BITBOX02NOVA == 1 // Only needed for qtouch, which is only needed in the devdevice bootloader. _timer_peripheral_init(); #endif @@ -401,7 +401,7 @@ void bootloader_init(void) // USB _usb_init(); - if (memory_get_platform() == MEMORY_PLATFORM_BITBOX02_PLUS) { + if (memory_get_platform() == MEMORY_PLATFORM_BITBOX02_NOVA) { // External MX25 flash memory _spi_mem_init(); // DA14531 diff --git a/src/platform/platform_config.h b/src/platform/platform_config.h index b3de453106..40e025ba1d 100644 --- a/src/platform/platform_config.h +++ b/src/platform/platform_config.h @@ -17,15 +17,15 @@ #error "invalid product value" #endif -#if !defined(PRODUCT_BITBOX_PLUS_MULTI) - #define PRODUCT_BITBOX_PLUS_MULTI 0 -#elif PRODUCT_BITBOX_PLUS_MULTI != 1 +#if !defined(PRODUCT_BITBOX_NOVA_MULTI) + #define PRODUCT_BITBOX_NOVA_MULTI 0 +#elif PRODUCT_BITBOX_NOVA_MULTI != 1 #error "invalid product value" #endif -#if !defined(PRODUCT_BITBOX_PLUS_BTCONLY) - #define PRODUCT_BITBOX_PLUS_BTCONLY 0 -#elif PRODUCT_BITBOX_PLUS_BTCONLY != 1 +#if !defined(PRODUCT_BITBOX_NOVA_BTCONLY) + #define PRODUCT_BITBOX_NOVA_BTCONLY 0 +#elif PRODUCT_BITBOX_NOVA_BTCONLY != 1 #error "invalid product value" #endif @@ -38,31 +38,31 @@ // Derive other useful definitions from the product. #if PRODUCT_BITBOX_MULTI == 1 - #define PLATFORM_BITBOX02PLUS 0 + #define PLATFORM_BITBOX02NOVA 0 #define PLATFORM_BITBOX02 1 #define FACTORYSETUP 0 #endif #if PRODUCT_BITBOX_BTCONLY == 1 - #define PLATFORM_BITBOX02PLUS 0 + #define PLATFORM_BITBOX02NOVA 0 #define PLATFORM_BITBOX02 1 #define FACTORYSETUP 0 #endif -#if PRODUCT_BITBOX_PLUS_MULTI == 1 - #define PLATFORM_BITBOX02PLUS 1 +#if PRODUCT_BITBOX_NOVA_MULTI == 1 + #define PLATFORM_BITBOX02NOVA 1 #define PLATFORM_BITBOX02 0 #define FACTORYSETUP 0 #endif -#if PRODUCT_BITBOX_PLUS_BTCONLY == 1 - #define PLATFORM_BITBOX02PLUS 1 +#if PRODUCT_BITBOX_NOVA_BTCONLY == 1 + #define PLATFORM_BITBOX02NOVA 1 #define PLATFORM_BITBOX02 0 #define FACTORYSETUP 0 #endif #if PRODUCT_BITBOX02_FACTORYSETUP == 1 - #define PLATFORM_BITBOX02PLUS 0 + #define PLATFORM_BITBOX02NOVA 0 #define PLATFORM_BITBOX02 1 #define FACTORYSETUP 1 #endif diff --git a/src/platform/platform_init.c b/src/platform/platform_init.c index f1aeafcf8f..08ee781170 100644 --- a/src/platform/platform_init.c +++ b/src/platform/platform_init.c @@ -28,7 +28,7 @@ void platform_init(void) { oled_init(); #if !(defined(BOOTLOADER) && PLATFORM_BITBOX02 == 1) - if (memory_get_platform() == MEMORY_PLATFORM_BITBOX02_PLUS) { + if (memory_get_platform() == MEMORY_PLATFORM_BITBOX02_NOVA) { uart_init(); } #endif @@ -38,23 +38,23 @@ void platform_init(void) #if !defined(BOOTLOADER) sd_mmc_start(); #endif - if (memory_get_platform() == MEMORY_PLATFORM_BITBOX02_PLUS) { + if (memory_get_platform() == MEMORY_PLATFORM_BITBOX02_NOVA) { spi_mem_protected_area_lock(); } } -#if !(defined(BOOTLOADER) && PLATFORM_BITBOX02PLUS == 0) +#if !(defined(BOOTLOADER) && PLATFORM_BITBOX02NOVA == 0) #if defined(BOOTLOADER) - #if PRODUCT_BITBOX_PLUS_MULTI == 1 + #if PRODUCT_BITBOX_NOVA_MULTI == 1 #define DEVICE_MODE "{\"p\":\"bb02p-bl-multi\",\"v\":\"" BOOTLOADER_VERSION "\"}" - #elif PRODUCT_BITBOX_PLUS_BTCONLY == 1 + #elif PRODUCT_BITBOX_NOVA_BTCONLY == 1 #define DEVICE_MODE "{\"p\":\"bb02p-bl-btconly\",\"v\":\"" BOOTLOADER_VERSION "\"}" #else #error "unknown product" #endif #else - // Currently we have one firmware for both BB02 and BB02_PLUS, and only the - // PRODUCT_BITBOX_MULTI/BTCONLY definitions apply. The PRODUCT_BITBOX_PLUS_MULTI/BTCONLY + // Currently we have one firmware for both BB02 and BB02_NOVA, and only the + // PRODUCT_BITBOX_MULTI/BTCONLY definitions apply. The PRODUCT_BITBOX_NOVA_MULTI/BTCONLY // defs currently only apply in the bootloader, which we don't need here. #if PRODUCT_BITBOX_MULTI == 1 #define PRODUCT_STRING_SUFFIX "multi" diff --git a/src/platform/platform_init.h b/src/platform/platform_init.h index 7fdfdb5bd5..9eee925e37 100644 --- a/src/platform/platform_init.h +++ b/src/platform/platform_init.h @@ -6,7 +6,7 @@ #include void platform_init(void); -#if !(defined(BOOTLOADER) && PLATFORM_BITBOX02PLUS == 0) +#if !(defined(BOOTLOADER) && PLATFORM_BITBOX02NOVA == 0) // Returns a json string representing the firmware type and version const char* platform_product(size_t* len); #endif diff --git a/src/rust/bitbox-hal/src/memory.rs b/src/rust/bitbox-hal/src/memory.rs index e66ee6fedd..9f4d7142a3 100644 --- a/src/rust/bitbox-hal/src/memory.rs +++ b/src/rust/bitbox-hal/src/memory.rs @@ -32,7 +32,7 @@ pub enum SecurechipType { #[derive(Copy, Clone, Debug, Eq, PartialEq)] pub enum Platform { BitBox02, - BitBox02Plus, + BitBox02Nova, BitBox03, } diff --git a/src/rust/bitbox02-rust-c/Cargo.toml b/src/rust/bitbox02-rust-c/Cargo.toml index 16491f7863..b9cbe4d61a 100644 --- a/src/rust/bitbox02-rust-c/Cargo.toml +++ b/src/rust/bitbox02-rust-c/Cargo.toml @@ -37,13 +37,13 @@ target-bb02-bl-multi-production = ["bootloader", "platform-bitbox02"] target-bb02-bl-btconly = ["bootloader", "platform-bitbox02"] target-bb02-bl-btconly-development = ["bootloader", "platform-bitbox02"] target-bb02-bl-btconly-production = ["bootloader", "platform-bitbox02"] -target-bb02p-bl-multi = ["bootloader", "platform-bitbox02plus"] -target-bb02p-bl-multi-development = ["bootloader", "platform-bitbox02plus"] -target-bb02p-bl-multi-development-locked = ["bootloader", "platform-bitbox02plus"] -target-bb02p-bl-multi-production = ["bootloader", "platform-bitbox02plus"] -target-bb02p-bl-btconly = ["bootloader", "platform-bitbox02plus"] -target-bb02p-bl-btconly-development = ["bootloader", "platform-bitbox02plus"] -target-bb02p-bl-btconly-production = ["bootloader", "platform-bitbox02plus"] +target-bb02p-bl-multi = ["bootloader", "platform-bitbox02nova"] +target-bb02p-bl-multi-development = ["bootloader", "platform-bitbox02nova"] +target-bb02p-bl-multi-development-locked = ["bootloader", "platform-bitbox02nova"] +target-bb02p-bl-multi-production = ["bootloader", "platform-bitbox02nova"] +target-bb02p-bl-btconly = ["bootloader", "platform-bitbox02nova"] +target-bb02p-bl-btconly-development = ["bootloader", "platform-bitbox02nova"] +target-bb02p-bl-btconly-production = ["bootloader", "platform-bitbox02nova"] target-firmware = ["firmware", "platform-bitbox02", "app-bitcoin", "app-litecoin", "app-ethereum", "app-u2f", "app-cardano"] target-firmware-btc = ["firmware", "platform-bitbox02", "app-bitcoin"] target-factory-setup = [ @@ -65,7 +65,7 @@ target-c-unit-tests = [ ] platform-bitbox02 = [] -platform-bitbox02plus = ["util/sha2", "bitbox-noise", "bitbox02-rust"] +platform-bitbox02nova = ["util/sha2", "bitbox-noise", "bitbox02-rust"] bootloader = [] firmware = [ diff --git a/src/rust/bitbox02-rust-c/src/lib.rs b/src/rust/bitbox02-rust-c/src/lib.rs index 88aebbd10c..9a4a728998 100644 --- a/src/rust/bitbox02-rust-c/src/lib.rs +++ b/src/rust/bitbox02-rust-c/src/lib.rs @@ -14,7 +14,7 @@ extern crate alloc; pub mod async_usb; #[cfg(any( feature = "firmware", - all(feature = "bootloader", feature = "platform-bitbox02plus") + all(feature = "bootloader", feature = "platform-bitbox02nova") ))] mod communication_mode; #[cfg(feature = "firmware")] @@ -40,7 +40,7 @@ extern crate bitbox_aes; // Enable for firmware and for Nova bootloader (BitBox02 bootloader currently does not need it). #[cfg(any( feature = "firmware", - all(feature = "bootloader", feature = "platform-bitbox02plus") + all(feature = "bootloader", feature = "platform-bitbox02nova") ))] extern crate bitbox02_rust; @@ -61,7 +61,7 @@ extern crate util; #[allow(unused)] #[cfg(any( feature = "firmware", - all(feature = "bootloader", feature = "platform-bitbox02plus") + all(feature = "bootloader", feature = "platform-bitbox02nova") ))] type HalImpl = bitbox02::hal::BitBox02Hal; diff --git a/src/rust/bitbox02-rust/src/communication_mode.rs b/src/rust/bitbox02-rust/src/communication_mode.rs index 48367f8083..6859a49c56 100644 --- a/src/rust/bitbox02-rust/src/communication_mode.rs +++ b/src/rust/bitbox02-rust/src/communication_mode.rs @@ -28,7 +28,7 @@ fn has_ble(hal: &mut impl crate::hal::Hal) -> bool { let has_ble = matches!( hal.memory().get_platform(), - Ok(memory::Platform::BitBox02Plus), + Ok(memory::Platform::BitBox02Nova), ); HAS_BLE.write(Some(has_ble)); has_ble @@ -46,7 +46,7 @@ mod tests { } #[test] - fn test_ble_disabled_on_non_plus() { + fn test_ble_disabled_on_non_nova() { reset_for_testing(); let mut hal = TestingHal::new(); hal.memory.set_platform(memory::Platform::BitBox02); @@ -61,7 +61,7 @@ mod tests { fn test_ble_enabled_until_usb_request_seen() { reset_for_testing(); let mut hal = TestingHal::new(); - hal.memory.set_platform(memory::Platform::BitBox02Plus); + hal.memory.set_platform(memory::Platform::BitBox02Nova); assert!(ble_enabled(&mut hal)); diff --git a/src/rust/bitbox02-rust/src/hww/api/bluetooth.rs b/src/rust/bitbox02-rust/src/hww/api/bluetooth.rs index 4c55f7daf3..ca57c7ef7c 100644 --- a/src/rust/bitbox02-rust/src/hww/api/bluetooth.rs +++ b/src/rust/bitbox02-rust/src/hww/api/bluetooth.rs @@ -206,7 +206,7 @@ pub async fn process_api( ) -> Result { if !matches!( hal.memory().get_platform().map_err(|_| Error::Memory)?, - hal_memory::Platform::BitBox02Plus + hal_memory::Platform::BitBox02Nova ) { return Err(Error::Disabled); } diff --git a/src/rust/bitbox02-rust/src/hww/api/device_info.rs b/src/rust/bitbox02-rust/src/hww/api/device_info.rs index 7252821a1b..7cce54fb7b 100644 --- a/src/rust/bitbox02-rust/src/hww/api/device_info.rs +++ b/src/rust/bitbox02-rust/src/hww/api/device_info.rs @@ -8,7 +8,7 @@ use pb::response::Response; pub async fn process(hal: &mut impl crate::hal::Hal) -> Result { let bluetooth = match hal.memory().get_platform().map_err(|_| Error::Memory)? { - hal_memory::Platform::BitBox02Plus | hal_memory::Platform::BitBox03 => { + hal_memory::Platform::BitBox02Nova | hal_memory::Platform::BitBox03 => { let ble_metadata = hal.memory().ble_get_metadata(); Some(pb::device_info_response::Bluetooth { firmware_hash: ble_metadata.allowed_firmware_hash.to_vec(), diff --git a/src/rust/bitbox02-rust/src/hww/transport.rs b/src/rust/bitbox02-rust/src/hww/transport.rs index b6822b07d7..fe51250126 100644 --- a/src/rust/bitbox02-rust/src/hww/transport.rs +++ b/src/rust/bitbox02-rust/src/hww/transport.rs @@ -33,7 +33,7 @@ fn info_response(hal: &mut H) -> Vec { response.push(version.len() as u8); response.extend_from_slice(version); response.push(match hal.memory().get_platform() { - Ok(crate::hal::memory::Platform::BitBox02Plus) => 0x02, + Ok(crate::hal::memory::Platform::BitBox02Nova) => 0x02, Ok(crate::hal::memory::Platform::BitBox03) => 0x03, _ => 0x00, }); @@ -218,7 +218,7 @@ mod tests { fn test_req_info() { let _guard = test_guard(); let mut handler = handler(); - handler.hal.memory.set_platform(Platform::BitBox02Plus); + handler.hal.memory.set_platform(Platform::BitBox02Nova); handler.hal.system.set_btconly(true); handler.hal.memory.set_initialized().unwrap(); let response = handler diff --git a/src/rust/bitbox02-rust/src/main_loop.rs b/src/rust/bitbox02-rust/src/main_loop.rs index c2d7ff13b5..f01b8d8b80 100644 --- a/src/rust/bitbox02-rust/src/main_loop.rs +++ b/src/rust/bitbox02-rust/src/main_loop.rs @@ -170,7 +170,7 @@ pub fn main_loop(hal: &mut H) -> ! { if STARTUP_COMPLETE.swap(false, Ordering::Relaxed) { // hww handler in usb_process must be setup before we can allow ble connections - if let Ok(crate::hal::memory::Platform::BitBox02Plus) = hal.memory().get_platform() { + if let Ok(crate::hal::memory::Platform::BitBox02Nova) = hal.memory().get_platform() { let product = bitbox02::platform::product(); bitbox02::da14531_handler::set_product(product); bitbox_da14531::set_product(product, &mut uart_write_queue) diff --git a/src/rust/bitbox02-rust/src/reset.rs b/src/rust/bitbox02-rust/src/reset.rs index 0746034d1d..a41ed6e84a 100644 --- a/src/rust/bitbox02-rust/src/reset.rs +++ b/src/rust/bitbox02-rust/src/reset.rs @@ -66,7 +66,7 @@ pub(crate) async fn reset(hal: &mut impl crate::hal::Hal, status: bool) { // The ble chip needs to be restarted to load the new secrets. if matches!( hal.memory().get_platform(), - Ok(memory::Platform::BitBox02Plus) + Ok(memory::Platform::BitBox02Nova) ) { hal.system().reset_ble(); } diff --git a/src/rust/bitbox02-sys/build.rs b/src/rust/bitbox02-sys/build.rs index c74fc6871e..84a798ea8f 100644 --- a/src/rust/bitbox02-sys/build.rs +++ b/src/rust/bitbox02-sys/build.rs @@ -22,7 +22,7 @@ const ALLOWLIST_VARS: &[&str] = &[ "MAX_PK_SCRIPT_SIZE", "MAX_VARINT_SIZE", "MEMORY_MULTISIG_NUM_ENTRIES", - "MEMORY_PLATFORM_BITBOX02_PLUS", + "MEMORY_PLATFORM_BITBOX02_NOVA", "MEMORY_PLATFORM_BITBOX02", "MEMORY_SECURECHIP_TYPE_ATECC", "MEMORY_SECURECHIP_TYPE_OPTIGA", diff --git a/src/rust/bitbox02/src/hal/memory.rs b/src/rust/bitbox02/src/hal/memory.rs index 145aef6b44..3b088e0262 100644 --- a/src/rust/bitbox02/src/hal/memory.rs +++ b/src/rust/bitbox02/src/hal/memory.rs @@ -21,7 +21,7 @@ fn to_hal_securechip_type(securechip_type: crate::memory::SecurechipType) -> Sec fn to_hal_platform(platform: crate::memory::Platform) -> Platform { match platform { crate::memory::Platform::BitBox02 => Platform::BitBox02, - crate::memory::Platform::BitBox02Plus => Platform::BitBox02Plus, + crate::memory::Platform::BitBox02Nova => Platform::BitBox02Nova, } } @@ -284,8 +284,8 @@ mod tests { Platform::BitBox02, ); assert_eq!( - to_hal_platform(crate::memory::Platform::BitBox02Plus), - Platform::BitBox02Plus, + to_hal_platform(crate::memory::Platform::BitBox02Nova), + Platform::BitBox02Nova, ); } diff --git a/src/rust/bitbox02/src/memory.rs b/src/rust/bitbox02/src/memory.rs index 415eea867d..ce5b3b9f32 100644 --- a/src/rust/bitbox02/src/memory.rs +++ b/src/rust/bitbox02/src/memory.rs @@ -198,13 +198,13 @@ pub fn multisig_get_by_hash(hash: &[u8]) -> Option { #[derive(Clone, Copy)] pub enum Platform { BitBox02, - BitBox02Plus, + BitBox02Nova, } pub fn get_platform() -> Result { match unsafe { bitbox02_sys::memory_get_platform() as u32 } { bitbox02_sys::MEMORY_PLATFORM_BITBOX02 => Ok(Platform::BitBox02), - bitbox02_sys::MEMORY_PLATFORM_BITBOX02_PLUS => Ok(Platform::BitBox02Plus), + bitbox02_sys::MEMORY_PLATFORM_BITBOX02_NOVA => Ok(Platform::BitBox02Nova), _ => Err(()), } } diff --git a/src/system.c b/src/system.c index d0f611954a..e2e7725add 100644 --- a/src/system.c +++ b/src/system.c @@ -30,7 +30,7 @@ static void _ble_clear_product(void) void reboot_to_bootloader(void) { - if (memory_get_platform() == MEMORY_PLATFORM_BITBOX02_PLUS) { + if (memory_get_platform() == MEMORY_PLATFORM_BITBOX02_NOVA) { _ble_clear_product(); } auto_enter_t auto_enter = { @@ -50,7 +50,7 @@ void reboot_to_bootloader(void) void reboot(void) { - if (memory_get_platform() == MEMORY_PLATFORM_BITBOX02_PLUS) { + if (memory_get_platform() == MEMORY_PLATFORM_BITBOX02_NOVA) { _ble_clear_product(); } #ifndef TESTING diff --git a/src/ui/components/ui_images.c b/src/ui/components/ui_images.c index 64fe0cc2ef..3a305f8e0d 100644 --- a/src/ui/components/ui_images.c +++ b/src/ui/components/ui_images.c @@ -116,9 +116,9 @@ void image_sdcard(bool mirror) // Logo images: // In the bootloader we hardcode by target. We currently have one firmware for both BB02 and -// BB02-Plus, so we include both in the firmware. +// BB02 Nova, so we include both in the firmware. -#if (PRODUCT_BITBOX_BTCONLY == 1) || (PRODUCT_BITBOX_PLUS_BTCONLY == 1) +#if (PRODUCT_BITBOX_BTCONLY == 1) || (PRODUCT_BITBOX_NOVA_BTCONLY == 1) #if !defined(BOOTLOADER) || (PRODUCT_BITBOX_BTCONLY == 1) #define IMAGE_BITBOX02_LOGO_W 79 @@ -142,10 +142,10 @@ const uint8_t IMAGE_BITBOX02_LOGO[] = { 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00}; #endif - #if !defined(BOOTLOADER) || (PRODUCT_BITBOX_PLUS_BTCONLY == 1) - #define IMAGE_BITBOX02_PLUS_LOGO_W 125 - #define IMAGE_BITBOX02_PLUS_LOGO_H 25 -static const uint8_t IMAGE_BITBOX02_PLUS_LOGO[] = { + #if !defined(BOOTLOADER) || (PRODUCT_BITBOX_NOVA_BTCONLY == 1) + #define IMAGE_BITBOX02_NOVA_LOGO_W 125 + #define IMAGE_BITBOX02_NOVA_LOGO_H 25 +static const uint8_t IMAGE_BITBOX02_NOVA_LOGO[] = { 0xfe, 0x0c, 0x30, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x0c, 0x00, 0x00, 0x00, 0x07, 0xf8, 0x61, 0x83, 0xfc, 0x00, 0x00, 0x00, 0x1e, 0x03, 0xc0, 0xe0, 0x60, 0x00, 0x00, 0x00, 0x30, 0x60, 0x0c, 0x18, 0x30, 0x00, 0x00, 0x01, 0x08, 0x21, 0x07, 0x83, 0x00, 0x00, 0x00, 0x01, 0x83, @@ -174,7 +174,7 @@ static const uint8_t IMAGE_BITBOX02_PLUS_LOGO[] = { }; #endif -#elif (PRODUCT_BITBOX_MULTI == 1) || (PRODUCT_BITBOX_PLUS_MULTI == 1) || \ +#elif (PRODUCT_BITBOX_MULTI == 1) || (PRODUCT_BITBOX_NOVA_MULTI == 1) || \ PRODUCT_BITBOX02_FACTORYSETUP == 1 #if !defined(BOOTLOADER) || (PRODUCT_BITBOX_MULTI == 1) @@ -198,10 +198,10 @@ static const uint8_t IMAGE_BITBOX02_LOGO[] = { 0x00, 0x00, 0x00, 0x00}; #endif - #if !defined(BOOTLOADER) || (PRODUCT_BITBOX_PLUS_MULTI == 1) - #define IMAGE_BITBOX02_PLUS_LOGO_W 125 - #define IMAGE_BITBOX02_PLUS_LOGO_H 23 -static const uint8_t IMAGE_BITBOX02_PLUS_LOGO[] = { + #if !defined(BOOTLOADER) || (PRODUCT_BITBOX_NOVA_MULTI == 1) + #define IMAGE_BITBOX02_NOVA_LOGO_W 125 + #define IMAGE_BITBOX02_NOVA_LOGO_H 23 +static const uint8_t IMAGE_BITBOX02_NOVA_LOGO[] = { 0xfe, 0x0c, 0x30, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x0c, 0x00, 0x00, 0x00, 0x07, 0xf8, 0x61, 0x83, 0xfc, 0x00, 0x00, 0x00, 0x1e, 0x03, 0xc0, 0xe0, 0x60, 0x00, 0x00, 0x00, 0x30, 0x60, 0x0c, 0x18, 0x30, 0x00, 0x00, 0x01, 0x08, 0x21, 0x07, 0x83, 0x00, 0x00, 0x00, 0x01, 0x83, @@ -253,17 +253,17 @@ image_logo_data_t image_logo_data(void) }, }; return result; - #elif (PRODUCT_BITBOX_PLUS_BTCONLY == 1) || (PRODUCT_BITBOX_PLUS_MULTI == 1) + #elif (PRODUCT_BITBOX_NOVA_BTCONLY == 1) || (PRODUCT_BITBOX_NOVA_MULTI == 1) image_logo_data_t result = { .buffer = { - .data = IMAGE_BITBOX02_PLUS_LOGO, - .len = sizeof(IMAGE_BITBOX02_PLUS_LOGO), + .data = IMAGE_BITBOX02_NOVA_LOGO, + .len = sizeof(IMAGE_BITBOX02_NOVA_LOGO), }, .dimensions = { - .width = IMAGE_BITBOX02_PLUS_LOGO_W, - .height = IMAGE_BITBOX02_PLUS_LOGO_H, + .width = IMAGE_BITBOX02_NOVA_LOGO_W, + .height = IMAGE_BITBOX02_NOVA_LOGO_H, }, }; return result; @@ -276,17 +276,17 @@ image_logo_data_t image_logo_data(void) image_logo_data_t image_logo_data(void) { switch (memory_get_platform()) { - case MEMORY_PLATFORM_BITBOX02_PLUS: { + case MEMORY_PLATFORM_BITBOX02_NOVA: { image_logo_data_t result = { .buffer = { - .data = IMAGE_BITBOX02_PLUS_LOGO, - .len = sizeof(IMAGE_BITBOX02_PLUS_LOGO), + .data = IMAGE_BITBOX02_NOVA_LOGO, + .len = sizeof(IMAGE_BITBOX02_NOVA_LOGO), }, .dimensions = { - .width = IMAGE_BITBOX02_PLUS_LOGO_W, - .height = IMAGE_BITBOX02_PLUS_LOGO_H, + .width = IMAGE_BITBOX02_NOVA_LOGO_W, + .height = IMAGE_BITBOX02_NOVA_LOGO_H, }, }; return result; diff --git a/src/usb/class/usb_desc_bitbox02plus.h b/src/usb/class/usb_desc_bitbox02nova.h similarity index 81% rename from src/usb/class/usb_desc_bitbox02plus.h rename to src/usb/class/usb_desc_bitbox02nova.h index 2f2a73b28b..4e7889f257 100644 --- a/src/usb/class/usb_desc_bitbox02plus.h +++ b/src/usb/class/usb_desc_bitbox02nova.h @@ -1,7 +1,7 @@ // SPDX-License-Identifier: Apache-2.0 -#ifndef _USB_DESC_BITBOX02_PLUS_H_ -#define _USB_DESC_BITBOX02_PLUS_H_ +#ifndef _USB_DESC_BITBOX02_NOVA_H_ +#define _USB_DESC_BITBOX02_NOVA_H_ #include "usb_desc_common.h" #include "usb_size.h" @@ -14,15 +14,15 @@ #endif #if defined(BOOTLOADER) - #if PRODUCT_BITBOX_PLUS_BTCONLY == 1 - #define USB_DESC_BB02PLUS_IPRODUCT_STR_DESC \ + #if PRODUCT_BITBOX_NOVA_BTCONLY == 1 + #define USB_DESC_BB02NOVA_IPRODUCT_STR_DESC \ 52, /* bLength */ \ 0x03, /* bDescriptorType */ \ 'B', 0, 'i', 0, 't', 0, 'B', 0, 'o', 0, 'x', 0, '0', 0, '2', 0, ' ', 0, 'N', 0, \ 'o', 0, 'v', 0, 'a', 0, ' ', 0, 'B', 0, 'T', 0, 'C', 0, '-', 0, 'o', 0, 'n', 0, \ 'l', 0, 'y', 0, ' ', 0, 'b', 0, 'l', 0, #else - #define USB_DESC_BB02PLUS_IPRODUCT_STR_DESC \ + #define USB_DESC_BB02NOVA_IPRODUCT_STR_DESC \ 46, /* bLength */ \ 0x03, /* bDescriptorType */ \ 'B', 0, 'i', 0, 't', 0, 'B', 0, 'o', 0, 'x', 0, '0', 0, '2', 0, ' ', 0, 'N', 0, \ @@ -30,34 +30,34 @@ 'b', 0, 'l', 0, #endif #elif FACTORYSETUP == 1 - #define USB_DESC_BB02PLUS_IPRODUCT_STR_DESC \ + #define USB_DESC_BB02NOVA_IPRODUCT_STR_DESC \ 44, /* bLength */ \ 0x03, /* bDescriptorType */ \ 'B', 0, 'i', 0, 't', 0, 'B', 0, 'o', 0, 'x', 0, '0', 0, '2', 0, ' ', 0, 'N', 0, 'o', \ 0, 'v', 0, 'a', 0, ' ', 0, 'F', 0, 'a', 0, 'c', 0, 't', 0, 'o', 0, 'r', 0, 'y', 0, #elif PRODUCT_BITBOX_BTCONLY == 1 - #define USB_DESC_BB02PLUS_IPRODUCT_STR_DESC \ + #define USB_DESC_BB02NOVA_IPRODUCT_STR_DESC \ 46, /* bLength */ \ 0x03, /* bDescriptorType */ \ 'B', 0, 'i', 0, 't', 0, 'B', 0, 'o', 0, 'x', 0, '0', 0, '2', 0, ' ', 0, 'N', 0, 'o', \ 0, 'v', 0, 'a', 0, ' ', 0, 'B', 0, 'T', 0, 'C', 0, '-', 0, 'o', 0, 'n', 0, 'l', 0, \ 'y', 0, #else - #define USB_DESC_BB02PLUS_IPRODUCT_STR_DESC \ + #define USB_DESC_BB02NOVA_IPRODUCT_STR_DESC \ 40, /* bLength */ \ 0x03, /* bDescriptorType */ \ 'B', 0, 'i', 0, 't', 0, 'B', 0, 'o', 0, 'x', 0, '0', 0, '2', 0, ' ', 0, 'N', 0, 'o', \ 0, 'v', 0, 'a', 0, ' ', 0, 'M', 0, 'u', 0, 'l', 0, 't', 0, 'i', 0, #endif -#define USB_STR_DESC_BB02PLUS \ +#define USB_STR_DESC_BB02NOVA \ USB_DESC_LANGID_DESC \ USB_DESC_IMANUFACT_STR_DESC \ - USB_DESC_BB02PLUS_IPRODUCT_STR_DESC \ + USB_DESC_BB02NOVA_IPRODUCT_STR_DESC \ USB_DESC_ISERIALNUM_STR_DESC -#define USB_DESC_BB02PLUS_HWW_REPORT_LEN 34 -#define USB_DESC_BB02PLUS_HWW_REPORT \ +#define USB_DESC_BB02NOVA_HWW_REPORT_LEN 34 +#define USB_DESC_BB02NOVA_HWW_REPORT \ 0x06, 0xff, 0xff, /* USAGE_PAGE (Vendor Defined) */ \ 0x09, 0x01, /* USAGE (HID Generic Device) */ \ 0xa1, 0x01, /* COLLECTION (Application) */ /* In Report */ \ @@ -75,16 +75,16 @@ 0x91, 0x02, /* OUTPUT (Data,Var,Abs) */ \ 0xc0 /* END_COLLECTION */ -// ** If add an interface, adjust USB_DESC_BB02PLUS_WTOTALLEN ** -// TODO: USB_DESC_BB02PLUS_D_MAX_EP_N doesn't exist, but there is CONF_USB_D_NUM_EP_SP +// ** If add an interface, adjust USB_DESC_BB02NOVA_WTOTALLEN ** +// TODO: USB_DESC_BB02NOVA_D_MAX_EP_N doesn't exist, but there is CONF_USB_D_NUM_EP_SP // (= supported endpoints) - is that the one that needs to change? -// ** If add more endpoints, adjust USB_DESC_BB02PLUS_D_MAX_EP_N ** +// ** If add more endpoints, adjust USB_DESC_BB02NOVA_D_MAX_EP_N ** #if APP_U2F == 0 - #define USB_DESC_BB02PLUS_FS \ - USB_DEV_DESC, USB_DESC_CONFIG, USB_DESC_IFACE_HWW, USB_STR_DESC_BB02PLUS + #define USB_DESC_BB02NOVA_FS \ + USB_DEV_DESC, USB_DESC_CONFIG, USB_DESC_IFACE_HWW, USB_STR_DESC_BB02NOVA #else - #define USB_DESC_BB02PLUS_FS \ - USB_DEV_DESC, USB_DESC_CONFIG, USB_DESC_IFACE_HWW, USB_DESC_IFACE_U2F, USB_STR_DESC_BB02PLUS + #define USB_DESC_BB02NOVA_FS \ + USB_DEV_DESC, USB_DESC_CONFIG, USB_DESC_IFACE_HWW, USB_DESC_IFACE_U2F, USB_STR_DESC_BB02NOVA #endif #endif diff --git a/src/usb/usb.c b/src/usb/usb.c index 068ae8bb46..35798644aa 100644 --- a/src/usb/usb.c +++ b/src/usb/usb.c @@ -4,7 +4,7 @@ #ifndef TESTING #include "hid_hww.h" #include "usb_desc.h" - #include "usb_desc_bitbox02plus.h" + #include "usb_desc_bitbox02nova.h" #include "usb_size.h" #include "usbdc.h" #include @@ -31,11 +31,11 @@ static uint8_t _descriptor_bytes[] = { USB_DESC_FS}; // Device descriptors and Configuration descriptors list. static struct usbd_descriptors _descriptor[] = { {_descriptor_bytes, _descriptor_bytes + sizeof(_descriptor_bytes)}}; -static uint8_t _descriptor_bytes_bitbox02plus[] = { - USB_DESC_BB02PLUS_FS}; // Device descriptors and Configuration descriptors list. -static struct usbd_descriptors _descriptor_bitbox02plus[] = { - {_descriptor_bytes_bitbox02plus, - _descriptor_bytes_bitbox02plus + sizeof(_descriptor_bytes_bitbox02plus)}}; +static uint8_t _descriptor_bytes_bitbox02nova[] = { + USB_DESC_BB02NOVA_FS}; // Device descriptors and Configuration descriptors list. +static struct usbd_descriptors _descriptor_bitbox02nova[] = { + {_descriptor_bytes_bitbox02nova, + _descriptor_bytes_bitbox02nova + sizeof(_descriptor_bytes_bitbox02nova)}}; static void _hww_endpoint_available(void); #if APP_U2F == 1 static void _u2f_endpoint_available(void); @@ -101,8 +101,8 @@ int32_t usb_start(void) } #endif switch (memory_get_platform()) { - case MEMORY_PLATFORM_BITBOX02_PLUS: - usbdc_start(_descriptor_bitbox02plus); + case MEMORY_PLATFORM_BITBOX02_NOVA: + usbdc_start(_descriptor_bitbox02nova); break; default: usbdc_start(_descriptor); diff --git a/test/hardware-fakes/src/fake_memory.c b/test/hardware-fakes/src/fake_memory.c index 68a1700353..aef6d9fbc4 100644 --- a/test/hardware-fakes/src/fake_memory.c +++ b/test/hardware-fakes/src/fake_memory.c @@ -70,7 +70,7 @@ bool fake_memory_nova(void) { chunk_shared_t shared = {0}; memory_read_shared_bootdata_fake(shared.bytes); - shared.fields.platform = MEMORY_PLATFORM_BITBOX02_PLUS; + shared.fields.platform = MEMORY_PLATFORM_BITBOX02_NOVA; shared.fields.securechip_type = MEMORY_SECURECHIP_TYPE_OPTIGA; if (!memory_write_to_address_fake(FLASH_SHARED_DATA_START, 0, shared.bytes)) { return false; diff --git a/test/unit-test/test_memory.c b/test/unit-test/test_memory.c index d947e13a98..c6d83ca360 100644 --- a/test/unit-test/test_memory.c +++ b/test/unit-test/test_memory.c @@ -379,12 +379,12 @@ static void _test_memory_reset_hww(void** state) static void _test_memory_reset_hww_ble(void** state) { - // Make the platform BitBox02 Plus so that the BLE branch in + // Make the platform BitBox02 Nova so that the BLE branch in // memory_reset_hww() is executed. EMPTYCHUNK(empty_shared_chunk); chunk_shared_t shared_chunk = {0}; memcpy(shared_chunk.bytes, empty_shared_chunk, CHUNK_SIZE); - shared_chunk.fields.platform = MEMORY_PLATFORM_BITBOX02_PLUS; + shared_chunk.fields.platform = MEMORY_PLATFORM_BITBOX02_NOVA; // First shared bootdata read is used by memory_get_platform() will_return(__wrap_memory_read_shared_bootdata_fake, shared_chunk.bytes); @@ -402,7 +402,7 @@ static void _test_memory_reset_hww_ble(void** state) // Second shared bootdata read is used inside the BLE branch of memory_reset_hww() chunk_shared_t shared_chunk2 = {0}; memcpy(shared_chunk2.bytes, empty_shared_chunk, CHUNK_SIZE); - shared_chunk2.fields.platform = MEMORY_PLATFORM_BITBOX02_PLUS; + shared_chunk2.fields.platform = MEMORY_PLATFORM_BITBOX02_NOVA; will_return(__wrap_memory_read_shared_bootdata_fake, shared_chunk2.bytes); // Build expected shared chunk after BLE re-initialization @@ -460,7 +460,7 @@ static void _test_memory_get_device_name_default_bluetooth(void** state) EMPTYCHUNK(empty_shared_chunk); chunk_shared_t shared_chunk = {0}; memcpy(shared_chunk.bytes, empty_shared_chunk, CHUNK_SIZE); - shared_chunk.fields.platform = MEMORY_PLATFORM_BITBOX02_PLUS; + shared_chunk.fields.platform = MEMORY_PLATFORM_BITBOX02_NOVA; will_return(__wrap_memory_read_shared_bootdata_fake, shared_chunk.bytes); will_return(__wrap_random_32_bytes_mcu, entropy); From 027194df4dfdfb9d2bc3debc8202959ba8003173 Mon Sep 17 00:00:00 2001 From: Niklas Dusenlund Date: Mon, 1 Jun 2026 13:57:10 +0200 Subject: [PATCH 2/4] Add nova firmware targets Build firmware-nova and firmware-nova-btc as separate CMake artifacts while keeping them identical to the existing multi and BTC-only firmware variants for now. --- .ci/check-unwanted-symbols | 7 +++---- .github/workflows/ci-common.yml | 4 +++- Makefile | 4 ++++ src/CMakeLists.txt | 10 ++++++++++ src/rust/bitbox02-rust-c/Cargo.toml | 2 ++ 5 files changed, 22 insertions(+), 5 deletions(-) diff --git a/.ci/check-unwanted-symbols b/.ci/check-unwanted-symbols index 9af90725ba..e7c0d02b50 100755 --- a/.ci/check-unwanted-symbols +++ b/.ci/check-unwanted-symbols @@ -93,12 +93,11 @@ check_production_bootloader() { "Use the existing PUKCC SHA-256 implementation in production bootloaders instead." } -firmware_elf=build/bin/firmware.elf -if [[ -f "$firmware_elf" ]]; then +shopt -s nullglob +for firmware_elf in build/bin/firmware*.elf; do check_firmware "$firmware_elf" -fi +done -shopt -s nullglob for bootloader_elf in build/bin/*-bl-*-production.elf; do check_production_bootloader "$bootloader_elf" done diff --git a/.github/workflows/ci-common.yml b/.github/workflows/ci-common.yml index 459ce85f53..713ac40cc4 100644 --- a/.github/workflows/ci-common.yml +++ b/.github/workflows/ci-common.yml @@ -216,6 +216,8 @@ jobs: - bootloader-nova-btc-production - firmware - firmware-btc + - firmware-nova + - firmware-nova-btc - factory-setup - firmware-debug - simulator @@ -242,7 +244,7 @@ jobs: run: make -j$(($(nproc)+1)) ${{ matrix.target }} - name: Check unwanted symbols - if: (matrix.target == 'firmware' || (startsWith(matrix.target, 'bootloader') && endsWith(matrix.target, 'production'))) && !cancelled() + if: ((matrix.target == 'firmware' || matrix.target == 'firmware-nova') || (startsWith(matrix.target, 'bootloader') && endsWith(matrix.target, 'production'))) && !cancelled() run: ./.ci/check-unwanted-symbols - name: Print hashes diff --git a/Makefile b/Makefile index 335585bc9e..d69145a7a1 100644 --- a/Makefile +++ b/Makefile @@ -49,6 +49,10 @@ firmware: | build $(MAKE) -C build firmware.elf firmware-btc: | build $(MAKE) -C build firmware-btc.elf +firmware-nova: | build + $(MAKE) -C build firmware-nova.elf +firmware-nova-btc: | build + $(MAKE) -C build firmware-nova-btc.elf firmware-debug: | build-debug $(MAKE) -C build-debug firmware.elf diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 07e20739f4..dd7c095606 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -317,6 +317,8 @@ set(DEVDEVICE-BOOTLOADERS set(FIRMWARES firmware # Firmware MULTI firmware-btc # Firmware BTC-ONLY + firmware-nova # Firmware NOVA MULTI + firmware-nova-btc # Firmware NOVA BTC-ONLY factory-setup # Factory-setup ) set(FIRMWARES ${FIRMWARES} PARENT_SCOPE) @@ -535,6 +537,14 @@ if(CMAKE_CROSSCOMPILING) target_compile_definitions(firmware-btc.elf PRIVATE PRODUCT_BITBOX_BTCONLY "APP_U2F=0") target_sources(firmware-btc.elf PRIVATE ${PLATFORM-BITBOX02-SOURCES}) + target_sources(firmware-nova.elf PRIVATE firmware.c) + target_compile_definitions(firmware-nova.elf PRIVATE PRODUCT_BITBOX_MULTI "APP_U2F=1") + target_sources(firmware-nova.elf PRIVATE ${FIRMWARE-U2F-SOURCES} ${FIRMWARE-U2F-DRIVER-SOURCES} ${PLATFORM-BITBOX02-SOURCES}) + + target_sources(firmware-nova-btc.elf PRIVATE firmware.c) + target_compile_definitions(firmware-nova-btc.elf PRIVATE PRODUCT_BITBOX_BTCONLY "APP_U2F=0") + target_sources(firmware-nova-btc.elf PRIVATE ${PLATFORM-BITBOX02-SOURCES}) + target_sources(factory-setup.elf PRIVATE factorysetup.c) target_compile_definitions(factory-setup.elf PRIVATE PRODUCT_BITBOX02_FACTORYSETUP "APP_U2F=0") target_sources(factory-setup.elf PRIVATE ${PLATFORM-BITBOX02-SOURCES}) diff --git a/src/rust/bitbox02-rust-c/Cargo.toml b/src/rust/bitbox02-rust-c/Cargo.toml index b9cbe4d61a..8ee1bdf940 100644 --- a/src/rust/bitbox02-rust-c/Cargo.toml +++ b/src/rust/bitbox02-rust-c/Cargo.toml @@ -46,6 +46,8 @@ target-bb02p-bl-btconly-development = ["bootloader", "platform-bitbox02nova"] target-bb02p-bl-btconly-production = ["bootloader", "platform-bitbox02nova"] target-firmware = ["firmware", "platform-bitbox02", "app-bitcoin", "app-litecoin", "app-ethereum", "app-u2f", "app-cardano"] target-firmware-btc = ["firmware", "platform-bitbox02", "app-bitcoin"] +target-firmware-nova = ["firmware", "platform-bitbox02", "app-bitcoin", "app-litecoin", "app-ethereum", "app-u2f", "app-cardano"] +target-firmware-nova-btc = ["firmware", "platform-bitbox02", "app-bitcoin"] target-factory-setup = [ # enable these features "factory-setup", From 9b33639d2118eee86e6238fafb6a073e57baf32c Mon Sep 17 00:00:00 2001 From: Niklas Dusenlund Date: Mon, 1 Jun 2026 14:58:28 +0200 Subject: [PATCH 3/4] Restore Python public API names Keep the existing BITBOX02PLUS public symbols while preserving the Nova product strings introduced by the firmware target rename. --- py/bitbox02/bitbox02/bitbox02/bootloader.py | 16 ++++++++-------- .../communication/bitbox_api_protocol.py | 12 ++++++------ py/bitbox02/bitbox02/communication/devices.py | 16 ++++++++-------- 3 files changed, 22 insertions(+), 22 deletions(-) diff --git a/py/bitbox02/bitbox02/bitbox02/bootloader.py b/py/bitbox02/bitbox02/bitbox02/bootloader.py index f0936b498f..5834bd360b 100644 --- a/py/bitbox02/bitbox02/bitbox02/bootloader.py +++ b/py/bitbox02/bitbox02/bitbox02/bootloader.py @@ -17,8 +17,8 @@ parse_device_version, BB02MULTI_BOOTLOADER, BB02BTC_BOOTLOADER, - BITBOX02NOVA_MULTI_BOOTLOADER, - BITBOX02NOVA_BTC_BOOTLOADER, + BITBOX02PLUS_MULTI_BOOTLOADER, + BITBOX02PLUS_BTC_BOOTLOADER, ) BOOTLOADER_CMD = 0x80 + 0x40 + 0x03 @@ -33,8 +33,8 @@ SIGDATA_MAGIC_BITBOX02_MULTI = struct.pack(">I", 0x653F362B) SIGDATA_MAGIC_BITBOX02_BTCONLY = struct.pack(">I", 0x11233B0B) -SIGDATA_MAGIC_BITBOX02NOVA_MULTI = struct.pack(">I", 0x5B648CEB) -SIGDATA_MAGIC_BITBOX02NOVA_BTCONLY = struct.pack(">I", 0x48714774) +SIGDATA_MAGIC_BITBOX02PLUS_MULTI = struct.pack(">I", 0x5B648CEB) +SIGDATA_MAGIC_BITBOX02PLUS_BTCONLY = struct.pack(">I", 0x48714774) MAGIC_LEN = 4 @@ -68,8 +68,8 @@ def parse_signed_firmware(firmware: bytes) -> typing.Tuple[bytes, bytes, bytes]: if magic not in ( SIGDATA_MAGIC_BITBOX02_MULTI, SIGDATA_MAGIC_BITBOX02_BTCONLY, - SIGDATA_MAGIC_BITBOX02NOVA_MULTI, - SIGDATA_MAGIC_BITBOX02NOVA_BTCONLY, + SIGDATA_MAGIC_BITBOX02PLUS_MULTI, + SIGDATA_MAGIC_BITBOX02PLUS_BTCONLY, ): raise ValueError("invalid magic") @@ -87,8 +87,8 @@ def __init__(self, transport: TransportLayer, device_info: DeviceInfo): self.expected_magic = { BB02MULTI_BOOTLOADER: SIGDATA_MAGIC_BITBOX02_MULTI, BB02BTC_BOOTLOADER: SIGDATA_MAGIC_BITBOX02_BTCONLY, - BITBOX02NOVA_MULTI_BOOTLOADER: SIGDATA_MAGIC_BITBOX02NOVA_MULTI, - BITBOX02NOVA_BTC_BOOTLOADER: SIGDATA_MAGIC_BITBOX02NOVA_BTCONLY, + BITBOX02PLUS_MULTI_BOOTLOADER: SIGDATA_MAGIC_BITBOX02PLUS_MULTI, + BITBOX02PLUS_BTC_BOOTLOADER: SIGDATA_MAGIC_BITBOX02PLUS_BTCONLY, }.get(device_info["product_string"]) self.version = parse_device_version(device_info["serial_number"]) # Delete the prelease part, as it messes with the comparison (e.g. 3.0.0-pre < 3.0.0 is diff --git a/py/bitbox02/bitbox02/communication/bitbox_api_protocol.py b/py/bitbox02/bitbox02/communication/bitbox_api_protocol.py index c2c07600dd..04446d761a 100644 --- a/py/bitbox02/bitbox02/communication/bitbox_api_protocol.py +++ b/py/bitbox02/bitbox02/communication/bitbox_api_protocol.py @@ -18,7 +18,7 @@ from .devices import parse_device_version, DeviceInfo from .communication import TransportLayer -from .devices import BITBOX02MULTI, BITBOX02BTC, BITBOX02NOVA_MULTI, BITBOX02NOVA_BTC +from .devices import BITBOX02MULTI, BITBOX02BTC, BITBOX02PLUS_MULTI, BITBOX02PLUS_BTC try: from .generated import hww_pb2 as hww @@ -202,7 +202,7 @@ class Platform(enum.Enum): """Available hardware platforms""" BITBOX02 = "bitbox02" - BITBOX02NOVA = "bitbox02-plus" + BITBOX02PLUS = "bitbox02-plus" BITBOX03 = "bitbox03" @@ -563,9 +563,9 @@ def __init__( if device_info is not None: version = device_info["serial_number"] - if device_info["product_string"] in (BITBOX02MULTI, BITBOX02NOVA_MULTI): + if device_info["product_string"] in (BITBOX02MULTI, BITBOX02PLUS_MULTI): edition = BitBox02Edition.MULTI - elif device_info["product_string"] in (BITBOX02BTC, BITBOX02NOVA_BTC): + elif device_info["product_string"] in (BITBOX02BTC, BITBOX02PLUS_BTC): edition = BitBox02Edition.BTCONLY else: raise Exception("Invalid product string") @@ -715,13 +715,13 @@ def get_info( platform_byte, response = response[0], response[1:] platform = { 0x00: Platform.BITBOX02, - 0x02: Platform.BITBOX02NOVA, + 0x02: Platform.BITBOX02PLUS, 0x03: Platform.BITBOX03, }[platform_byte] edition_byte, response = response[0], response[1:] edition: Union[BitBox02Edition] - if platform in (Platform.BITBOX02, Platform.BITBOX02NOVA, Platform.BITBOX03): + if platform in (Platform.BITBOX02, Platform.BITBOX02PLUS, Platform.BITBOX03): edition = {0x00: BitBox02Edition.MULTI, 0x01: BitBox02Edition.BTCONLY}[edition_byte] else: raise Exception("Unknown platform: {}".format(platform)) diff --git a/py/bitbox02/bitbox02/communication/devices.py b/py/bitbox02/bitbox02/communication/devices.py index f1f7253ae2..3d8b92b7d3 100644 --- a/py/bitbox02/bitbox02/communication/devices.py +++ b/py/bitbox02/bitbox02/communication/devices.py @@ -15,10 +15,10 @@ BITBOX02MULTI = "BitBox02" BITBOX02BTC = "BitBox02BTC" -BITBOX02NOVA_MULTI_BOOTLOADER = "BitBox02 Nova Multi bl" -BITBOX02NOVA_BTC_BOOTLOADER = "BitBox02 Nova BTC-only bl" -BITBOX02NOVA_MULTI = "BitBox02 Nova Multi" -BITBOX02NOVA_BTC = "BitBox02 Nova BTC-only" +BITBOX02PLUS_MULTI_BOOTLOADER = "BitBox02 Nova Multi bl" +BITBOX02PLUS_BTC_BOOTLOADER = "BitBox02 Nova BTC-only bl" +BITBOX02PLUS_MULTI = "BitBox02 Nova Multi" +BITBOX02PLUS_BTC = "BitBox02 Nova BTC-only" class TooManyFoundException(Exception): @@ -105,8 +105,8 @@ def get_any_bitbox02s() -> List[DeviceInfo]: """ devices = get_bitbox02multi_devices() devices.extend(get_bitbox02btc_devices()) - devices.extend(get_devices(BITBOX02NOVA_MULTI)) - devices.extend(get_devices(BITBOX02NOVA_BTC)) + devices.extend(get_devices(BITBOX02PLUS_MULTI)) + devices.extend(get_devices(BITBOX02PLUS_BTC)) return devices @@ -134,8 +134,8 @@ def get_any_bitbox02_bootloaders() -> List[DeviceInfo]: """ devices = get_bitbox02multi_bootloaders() devices.extend(get_bitbox02btc_bootloaders()) - devices.extend(get_devices(BITBOX02NOVA_MULTI_BOOTLOADER)) - devices.extend(get_devices(BITBOX02NOVA_BTC_BOOTLOADER)) + devices.extend(get_devices(BITBOX02PLUS_MULTI_BOOTLOADER)) + devices.extend(get_devices(BITBOX02PLUS_BTC_BOOTLOADER)) return devices From c76726043e6e651bd373b5725998054a3e6292a6 Mon Sep 17 00:00:00 2001 From: Niklas Dusenlund Date: Mon, 1 Jun 2026 15:04:58 +0200 Subject: [PATCH 4/4] Set Nova firmware product flags Build the Nova firmware targets with PRODUCT_BITBOX_NOVA_MULTI and PRODUCT_BITBOX_NOVA_BTCONLY instead of the classic BitBox02 product macros. Update the firmware-side product string, OP_INFO edition byte, and Nova USB descriptor checks to recognize the Nova macros. --- src/CMakeLists.txt | 4 ++-- src/hww.c | 5 +++-- src/platform/platform_init.c | 7 ++----- src/usb/class/usb_desc_bitbox02nova.h | 2 +- 4 files changed, 8 insertions(+), 10 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index dd7c095606..d53dfdc428 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -538,11 +538,11 @@ if(CMAKE_CROSSCOMPILING) target_sources(firmware-btc.elf PRIVATE ${PLATFORM-BITBOX02-SOURCES}) target_sources(firmware-nova.elf PRIVATE firmware.c) - target_compile_definitions(firmware-nova.elf PRIVATE PRODUCT_BITBOX_MULTI "APP_U2F=1") + target_compile_definitions(firmware-nova.elf PRIVATE PRODUCT_BITBOX_NOVA_MULTI "APP_U2F=1") target_sources(firmware-nova.elf PRIVATE ${FIRMWARE-U2F-SOURCES} ${FIRMWARE-U2F-DRIVER-SOURCES} ${PLATFORM-BITBOX02-SOURCES}) target_sources(firmware-nova-btc.elf PRIVATE firmware.c) - target_compile_definitions(firmware-nova-btc.elf PRIVATE PRODUCT_BITBOX_BTCONLY "APP_U2F=0") + target_compile_definitions(firmware-nova-btc.elf PRIVATE PRODUCT_BITBOX_NOVA_BTCONLY "APP_U2F=0") target_sources(firmware-nova-btc.elf PRIVATE ${PLATFORM-BITBOX02-SOURCES}) target_sources(factory-setup.elf PRIVATE factorysetup.c) diff --git a/src/hww.c b/src/hww.c index 650d127375..2340583b7b 100644 --- a/src/hww.c +++ b/src/hww.c @@ -85,9 +85,10 @@ static size_t _api_info(uint8_t* buf) current++; // 1 byte edition code -#if PRODUCT_BITBOX_MULTI == 1 || PRODUCT_BITBOX02_FACTORYSETUP == 1 +#if (PRODUCT_BITBOX_MULTI == 1) || (PRODUCT_BITBOX_NOVA_MULTI == 1) || \ + (PRODUCT_BITBOX02_FACTORYSETUP == 1) *current = 0x00; -#elif PRODUCT_BITBOX_BTCONLY == 1 +#elif (PRODUCT_BITBOX_BTCONLY == 1) || (PRODUCT_BITBOX_NOVA_BTCONLY == 1) *current = 0x01; #endif current++; diff --git a/src/platform/platform_init.c b/src/platform/platform_init.c index 08ee781170..86c85a8974 100644 --- a/src/platform/platform_init.c +++ b/src/platform/platform_init.c @@ -53,12 +53,9 @@ void platform_init(void) #error "unknown product" #endif #else - // Currently we have one firmware for both BB02 and BB02_NOVA, and only the - // PRODUCT_BITBOX_MULTI/BTCONLY definitions apply. The PRODUCT_BITBOX_NOVA_MULTI/BTCONLY - // defs currently only apply in the bootloader, which we don't need here. - #if PRODUCT_BITBOX_MULTI == 1 + #if (PRODUCT_BITBOX_MULTI == 1) || (PRODUCT_BITBOX_NOVA_MULTI == 1) #define PRODUCT_STRING_SUFFIX "multi" - #elif PRODUCT_BITBOX_BTCONLY == 1 + #elif (PRODUCT_BITBOX_BTCONLY == 1) || (PRODUCT_BITBOX_NOVA_BTCONLY == 1) #define PRODUCT_STRING_SUFFIX "btconly" #elif PRODUCT_BITBOX02_FACTORYSETUP == 1 // Dummy, not actually needed, but this file is currently needlessly compiled for diff --git a/src/usb/class/usb_desc_bitbox02nova.h b/src/usb/class/usb_desc_bitbox02nova.h index 4e7889f257..113edeb3c7 100644 --- a/src/usb/class/usb_desc_bitbox02nova.h +++ b/src/usb/class/usb_desc_bitbox02nova.h @@ -35,7 +35,7 @@ 0x03, /* bDescriptorType */ \ 'B', 0, 'i', 0, 't', 0, 'B', 0, 'o', 0, 'x', 0, '0', 0, '2', 0, ' ', 0, 'N', 0, 'o', \ 0, 'v', 0, 'a', 0, ' ', 0, 'F', 0, 'a', 0, 'c', 0, 't', 0, 'o', 0, 'r', 0, 'y', 0, -#elif PRODUCT_BITBOX_BTCONLY == 1 +#elif PRODUCT_BITBOX_NOVA_BTCONLY == 1 #define USB_DESC_BB02NOVA_IPRODUCT_STR_DESC \ 46, /* bLength */ \ 0x03, /* bDescriptorType */ \