{"record":{"id":"e4c6f302e2194d13","repo":"embassy-rs/embassy","slug":"timer-does-not-exist","errorCode":null,"errorMessage":"Timer does not exist","messagePattern":"Timer does not exist","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"embassy-mspm0/build.rs","lineNumber":583,"sourceCode":"\n    quote! {\n        embassy_hal_internal::peripherals_definition!(#(#singletons_peripherals_def),*);\n        embassy_hal_internal::peripherals_struct!(#(#singletons_peripherals_struct),*);\n    }\n}\n\nfn generate_timers() -> TokenStream {\n    // Generate timers\n    let timer_impls = METADATA\n        .peripherals\n        .iter()\n        .filter(|p| p.name.starts_with(\"TIM\"))\n        .filter(|p| !p.name.starts_with(\"TIMB\"))\n        .map(|peripheral| {\n            let name = Ident::new(&peripheral.name, Span::call_site());\n            let timers = &*TIMERS;\n\n            let timer = timers.get(peripheral.name).expect(\"Timer does not exist\");\n            assert!(timer.bits == 16 || timer.bits == 32);\n            let bits = if timer.bits == 16 {\n                quote! { Bits16 }\n            } else {\n                quote! { Bits32 }\n            };\n\n            let mut impls = Vec::new();\n            let prescaler = timer.prescaler;\n            let channels = timer.ccp_channels_external;\n\n            impls.push(quote! {\n                impl_tim_instance!(\n                    #name,\n                    prescaler: #prescaler,\n                    width: #bits,\n                    channels: #channels\n                );","sourceCodeStart":565,"sourceCodeEnd":601,"githubUrl":"https://github.com/embassy-rs/embassy/blob/463a07b963419a1bfe61d5d597c44acb810afb8b/embassy-mspm0/build.rs#L565-L601","documentation":"generate_timers iterates every TIM* (non-TIMB) peripheral of the chip and looks up its configuration in the static TIMERS table, panicking if the timer model is unknown. The TIMERS map must contain an entry (bit width, capabilities) for every timer instance present in the package metadata.","triggerScenarios":"Building embassy-mspm0 for a package containing a TIM-prefixed peripheral (e.g. a newly added TIMG12 or another timer variant) that has no corresponding key in the build script's TIMERS map, during generate_code -> generate_timers.","commonSituations":"A new MSPM0 device family introduces a timer instance not yet listed in the TIMERS table; a metadata peripheral name spelling differs from the TIMERS keys; upstream added a chip before updating the timer table.","solutions":["Add an entry for the missing timer (with its bits/capabilities) to the TIMERS map in embassy-mspm0/build.rs.","Build against a chip variant whose timers are all covered by the TIMERS table.","Report the missing timer for your part number upstream so the table is extended."],"exampleFix":"// before (TIMERS map)\n\"TIMG0\": TimerInfo { bits: 16, .. },\n// after\n\"TIMG0\": TimerInfo { bits: 16, .. },\n\"TIMG12\": TimerInfo { bits: 32, .. },","handlingStrategy":"validation","validationCode":"// verify all TIM peripherals have a TIMERS entry before building\nlet missing: Vec<_> = metadata.peripherals.iter()\n    .filter(|p| p.name.starts_with(\"TIM\") && !p.name.starts_with(\"TIMB\"))\n    .filter(|p| !TIMERS.contains_key(p.name.as_str()))\n    .map(|p| p.name.clone()).collect();\nassert!(missing.is_empty(), \"timers missing from TIMERS map: {:?}\", missing);","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Update the TIMERS table whenever a new timer instance is added to chip support.","Smoke-build every newly added chip variant in CI.","Track upstream MSPM0 releases for new timer models."],"tags":["build-script","embedded","timer","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"}