75 return "an unrecognized chip";
86 return "an unrecognized chip";
124 uint16_t bootloader_version) {
126 if (requirement.target_fw == target_fw) {
140 if (requirement.target_fw == target_fw)
141 return requirement.bootloader;
163 uint16_t bootloader_version) {
165 if (required == 0 || required == bootloader_version)
211 bool bootloader_version_known,
212 uint16_t bootloader_version,
213 uint16_t loader_fw, uint16_t target_fw) {
216 if (!bootloader_version_known)
220 if (loader_fw != bootloader_version)
226 if (required == bootloader_version)
228 if (required > bootloader_version)
291 uint16_t bootloader_version, uint16_t installed_fw,
292 uint16_t target_fw,
bool already_confirmed) {
293 if (bootloader_version == 0)
302 if (device_type == 0)
318 if (installed_fw == 0)
320 if (target_fw == installed_fw)
322 if (target_fw > installed_fw)
constexpr uint8_t LR1120_DEVICE_TYPE_FOR_FIRMWARE_DECISIONS
constexpr uint16_t lr1121_required_bootloader_for(uint16_t target_fw)
Required bootloader for a known target firmware version.
constexpr uint16_t LR1110_BOOTLOADER_6500
constexpr Lr1121BootloaderRequirement LR1121_KNOWN_BOOTLOADER_REQUIREMENTS[]
Bootloader requirements we know about, copied from Semtech's published pairings (SWTL001/application/...
constexpr uint16_t LR1121_BOOTLOADER_2100
LR1121 bootloader versions, from Semtech's published compatibility matrix.
constexpr uint16_t LR1110_BOOTLOADER_1001
constexpr BootloaderSupport lr1121_bootloader_supports_target(uint16_t target_fw, uint16_t bootloader_version)
Look up whether target_fw is known to require bootloader_version.
constexpr uint16_t LR1121_BOOTLOADER_2101
constexpr uint16_t LR1121_LOADER_2100
Version the lr1121_loader_2100.bin bootloader-*loader* image reports of itself.
constexpr BootloaderUpgradePath lr1121_bootloader_upgrade_path(bool block_present, bool bootloader_version_known, uint16_t bootloader_version, uint16_t loader_fw, uint16_t target_fw)
Whether the three-stage bootloader upgrade is applicable for the current cached state.
BootloaderUpgradePath
Whether the three-stage bootloader-rewrite sequence (ADR 0021) is applicable, and if not,...
@ AVAILABLE
Three-stage is possible. Still requires the arming switch to actually run.
@ BLOCKED_BOOTLOADER_NEWER
Target needs an OLDER bootloader. Not reachable today, likely never.
@ BLOCKED_UNKNOWN_TARGET
Block present, but this build cannot know what the target needs.
@ NOT_APPLICABLE
No block, or no upgrade needed/possible to evaluate. Keep the original verdict.
constexpr const char * lr1121_chip_family_for_bootloader(uint16_t bootloader_version)
Human-readable chip family for a bootloader version that is not one of the two LR1121 values above,...
constexpr bool lr1121_bootloader_is_lr1121(uint16_t bootloader_version)
BootloaderSupport
Whether a target firmware version is known to work with a given bootloader version.
@ SUPPORTED
Both versions known, and the pairing is in LR1121_KNOWN_BOOTLOADER_REQUIREMENTS.
@ UNSUPPORTED
target_fw is known, but not paired with this bootloader_version.
@ UNKNOWN_TARGET
target_fw does not appear in LR1121_KNOWN_BOOTLOADER_REQUIREMENTS at all.
constexpr FlashDecision lr1121_flash_decision(uint8_t device_type, uint8_t bootloader_chip_type, uint16_t bootloader_version, uint16_t installed_fw, uint16_t target_fw, bool already_confirmed)
The single decision point for whether/how to flash target_fw.
FlashDecision
Outcome of lr1121_flash_decision().
@ PROCEED
Safe to erase and write.
@ REJECT_WRONG_CHIP
device_type or bootloader_version doesn't identify an LR1121.
@ NEEDS_CONFIRMATION
Not unsafe, but not an unambiguous "yes" either — needs a second press.
@ REJECT_BOOTLOADER_TOO_OLD
target_fw is known and positively incompatible with this bootloader.
@ ALREADY_INSTALLED
target_fw == installed_fw (both known) — the post-success state.
constexpr uint8_t LR1121_BOOTLOADER_TYPE_FOR_FIRMWARE_DECISIONS
LR1121 GetVersion type byte reported while running the bootloader (LR11XX_TYPE_PRODUCTION_MODE) — mus...
constexpr BootloaderMismatch lr1121_bootloader_mismatch_kind(uint16_t target_fw, uint16_t bootloader_version)
Classify a bootloader/target mismatch by direction; see BootloaderMismatch.
constexpr uint16_t LR1120_BOOTLOADER_2001
constexpr uint8_t LR1121_DEVICE_TYPE_FOR_FIRMWARE_DECISIONS
LR1121 GetVersion type byte in normal mode — must match radio_lr1121.h's LR1121_DEVICE_TYPE (0x03).
constexpr const char * lr1121_chip_family_for_device_type(uint8_t device_type)
Human-readable chip family for a normal-mode device_type that is not the LR1121 value above,...
constexpr uint8_t LR1110_DEVICE_TYPE_FOR_FIRMWARE_DECISIONS
Normal-mode GetVersion type bytes for the two chips an LR1121 is most easily confused with — companio...
constexpr uint16_t LR1120_BOOTLOADER_2000
Bootloader versions reported by the two chips an LR1121 is most easily confused with — used only to n...
BootloaderMismatch
Direction of a bootloader/target mismatch, for messaging.
@ TARGET_NEEDS_NEWER
The "too old" direction – what REJECT_BOOTLOADER_TOO_OLD has always meant until now.
@ TARGET_NEEDS_OLDER
The "too new" direction – a downgrade, newly reachable once this feature ships.
@ NONE
target_fw is unknown, or its required bootloader matches bootloader_version.
One (target firmware, required bootloader) pairing from Semtech's published compatibility matrix.