diff options
| author | Ulf Lilleengen <[email protected]> | 2021-09-15 13:35:00 +0200 |
|---|---|---|
| committer | Ulf Lilleengen <[email protected]> | 2021-09-15 13:58:01 +0200 |
| commit | 840a83e196ecf698399ca38466087050ca5b15f1 (patch) | |
| tree | 4efe5084a77b61efe60560d5e731ad9f0fbdadf1 | |
| parent | fb697a265752644d835edce27efbb20d5557b297 (diff) | |
Add support for chip definitions with a dash
| -rw-r--r-- | stm32-metapac-gen/src/lib.rs | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/stm32-metapac-gen/src/lib.rs b/stm32-metapac-gen/src/lib.rs index 390793a5d..e802ba4ff 100644 --- a/stm32-metapac-gen/src/lib.rs +++ b/stm32-metapac-gen/src/lib.rs | |||
| @@ -214,8 +214,20 @@ pub fn gen(options: Options) { | |||
| 214 | 214 | ||
| 215 | for chip_name in &options.chips { | 215 | for chip_name in &options.chips { |
| 216 | let mut s = chip_name.split('_'); | 216 | let mut s = chip_name.split('_'); |
| 217 | let chip_name: &str = s.next().unwrap(); | 217 | let mut chip_name: String = s.next().unwrap().to_string(); |
| 218 | let core_name: Option<&str> = s.next(); | 218 | let core_name: Option<&str> = if let Some(c) = s.next() { |
| 219 | if !c.starts_with("CM") { | ||
| 220 | println!("Core not detected, adding as variant"); | ||
| 221 | chip_name.push_str("-"); | ||
| 222 | chip_name.push_str(c); | ||
| 223 | None | ||
| 224 | } else { | ||
| 225 | println!("Detected core {}", c); | ||
| 226 | Some(c) | ||
| 227 | } | ||
| 228 | } else { | ||
| 229 | None | ||
| 230 | }; | ||
| 219 | 231 | ||
| 220 | chip_cores.insert( | 232 | chip_cores.insert( |
| 221 | chip_name.to_string(), | 233 | chip_name.to_string(), |
