{"record":{"id":"ce3a803778ba1816","repo":"embassy-rs/embassy","slug":"lpc55-must-specify-flexcomm-instance","errorCode":null,"errorMessage":"LPC55 must specify FLEXCOMM instance","messagePattern":"LPC55 must specify FLEXCOMM instance","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"embassy-nxp/build.rs","lineNumber":330,"sourceCode":"\n        impls.push(quote! {\n            impl_dma_channel!(#instance, #channel_name, #channel_number);\n        });\n    }\n}\n\nfn impl_usart(cfgs: &mut common::CfgSet, impls: &mut Vec<TokenStream>, peripheral: &Peripheral) {\n    cfgs.declare_all(&[\n        \"has_usart_txd_pins\",\n        \"has_usart_rxd_pins\",\n        \"has_usart_cts_pins\",\n        \"has_usart_rts_pins\",\n        \"has_usart_sck_pins\",\n    ]);\n\n    let instance = Ident::new(peripheral.name, Span::call_site());\n    let flexcomm = Ident::new(\n        peripheral.flexcomm.expect(\"LPC55 must specify FLEXCOMM instance\"),\n        Span::call_site(),\n    );\n    let number = Literal::u8_unsuffixed(peripheral.name.strip_prefix(\"USART\").unwrap().parse::<u8>().unwrap());\n\n    impls.push(quote! {\n        impl_usart_instance!(#instance, #flexcomm, #number);\n    });\n\n    for signal in peripheral.signals {\n        let r#macro = match signal.name {\n            \"TXD\" => {\n                cfgs.enable(\"has_usart_txd_pins\");\n                format_ident!(\"impl_usart_txd_pin\")\n            }\n            \"RXD\" => {\n                cfgs.enable(\"has_usart_rxd_pins\");\n                format_ident!(\"impl_usart_rxd_pin\")\n            }","sourceCodeStart":312,"sourceCodeEnd":348,"githubUrl":"https://github.com/embassy-rs/embassy/blob/463a07b963419a1bfe61d5d597c44acb810afb8b/embassy-nxp/build.rs#L312-L348","documentation":"In embassy-nxp's build script, impl_usart builds the USART instance macro invocation and requires each USART peripheral metadata entry to declare which FLEXCOMM instance it is muxed onto. The panic fires when peripheral.flexcomm is None, so the generated code cannot reference the owning FLEXCOMM.","triggerScenarios":"Building embassy-nxp for an LPC55 target whose metadata defines a USART peripheral without a flexcomm field set, inside impl_peripherals -> impl_usart.","commonSituations":"Hand-written or regenerated chip metadata omitting the flexcomm assignment for a USART; adding a new LPC55 variant where the USART->FLEXCOMM mapping was not filled in; a metadata schema change dropping the field.","solutions":["Set the flexcomm field on the USART peripheral entry in the LPC55 chip metadata (e.g. USART0 -> FLEXCOMM0).","Regenerate the chip metadata ensuring every USART has its FLEXCOMM mapping.","Cross-check the datasheet's FLEXCOMM function table and fill in the correct instance per USART."],"exampleFix":"// before (metadata)\n{ name: \"USART0\" }\n// after\n{ name: \"USART0\", flexcomm: \"FLEXCOMM0\" }","handlingStrategy":"validation","validationCode":"assert!(peripheral.flexcomm.is_some(), \"{} must declare its FLEXCOMM instance\", peripheral.name);","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always fill the flexcomm field when adding USART entries for LPC55 metadata.","Validate metadata schema so flexcomm is required for USART/SPI peripherals.","Cross-check the FLEXCOMM function assignment table in the user manual."],"tags":["build-script","embedded","usart","metadata","rust"],"backgroundTag":"missing-required-config-field","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"}