aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam Greig <[email protected]>2023-11-19 03:06:30 +0000
committerDario Nieuwenhuis <[email protected]>2023-11-25 00:29:45 +0100
commit2218d30c8039b994ead02acc26130d25599d78ac (patch)
tree076bdce6cec3306e96792ba98c4f916af65cd8f8
parentf5c9e3baa6615928f948cf9ae4c03123d2d84cbc (diff)
STM32: Remove vestigal build.rs cfgs, add new flashsize_X and package_X cfgs, use in F3 RCC
-rw-r--r--embassy-stm32/build.rs18
-rw-r--r--embassy-stm32/src/rcc/f3.rs5
2 files changed, 5 insertions, 18 deletions
diff --git a/embassy-stm32/build.rs b/embassy-stm32/build.rs
index 4aae58229..d92d92174 100644
--- a/embassy-stm32/build.rs
+++ b/embassy-stm32/build.rs
@@ -65,7 +65,6 @@ fn main() {
65 match r.kind { 65 match r.kind {
66 // Generate singletons per pin, not per port 66 // Generate singletons per pin, not per port
67 "gpio" => { 67 "gpio" => {
68 println!("{}", p.name);
69 let port_letter = p.name.strip_prefix("GPIO").unwrap(); 68 let port_letter = p.name.strip_prefix("GPIO").unwrap();
70 for pin_num in 0..16 { 69 for pin_num in 0..16 {
71 singletons.push(format!("P{}{}", port_letter, pin_num)); 70 singletons.push(format!("P{}{}", port_letter, pin_num));
@@ -1352,15 +1351,6 @@ fn main() {
1352 1351
1353 if let Some(core) = core_name { 1352 if let Some(core) = core_name {
1354 println!("cargo:rustc-cfg={}_{}", &chip_name[..chip_name.len() - 2], core); 1353 println!("cargo:rustc-cfg={}_{}", &chip_name[..chip_name.len() - 2], core);
1355 } else {
1356 println!("cargo:rustc-cfg={}", &chip_name[..chip_name.len() - 2]);
1357 }
1358
1359 // ========
1360 // stm32f3 wildcard features used in RCC
1361
1362 if chip_name.starts_with("stm32f3") {
1363 println!("cargo:rustc-cfg={}x{}", &chip_name[..9], &chip_name[10..11]);
1364 } 1354 }
1365 1355
1366 // ======= 1356 // =======
@@ -1375,17 +1365,17 @@ fn main() {
1375 if &chip_name[..8] == "stm32wba" { 1365 if &chip_name[..8] == "stm32wba" {
1376 println!("cargo:rustc-cfg={}", &chip_name[..8]); // stm32wba 1366 println!("cargo:rustc-cfg={}", &chip_name[..8]); // stm32wba
1377 println!("cargo:rustc-cfg={}", &chip_name[..10]); // stm32wba52 1367 println!("cargo:rustc-cfg={}", &chip_name[..10]); // stm32wba52
1368 println!("cargo:rustc-cfg=package_{}", &chip_name[10..11]);
1369 println!("cargo:rustc-cfg=flashsize_{}", &chip_name[11..12]);
1378 } else { 1370 } else {
1379 println!("cargo:rustc-cfg={}", &chip_name[..7]); // stm32f4 1371 println!("cargo:rustc-cfg={}", &chip_name[..7]); // stm32f4
1380 println!("cargo:rustc-cfg={}", &chip_name[..9]); // stm32f429 1372 println!("cargo:rustc-cfg={}", &chip_name[..9]); // stm32f429
1381 println!("cargo:rustc-cfg={}x", &chip_name[..8]); // stm32f42x 1373 println!("cargo:rustc-cfg={}x", &chip_name[..8]); // stm32f42x
1382 println!("cargo:rustc-cfg={}x{}", &chip_name[..7], &chip_name[8..9]); // stm32f4x9 1374 println!("cargo:rustc-cfg={}x{}", &chip_name[..7], &chip_name[8..9]); // stm32f4x9
1375 println!("cargo:rustc-cfg=package_{}", &chip_name[9..10]);
1376 println!("cargo:rustc-cfg=flashsize_{}", &chip_name[10..11]);
1383 } 1377 }
1384 1378
1385 // Handle time-driver-XXXX features.
1386 if env::var("CARGO_FEATURE_TIME_DRIVER_ANY").is_ok() {}
1387 println!("cargo:rustc-cfg={}", &chip_name[..chip_name.len() - 2]);
1388
1389 println!("cargo:rerun-if-changed=build.rs"); 1379 println!("cargo:rerun-if-changed=build.rs");
1390} 1380}
1391 1381
diff --git a/embassy-stm32/src/rcc/f3.rs b/embassy-stm32/src/rcc/f3.rs
index 9dcd50df4..bf035fd25 100644
--- a/embassy-stm32/src/rcc/f3.rs
+++ b/embassy-stm32/src/rcc/f3.rs
@@ -346,10 +346,7 @@ fn calc_pll(config: &Config, Hertz(sysclk): Hertz) -> (Hertz, PllConfig) {
346 None => { 346 None => {
347 cfg_if::cfg_if! { 347 cfg_if::cfg_if! {
348 // For some chips PREDIV is always two, and cannot be changed 348 // For some chips PREDIV is always two, and cannot be changed
349 if #[cfg(any( 349 if #[cfg(any(flashsize_d, flashsize_e))] {
350 stm32f302xd, stm32f302xe, stm32f303xd,
351 stm32f303xe, stm32f398xe
352 ))] {
353 let (multiplier, divisor) = get_mul_div(sysclk, HSI_FREQ.0); 350 let (multiplier, divisor) = get_mul_div(sysclk, HSI_FREQ.0);
354 ( 351 (
355 Hertz((HSI_FREQ.0 / divisor) * multiplier), 352 Hertz((HSI_FREQ.0 / divisor) * multiplier),