{"record":{"id":"63922fd5b1649b1a","repo":"embassy-rs/embassy","slug":"no-sysctl-peripheral","errorCode":null,"errorMessage":"no SYSCTL peripheral","messagePattern":"no SYSCTL peripheral","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"embassy-mspm0/build.rs","lineNumber":512,"sourceCode":"            };\n\n            let feature = format!(\"time-driver-{}\", name.to_lowercase());\n\n            if singleton.name.contains(selected_timer) {\n                singleton.cfg = Some(quote! { #[cfg(not(all(feature = \"time-driver-any\", feature = #feature)))] });\n            } else {\n                singleton.cfg = Some(quote! { #[cfg(not(feature = #feature))] });\n            }\n        }\n    }\n}\n\nfn pin_features(singletons: &mut Vec<Singleton>) {\n    let sysctl = METADATA\n        .peripherals\n        .iter()\n        .find(|p| p.name == \"SYSCTL\")\n        .expect(\"no SYSCTL peripheral\");\n\n    // Some packages make NRST share a physical pin with a GPIO.\n    if let Some(pin) = sysctl.pins.iter().find(|p| p.signal == \"NRST\" && p.pin != \"NRST\") {\n        let pin = singletons\n            .iter_mut()\n            .find(|s| s.name == pin.pin)\n            .expect(\"Could not find NRST pin to cfg gate\");\n\n        pin.cfg = Some(quote! { #[cfg(feature = \"nrst-pin-as-gpio\")] });\n    }\n\n    let debugss = METADATA\n        .peripherals\n        .iter()\n        .find(|p| p.name == \"DEBUGSS\")\n        .expect(\"Could not find DEBUGSS peripheral\");\n\n    for pin in debugss.pins.iter() {","sourceCodeStart":494,"sourceCodeEnd":530,"githubUrl":"https://github.com/embassy-rs/embassy/blob/463a07b963419a1bfe61d5d597c44acb810afb8b/embassy-mspm0/build.rs#L494-L530","documentation":"In pin_features, the build script looks up the SYSCTL peripheral in the chip metadata and panics if it is absent. embassy-mspm0 requires a SYSCTL entry to implement NRST pin sharing logic (the nrst-pin-as-gpio feature), so a package without SYSCTL in its metadata cannot generate the pin feature code.","triggerScenarios":"Building embassy-mspm0 for a chip package whose peripheral list (from the generated/metadata data) does not contain a peripheral named exactly \"SYSCTL\", causing METADATA.peripherals.iter().find(...).expect(\"no SYSCTL peripheral\") to panic during generate_code -> pin_features.","commonSituations":"A newly added or unusual MSPM0 package missing the SYSCTL peripheral in its metadata; a metadata generation pipeline that dropped or renamed SYSCTL; editing the chip YAML and accidentally removing SYSCTL.","solutions":["Ensure the chip metadata (peripherals list) includes a peripheral named \"SYSCTL\" and rebuild.","Regenerate the metadata for your chip from the vendor SVD/datasheet so SYSCTL is captured.","If the chip truly lacks SYSCTL, guard the pin_features logic in build.rs with a check instead of expect and file an upstream issue."],"exampleFix":"// before\n.find(|p| p.name == \"SYSCTL\")\n.expect(\"no SYSCTL peripheral\");\n// after\n.find(|p| p.name == \"SYSCTL\");\nlet Some(sysctl) = sysctl else { return; };","handlingStrategy":"validation","validationCode":"// before building, check metadata contains SYSCTL\nassert!(metadata.peripherals.iter().any(|p| p.name == \"SYSCTL\"), \"chip metadata missing SYSCTL\");","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Never hand-remove peripherals from chip metadata without rebuilding.","Regenerate metadata with the official generator after SVD updates.","Lint generated metadata for required peripherals (SYSCTL, DEBUGSS)."],"tags":["build-script","embedded","metadata","panic","rust"],"backgroundTag":"resource-not-found","analyzedSha":"463a07b963419a1bfe61d5d597c44acb810afb8b","analyzedAt":"2026-09-10T13:38:26.660Z","contentChangedAt":"2026-09-10T13:38:26.660Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}