{"record":{"id":"14e6a3a3909fcdf4","repo":"embassy-rs/embassy","slug":"could-not-find-debugss-peripheral","errorCode":null,"errorMessage":"Could not find DEBUGSS peripheral","messagePattern":"Could not find DEBUGSS peripheral","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"embassy-mspm0/build.rs","lineNumber":528,"sourceCode":"        .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() {\n        let pin = singletons\n            .iter_mut()\n            .find(|s| s.name == pin.pin)\n            .expect(\"Could not find SWD pin to cfg gate\");\n\n        pin.cfg = Some(quote! { #[cfg(feature = \"swd-pins-as-gpio\")] });\n    }\n}\n\nfn generate_singletons(singletons: &[Singleton]) -> TokenStream {\n    let singletons_peripherals_struct = singletons\n        .iter()\n        .map(|s| {\n            let cfg = s.cfg.clone().unwrap_or_default();\n\n            let ident = format_ident!(\"{}\", s.name);","sourceCodeStart":510,"sourceCodeEnd":546,"githubUrl":"https://github.com/embassy-rs/embassy/blob/463a07b963419a1bfe61d5d597c44acb810afb8b/embassy-mspm0/build.rs#L510-L546","documentation":"pin_features then looks up the DEBUGSS peripheral in the chip metadata to gate SWD pins behind the swd-pins-as-gpio feature, and panics when DEBUGSS is missing. Every supported MSPM0 package is expected to expose a DEBUGSS entry describing the SWD/swap pins.","triggerScenarios":"Building embassy-mspm0 for a package whose metadata peripheral list lacks an entry named \"DEBUGSS\", so METADATA.peripherals.iter().find(|p| p.name == \"DEBUGSS\").expect(...) panics in generate_code -> pin_features.","commonSituations":"Metadata for a new MSPM0 variant that omits the DEBUGSS peripheral; a metadata regeneration tool that skips debug subsystem entries; hand-trimming the peripheral list and removing DEBUGSS.","solutions":["Add the DEBUGSS peripheral (with its SWCLK/SWDIO pin signals) to the chip metadata and rebuild.","Regenerate the chip metadata so the debug subsystem is included.","If upstream metadata is at fault, report it so the generator emits DEBUGSS for this package."],"exampleFix":"// before: peripherals list without DEBUGSS\n// after (metadata YAML)\n- name: DEBUGSS\n  pins:\n    - { signal: SWCLK, pin: PA20 }\n    - { signal: SWDIO, pin: PA19 }","handlingStrategy":"validation","validationCode":"assert!(metadata.peripherals.iter().any(|p| p.name == \"DEBUGSS\"), \"chip metadata missing DEBUGSS\");","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always include the debug subsystem (DEBUGSS) when generating chip metadata.","Run a metadata completeness check listing required peripherals per family.","Re-generate metadata rather than hand-editing peripheral lists."],"tags":["build-script","embedded","debug","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"}