Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions BUILD.md
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,12 @@ software or SWD speed does not affect compilation. Configuration never cleans. `
build trees but preserves `config.mk`. Host tests and simulators still use `build-build` and
`build-build-noasan`.

BitBox02/Nova Make builds also copy the binary to `build/bin`. Firmware is named
`<product>-<edition>.bin`, for example `bitbox02-multi.bin` or `bitbox02nova-btconly.bin`.
Factorysetup is named `factory-setup-<product>.bin`; bootloaders and upgrade firmware retain their
existing variant names. Both debug and non-debug builds update the same destination with the latest
binary. CMake output names and directories remain unchanged.

Use `bootloader-stage0` and `bootloader-stage1` with `LOCKED=yes DEVELOPMENT=no` for production
bootloaders, or `LOCKED=yes DEVELOPMENT=yes` for locked development devices. These targets build
only the configured product and edition. Development artifact names use `-development`, with
Expand Down
13 changes: 13 additions & 0 deletions scripts/build_product.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,23 @@ def cmake(config: Config, profile: str, targets: list[str]) -> None:
run(["make", "-C", str(directory), *targets])


def copy_binary(source: Path, name: str) -> None:
directory = ROOT / "build" / "bin"
run(["mkdir", "-p", str(directory)])
run(["cp", str(source), str(directory / f"{name}.bin")])


def build_image(config: Config, image: str) -> None:
profile = config.profile
info = image_info(config, image)
if config.product != "bitbox03":
cmake(config, profile, [f"{info.name}.elf"])
name = info.name
if image == "firmware":
name = f"{config.product}-{config.edition.replace('-', '')}"
elif image == "factorysetup":
name = f"factory-setup-{config.product}"
copy_binary(info.elf.with_suffix(".bin"), name)
return
config.describe()
run([str(ROOT / "scripts/bootstrap-cargo-config")])
Expand Down Expand Up @@ -85,6 +97,7 @@ def dispatch(config: Config, target: str) -> None:
elif target.startswith("firmware-blupgrade-"):
product = target.split("-")[2]
cmake(defaults(product), "relwithdebinfo", [target + ".elf"])
copy_binary(build_dir(defaults(product)) / "bin" / f"{target}.bin", target)
elif target in ("bootloader-upgrade-assets", "bootloader-upgrade-assets-development"):
suffix = "-development" if target.endswith("-development") else ""
for product in ("bitbox02", "bitbox02nova"):
Expand Down
Loading