{"record":{"id":"c4968ac0fc30b9dd","repo":"embassy-rs/embassy","slug":"floating-point-function-requires-v2-bootrom-found","errorCode":null,"errorMessage":"Floating point function requires V2 bootrom (found: V{})","messagePattern":"Floating point function requires V2 bootrom \\(found: V(.+?)\\)","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"embassy-rp/src/rom_data/rp2040.rs","lineNumber":531,"sourceCode":"        /// Calculates the natural logarithm of `v`. If `v <= 0` return -Infinity\n        0x50 fln(v: f32) -> f32;\n    }\n\n    macro_rules! make_functions_v2 {\n        (\n            $(\n                $(#[$outer:meta])*\n                $offset:literal $name:ident (\n                    $( $aname:ident : $aty:ty ),*\n                ) -> $ret:ty;\n            )*\n        ) => {\n            $(\n                declare_rom_function! {\n                    $(#[$outer])*\n                    fn $name( $( $aname : $aty ),* ) -> $ret {\n                        if $crate::rom_data::rom_version_number() < 2 {\n                            panic!(\n                                \"Floating point function requires V2 bootrom (found: V{})\",\n                                $crate::rom_data::rom_version_number()\n                            );\n                        }\n                        let table: *const usize = $crate::rom_data::soft_float_table();\n                        unsafe {\n                            // This is the entry in the table. Our offset is given as a\n                            // byte offset, but we want the table index (each pointer in\n                            // the table is 4 bytes long)\n                            let entry: *const usize = table.offset($offset / 4);\n                            // Read the pointer from the table\n                            core::ptr::read(entry) as *const u32\n                        }\n                    }\n                }\n            )*\n        }\n    }","sourceCodeStart":513,"sourceCodeEnd":549,"githubUrl":"https://github.com/embassy-rs/embassy/blob/463a07b963419a1bfe61d5d597c44acb810afb8b/embassy-rp/src/rom_data/rp2040.rs#L513-L549","documentation":"This macro-generated wrapper for single-precision (\"SF\") bootrom float functions panics when `rom_version_number()` is less than 2, because the extended float function table only exists in the V2 bootrom. Calling the guarded function on a V1 bootrom would resolve to invalid ROM addresses, so the library fails fast with this message.","triggerScenarios":"Calling any `declare_rom_function!`-generated float helper (e.g. rom_data::float_funcs::f32_add) on an RP2040 whose bootrom reports version 1; also happens via code paths that use soft_float_table-derived functions early at boot.","commonSituations":"Early-revision RP2040 hardware with the original V1 bootrom; boards flashed/OTP-configured before the bootrom update; reusing float ROM code on chips that predate the V2 table.","solutions":["Verify hardware with `rom_data::rom_version_number()` before calling float ROM functions and gate them behind a version >= 2 check","Use hardware manufactured after the V2 bootrom rollout (almost all current RP2040 boards)","Fall back to plain Rust f32 arithmetic, which the FPU/soft-float handles without the ROM table","For mixed fleets, wrap ROM float calls in a helper that dispatches to ROM or software based on the version"],"exampleFix":"// before\nlet q = embassy_rp::rom_data::float_funcs::f32_div(a, b); // panics on V1 bootrom\n// after\nlet q = if embassy_rp::rom_data::rom_version_number() >= 2 {\n    embassy_rp::rom_data::float_funcs::f32_div(a, b)\n} else {\n    a / b // compiler-generated soft/hard float\n};","handlingStrategy":"validation","validationCode":"fn rom_supports_float() -> bool {\n    embassy_rp::rom_data::rom_version_number() >= 2\n}","typeGuard":null,"tryCatchPattern":"// panic in no_std: guard before calling ROM float functions\nlet result = if rom_supports_float() { rom_f32_div(a, b) } else { a / b };","preventionTips":["Check bootrom version before any soft_float_table-derived call","Keep a hardware capability table for your fleet of RP2040 boards","Prefer f32 arithmetic from the compiler for portability"],"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"}