{"record":{"id":"183d7add5d24aaf8","repo":"embassy-rs/embassy","slug":"double-precision-operations-require-v2-bootrom-fo","errorCode":null,"errorMessage":"Double precision operations require V2 bootrom (found: V{})","messagePattern":"Double precision operations require V2 bootrom \\(found: V(.+?)\\)","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"embassy-rp/src/rom_data/rp2040.rs","lineNumber":407,"sourceCode":"    rom_table_lookup(DATA_TABLE, *b\"FS\")\n}\n\n/// See Table 180 in the RP2040 datasheet for the contents of this table.\n#[cfg_attr(feature = \"rom-func-cache\", inline(never))]\npub fn soft_float_table() -> *const usize {\n    rom_table_lookup(DATA_TABLE, *b\"SF\")\n}\n\n/// The end address of the floating point library code and data.\npub fn fplib_end() -> *const u8 {\n    rom_table_lookup(DATA_TABLE, *b\"FE\")\n}\n\n/// This entry is only present in the V2 bootrom. See Table 182 in the RP2040 datasheet for the contents of this table.\n#[cfg_attr(feature = \"rom-func-cache\", inline(never))]\npub fn soft_double_table() -> *const usize {\n    if rom_version_number() < 2 {\n        panic!(\n            \"Double precision operations require V2 bootrom (found: V{})\",\n            rom_version_number()\n        );\n    }\n    rom_table_lookup(DATA_TABLE, *b\"SD\")\n}\n\n/// ROM functions using single-precision arithmetic (i.e. 'f32' in Rust terms)\npub mod float_funcs {\n\n    macro_rules! make_functions {\n        (\n            $(\n                $(#[$outer:meta])*\n                $offset:literal $name:ident (\n                    $( $aname:ident : $aty:ty ),*\n                ) -> $ret:ty;\n            )*","sourceCodeStart":389,"sourceCodeEnd":425,"githubUrl":"https://github.com/embassy-rs/embassy/blob/463a07b963419a1bfe61d5d597c44acb810afb8b/embassy-rp/src/rom_data/rp2040.rs#L389-L425","documentation":"The RP2040 boot ROM contains a double-precision float table (\"SD\") only in V2+ bootroms. `soft_double_table()` panics if `rom_version_number()` is less than 2, because calling the double-precision ROM functions on a V1 bootrom would look up garbage addresses. This is a deliberate fail-fast guard, not a runtime fault.","triggerScenarios":"Calling any `rom_data::f64::*` ROM function wrapper (e.g. f64_add, f64_mul) via `soft_double_table()` on an RP2040 chip whose bootrom is version 1 — typical of very early RP2040 boards manufactured before the V2 bootrom.","commonSituations":"Using early-production RP2040 boards or old boards with never-updated OTP/bootrom; running double-precision math (f64) via ROM lookups on hardware that only supports the single-precision V1 table; code copied from RP2350 or newer RP2040 examples.","solutions":["Check the bootrom version at startup with `rom_data::rom_version_number()` before using any f64 ROM functions and fall back to a software double implementation if it is < 2","Use a board/chip with the V2 bootrom (virtually all RP2040s manufactured after 2021)","Perform software floating point instead of the ROM table (e.g. disable the rom-func usage and rely on compiler-rt soft-float, or cast through fixed-point)","Read the actual ROM table version once and cache the decision instead of hitting the panic path"],"exampleFix":"// before\nlet sum = embassy_rp::rom_data::f64::f64_add(a, b); // panics on V1 bootrom\n// after\nif embassy_rp::rom_data::rom_version_number() >= 2 {\n    let sum = embassy_rp::rom_data::f64::f64_add(a, b);\n} else {\n    let sum = a + b; // compiler soft-float fallback\n}","handlingStrategy":"validation","validationCode":"fn rom_supports_f64() -> bool {\n    embassy_rp::rom_data::rom_version_number() >= 2\n}","typeGuard":null,"tryCatchPattern":"// panics are not catchable in no_std; gate calls at compile/runtime before invoking\nif !rom_supports_f64() { return Err(NotSupported); }","preventionTips":["Probe rom_version_number() once at startup and record capability flags","Avoid ROM f64 wrappers unless targeting known V2-bootrom hardware","Prefer plain Rust float arithmetic unless ROM speed is measured as necessary"],"tags":["embedded","rp2040","bootrom","floating-point"],"backgroundTag":"unsupported-platform","analyzedSha":"463a07b963419a1bfe61d5d597c44acb810afb8b","analyzedAt":"2026-09-10T13:38:26.660Z","contentChangedAt":"2026-09-10T13:38:26.660Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}