diff options
| -rw-r--r-- | embassy-stm32/Cargo.toml | 131 | ||||
| -rw-r--r-- | embassy-stm32/build.rs | 137 | ||||
| -rw-r--r-- | embassy-stm32/src/exti.rs | 9 | ||||
| -rw-r--r-- | embassy-stm32/src/flash/common.rs | 2 | ||||
| -rw-r--r-- | embassy-stm32/src/flash/f4.rs | 4 | ||||
| -rw-r--r-- | embassy-stm32/src/flash/mod.rs | 3 | ||||
| -rw-r--r-- | embassy-stm32/src/gpio.rs | 6 |
7 files changed, 216 insertions, 76 deletions
diff --git a/embassy-stm32/Cargo.toml b/embassy-stm32/Cargo.toml index 30ea143c0..d66d3bc1d 100644 --- a/embassy-stm32/Cargo.toml +++ b/embassy-stm32/Cargo.toml | |||
| @@ -73,7 +73,7 @@ rand_core = "0.6.3" | |||
| 73 | sdio-host = "0.5.0" | 73 | sdio-host = "0.5.0" |
| 74 | critical-section = "1.1" | 74 | critical-section = "1.1" |
| 75 | #stm32-metapac = { version = "15" } | 75 | #stm32-metapac = { version = "15" } |
| 76 | stm32-metapac = { git = "https://github.com/embassy-rs/stm32-data-generated", tag = "stm32-data-274eeb0ed4477768d026276c4e9873586c1b9a05" } | 76 | stm32-metapac = { git = "https://github.com/embassy-rs/stm32-data-generated", tag = "stm32-data-fad4bc0f2baac29ecebb5153d2997b649b71025f" } |
| 77 | 77 | ||
| 78 | vcell = "0.1.3" | 78 | vcell = "0.1.3" |
| 79 | nb = "1.0.0" | 79 | nb = "1.0.0" |
| @@ -102,7 +102,7 @@ proc-macro2 = "1.0.36" | |||
| 102 | quote = "1.0.15" | 102 | quote = "1.0.15" |
| 103 | 103 | ||
| 104 | #stm32-metapac = { version = "15", default-features = false, features = ["metadata"]} | 104 | #stm32-metapac = { version = "15", default-features = false, features = ["metadata"]} |
| 105 | stm32-metapac = { git = "https://github.com/embassy-rs/stm32-data-generated", tag = "stm32-data-274eeb0ed4477768d026276c4e9873586c1b9a05", default-features = false, features = ["metadata"] } | 105 | stm32-metapac = { git = "https://github.com/embassy-rs/stm32-data-generated", tag = "stm32-data-fad4bc0f2baac29ecebb5153d2997b649b71025f", default-features = false, features = ["metadata"] } |
| 106 | 106 | ||
| 107 | [features] | 107 | [features] |
| 108 | default = ["rt"] | 108 | default = ["rt"] |
| @@ -127,8 +127,8 @@ exti = [] | |||
| 127 | low-power = [ "dep:embassy-executor", "embassy-executor?/arch-cortex-m", "time" ] | 127 | low-power = [ "dep:embassy-executor", "embassy-executor?/arch-cortex-m", "time" ] |
| 128 | low-power-debug-with-sleep = [] | 128 | low-power-debug-with-sleep = [] |
| 129 | 129 | ||
| 130 | ## Automatically generate `memory.x` file using [`stm32-metapac`](https://docs.rs/stm32-metapac/) | 130 | ## Automatically generate `memory.x` file based on the memory map from [`stm32-metapac`](https://docs.rs/stm32-metapac/) |
| 131 | memory-x = ["stm32-metapac/memory-x"] | 131 | memory-x = [] |
| 132 | 132 | ||
| 133 | ## Use secure registers when TrustZone is enabled | 133 | ## Use secure registers when TrustZone is enabled |
| 134 | trustzone-secure = [] | 134 | trustzone-secure = [] |
| @@ -202,6 +202,9 @@ _split-pins-enabled = [] | |||
| 202 | 202 | ||
| 203 | ## internal use only | 203 | ## internal use only |
| 204 | _dual-core = [] | 204 | _dual-core = [] |
| 205 | _core-cm0p = [] | ||
| 206 | _core-cm4 = [] | ||
| 207 | _core-cm7 = [] | ||
| 205 | 208 | ||
| 206 | #! ## Chip-selection features | 209 | #! ## Chip-selection features |
| 207 | #! Select your chip by specifying the model as a feature, e.g. `stm32c011d6`. | 210 | #! Select your chip by specifying the model as a feature, e.g. `stm32c011d6`. |
| @@ -1026,40 +1029,40 @@ stm32h743xg = [ "stm32-metapac/stm32h743xg" ] | |||
| 1026 | stm32h743xi = [ "stm32-metapac/stm32h743xi" ] | 1029 | stm32h743xi = [ "stm32-metapac/stm32h743xi" ] |
| 1027 | stm32h743zg = [ "stm32-metapac/stm32h743zg" ] | 1030 | stm32h743zg = [ "stm32-metapac/stm32h743zg" ] |
| 1028 | stm32h743zi = [ "stm32-metapac/stm32h743zi" ] | 1031 | stm32h743zi = [ "stm32-metapac/stm32h743zi" ] |
| 1029 | stm32h745bg-cm7 = [ "stm32-metapac/stm32h745bg-cm7", "_dual-core" ] | 1032 | stm32h745bg-cm7 = [ "stm32-metapac/stm32h745bg-cm7", "_dual-core", "_core-cm7" ] |
| 1030 | stm32h745bg-cm4 = [ "stm32-metapac/stm32h745bg-cm4", "_dual-core" ] | 1033 | stm32h745bg-cm4 = [ "stm32-metapac/stm32h745bg-cm4", "_dual-core", "_core-cm4" ] |
| 1031 | stm32h745bi-cm7 = [ "stm32-metapac/stm32h745bi-cm7", "_dual-core" ] | 1034 | stm32h745bi-cm7 = [ "stm32-metapac/stm32h745bi-cm7", "_dual-core", "_core-cm7" ] |
| 1032 | stm32h745bi-cm4 = [ "stm32-metapac/stm32h745bi-cm4", "_dual-core" ] | 1035 | stm32h745bi-cm4 = [ "stm32-metapac/stm32h745bi-cm4", "_dual-core", "_core-cm4" ] |
| 1033 | stm32h745ig-cm7 = [ "stm32-metapac/stm32h745ig-cm7", "_dual-core" ] | 1036 | stm32h745ig-cm7 = [ "stm32-metapac/stm32h745ig-cm7", "_dual-core", "_core-cm7" ] |
| 1034 | stm32h745ig-cm4 = [ "stm32-metapac/stm32h745ig-cm4", "_dual-core" ] | 1037 | stm32h745ig-cm4 = [ "stm32-metapac/stm32h745ig-cm4", "_dual-core", "_core-cm4" ] |
| 1035 | stm32h745ii-cm7 = [ "stm32-metapac/stm32h745ii-cm7", "_dual-core" ] | 1038 | stm32h745ii-cm7 = [ "stm32-metapac/stm32h745ii-cm7", "_dual-core", "_core-cm7" ] |
| 1036 | stm32h745ii-cm4 = [ "stm32-metapac/stm32h745ii-cm4", "_dual-core" ] | 1039 | stm32h745ii-cm4 = [ "stm32-metapac/stm32h745ii-cm4", "_dual-core", "_core-cm4" ] |
| 1037 | stm32h745xg-cm7 = [ "stm32-metapac/stm32h745xg-cm7", "_dual-core" ] | 1040 | stm32h745xg-cm7 = [ "stm32-metapac/stm32h745xg-cm7", "_dual-core", "_core-cm7" ] |
| 1038 | stm32h745xg-cm4 = [ "stm32-metapac/stm32h745xg-cm4", "_dual-core" ] | 1041 | stm32h745xg-cm4 = [ "stm32-metapac/stm32h745xg-cm4", "_dual-core", "_core-cm4" ] |
| 1039 | stm32h745xi-cm7 = [ "stm32-metapac/stm32h745xi-cm7", "_dual-core" ] | 1042 | stm32h745xi-cm7 = [ "stm32-metapac/stm32h745xi-cm7", "_dual-core", "_core-cm7" ] |
| 1040 | stm32h745xi-cm4 = [ "stm32-metapac/stm32h745xi-cm4", "_dual-core" ] | 1043 | stm32h745xi-cm4 = [ "stm32-metapac/stm32h745xi-cm4", "_dual-core", "_core-cm4" ] |
| 1041 | stm32h745zg-cm7 = [ "stm32-metapac/stm32h745zg-cm7", "_dual-core" ] | 1044 | stm32h745zg-cm7 = [ "stm32-metapac/stm32h745zg-cm7", "_dual-core", "_core-cm7" ] |
| 1042 | stm32h745zg-cm4 = [ "stm32-metapac/stm32h745zg-cm4", "_dual-core" ] | 1045 | stm32h745zg-cm4 = [ "stm32-metapac/stm32h745zg-cm4", "_dual-core", "_core-cm4" ] |
| 1043 | stm32h745zi-cm7 = [ "stm32-metapac/stm32h745zi-cm7", "_dual-core" ] | 1046 | stm32h745zi-cm7 = [ "stm32-metapac/stm32h745zi-cm7", "_dual-core", "_core-cm7" ] |
| 1044 | stm32h745zi-cm4 = [ "stm32-metapac/stm32h745zi-cm4", "_dual-core" ] | 1047 | stm32h745zi-cm4 = [ "stm32-metapac/stm32h745zi-cm4", "_dual-core", "_core-cm4" ] |
| 1045 | stm32h747ag-cm7 = [ "stm32-metapac/stm32h747ag-cm7", "_dual-core" ] | 1048 | stm32h747ag-cm7 = [ "stm32-metapac/stm32h747ag-cm7", "_dual-core", "_core-cm7" ] |
| 1046 | stm32h747ag-cm4 = [ "stm32-metapac/stm32h747ag-cm4", "_dual-core" ] | 1049 | stm32h747ag-cm4 = [ "stm32-metapac/stm32h747ag-cm4", "_dual-core", "_core-cm4" ] |
| 1047 | stm32h747ai-cm7 = [ "stm32-metapac/stm32h747ai-cm7", "_dual-core" ] | 1050 | stm32h747ai-cm7 = [ "stm32-metapac/stm32h747ai-cm7", "_dual-core", "_core-cm7" ] |
| 1048 | stm32h747ai-cm4 = [ "stm32-metapac/stm32h747ai-cm4", "_dual-core" ] | 1051 | stm32h747ai-cm4 = [ "stm32-metapac/stm32h747ai-cm4", "_dual-core", "_core-cm4" ] |
| 1049 | stm32h747bg-cm7 = [ "stm32-metapac/stm32h747bg-cm7", "_dual-core" ] | 1052 | stm32h747bg-cm7 = [ "stm32-metapac/stm32h747bg-cm7", "_dual-core", "_core-cm7" ] |
| 1050 | stm32h747bg-cm4 = [ "stm32-metapac/stm32h747bg-cm4", "_dual-core" ] | 1053 | stm32h747bg-cm4 = [ "stm32-metapac/stm32h747bg-cm4", "_dual-core", "_core-cm4" ] |
| 1051 | stm32h747bi-cm7 = [ "stm32-metapac/stm32h747bi-cm7", "_dual-core" ] | 1054 | stm32h747bi-cm7 = [ "stm32-metapac/stm32h747bi-cm7", "_dual-core", "_core-cm7" ] |
| 1052 | stm32h747bi-cm4 = [ "stm32-metapac/stm32h747bi-cm4", "_dual-core" ] | 1055 | stm32h747bi-cm4 = [ "stm32-metapac/stm32h747bi-cm4", "_dual-core", "_core-cm4" ] |
| 1053 | stm32h747ig-cm7 = [ "stm32-metapac/stm32h747ig-cm7", "_dual-core" ] | 1056 | stm32h747ig-cm7 = [ "stm32-metapac/stm32h747ig-cm7", "_dual-core", "_core-cm7" ] |
| 1054 | stm32h747ig-cm4 = [ "stm32-metapac/stm32h747ig-cm4", "_dual-core" ] | 1057 | stm32h747ig-cm4 = [ "stm32-metapac/stm32h747ig-cm4", "_dual-core", "_core-cm4" ] |
| 1055 | stm32h747ii-cm7 = [ "stm32-metapac/stm32h747ii-cm7", "_dual-core" ] | 1058 | stm32h747ii-cm7 = [ "stm32-metapac/stm32h747ii-cm7", "_dual-core", "_core-cm7" ] |
| 1056 | stm32h747ii-cm4 = [ "stm32-metapac/stm32h747ii-cm4", "_dual-core" ] | 1059 | stm32h747ii-cm4 = [ "stm32-metapac/stm32h747ii-cm4", "_dual-core", "_core-cm4" ] |
| 1057 | stm32h747xg-cm7 = [ "stm32-metapac/stm32h747xg-cm7", "_dual-core" ] | 1060 | stm32h747xg-cm7 = [ "stm32-metapac/stm32h747xg-cm7", "_dual-core", "_core-cm7" ] |
| 1058 | stm32h747xg-cm4 = [ "stm32-metapac/stm32h747xg-cm4", "_dual-core" ] | 1061 | stm32h747xg-cm4 = [ "stm32-metapac/stm32h747xg-cm4", "_dual-core", "_core-cm4" ] |
| 1059 | stm32h747xi-cm7 = [ "stm32-metapac/stm32h747xi-cm7", "_dual-core" ] | 1062 | stm32h747xi-cm7 = [ "stm32-metapac/stm32h747xi-cm7", "_dual-core", "_core-cm7" ] |
| 1060 | stm32h747xi-cm4 = [ "stm32-metapac/stm32h747xi-cm4", "_dual-core" ] | 1063 | stm32h747xi-cm4 = [ "stm32-metapac/stm32h747xi-cm4", "_dual-core", "_core-cm4" ] |
| 1061 | stm32h747zi-cm7 = [ "stm32-metapac/stm32h747zi-cm7", "_dual-core" ] | 1064 | stm32h747zi-cm7 = [ "stm32-metapac/stm32h747zi-cm7", "_dual-core", "_core-cm7" ] |
| 1062 | stm32h747zi-cm4 = [ "stm32-metapac/stm32h747zi-cm4", "_dual-core" ] | 1065 | stm32h747zi-cm4 = [ "stm32-metapac/stm32h747zi-cm4", "_dual-core", "_core-cm4" ] |
| 1063 | stm32h750ib = [ "stm32-metapac/stm32h750ib" ] | 1066 | stm32h750ib = [ "stm32-metapac/stm32h750ib" ] |
| 1064 | stm32h750vb = [ "stm32-metapac/stm32h750vb" ] | 1067 | stm32h750vb = [ "stm32-metapac/stm32h750vb" ] |
| 1065 | stm32h750xb = [ "stm32-metapac/stm32h750xb" ] | 1068 | stm32h750xb = [ "stm32-metapac/stm32h750xb" ] |
| @@ -1070,24 +1073,24 @@ stm32h753ii = [ "stm32-metapac/stm32h753ii" ] | |||
| 1070 | stm32h753vi = [ "stm32-metapac/stm32h753vi" ] | 1073 | stm32h753vi = [ "stm32-metapac/stm32h753vi" ] |
| 1071 | stm32h753xi = [ "stm32-metapac/stm32h753xi" ] | 1074 | stm32h753xi = [ "stm32-metapac/stm32h753xi" ] |
| 1072 | stm32h753zi = [ "stm32-metapac/stm32h753zi" ] | 1075 | stm32h753zi = [ "stm32-metapac/stm32h753zi" ] |
| 1073 | stm32h755bi-cm7 = [ "stm32-metapac/stm32h755bi-cm7", "_dual-core" ] | 1076 | stm32h755bi-cm7 = [ "stm32-metapac/stm32h755bi-cm7", "_dual-core", "_core-cm7" ] |
| 1074 | stm32h755bi-cm4 = [ "stm32-metapac/stm32h755bi-cm4", "_dual-core" ] | 1077 | stm32h755bi-cm4 = [ "stm32-metapac/stm32h755bi-cm4", "_dual-core", "_core-cm4" ] |
| 1075 | stm32h755ii-cm7 = [ "stm32-metapac/stm32h755ii-cm7", "_dual-core" ] | 1078 | stm32h755ii-cm7 = [ "stm32-metapac/stm32h755ii-cm7", "_dual-core", "_core-cm7" ] |
| 1076 | stm32h755ii-cm4 = [ "stm32-metapac/stm32h755ii-cm4", "_dual-core" ] | 1079 | stm32h755ii-cm4 = [ "stm32-metapac/stm32h755ii-cm4", "_dual-core", "_core-cm4" ] |
| 1077 | stm32h755xi-cm7 = [ "stm32-metapac/stm32h755xi-cm7", "_dual-core" ] | 1080 | stm32h755xi-cm7 = [ "stm32-metapac/stm32h755xi-cm7", "_dual-core", "_core-cm7" ] |
| 1078 | stm32h755xi-cm4 = [ "stm32-metapac/stm32h755xi-cm4", "_dual-core" ] | 1081 | stm32h755xi-cm4 = [ "stm32-metapac/stm32h755xi-cm4", "_dual-core", "_core-cm4" ] |
| 1079 | stm32h755zi-cm7 = [ "stm32-metapac/stm32h755zi-cm7", "_dual-core" ] | 1082 | stm32h755zi-cm7 = [ "stm32-metapac/stm32h755zi-cm7", "_dual-core", "_core-cm7" ] |
| 1080 | stm32h755zi-cm4 = [ "stm32-metapac/stm32h755zi-cm4", "_dual-core" ] | 1083 | stm32h755zi-cm4 = [ "stm32-metapac/stm32h755zi-cm4", "_dual-core", "_core-cm4" ] |
| 1081 | stm32h757ai-cm7 = [ "stm32-metapac/stm32h757ai-cm7", "_dual-core" ] | 1084 | stm32h757ai-cm7 = [ "stm32-metapac/stm32h757ai-cm7", "_dual-core", "_core-cm7" ] |
| 1082 | stm32h757ai-cm4 = [ "stm32-metapac/stm32h757ai-cm4", "_dual-core" ] | 1085 | stm32h757ai-cm4 = [ "stm32-metapac/stm32h757ai-cm4", "_dual-core", "_core-cm4" ] |
| 1083 | stm32h757bi-cm7 = [ "stm32-metapac/stm32h757bi-cm7", "_dual-core" ] | 1086 | stm32h757bi-cm7 = [ "stm32-metapac/stm32h757bi-cm7", "_dual-core", "_core-cm7" ] |
| 1084 | stm32h757bi-cm4 = [ "stm32-metapac/stm32h757bi-cm4", "_dual-core" ] | 1087 | stm32h757bi-cm4 = [ "stm32-metapac/stm32h757bi-cm4", "_dual-core", "_core-cm4" ] |
| 1085 | stm32h757ii-cm7 = [ "stm32-metapac/stm32h757ii-cm7", "_dual-core" ] | 1088 | stm32h757ii-cm7 = [ "stm32-metapac/stm32h757ii-cm7", "_dual-core", "_core-cm7" ] |
| 1086 | stm32h757ii-cm4 = [ "stm32-metapac/stm32h757ii-cm4", "_dual-core" ] | 1089 | stm32h757ii-cm4 = [ "stm32-metapac/stm32h757ii-cm4", "_dual-core", "_core-cm4" ] |
| 1087 | stm32h757xi-cm7 = [ "stm32-metapac/stm32h757xi-cm7", "_dual-core" ] | 1090 | stm32h757xi-cm7 = [ "stm32-metapac/stm32h757xi-cm7", "_dual-core", "_core-cm7" ] |
| 1088 | stm32h757xi-cm4 = [ "stm32-metapac/stm32h757xi-cm4", "_dual-core" ] | 1091 | stm32h757xi-cm4 = [ "stm32-metapac/stm32h757xi-cm4", "_dual-core", "_core-cm4" ] |
| 1089 | stm32h757zi-cm7 = [ "stm32-metapac/stm32h757zi-cm7", "_dual-core" ] | 1092 | stm32h757zi-cm7 = [ "stm32-metapac/stm32h757zi-cm7", "_dual-core", "_core-cm7" ] |
| 1090 | stm32h757zi-cm4 = [ "stm32-metapac/stm32h757zi-cm4", "_dual-core" ] | 1093 | stm32h757zi-cm4 = [ "stm32-metapac/stm32h757zi-cm4", "_dual-core", "_core-cm4" ] |
| 1091 | stm32h7a3ag = [ "stm32-metapac/stm32h7a3ag" ] | 1094 | stm32h7a3ag = [ "stm32-metapac/stm32h7a3ag" ] |
| 1092 | stm32h7a3ai = [ "stm32-metapac/stm32h7a3ai" ] | 1095 | stm32h7a3ai = [ "stm32-metapac/stm32h7a3ai" ] |
| 1093 | stm32h7a3ig = [ "stm32-metapac/stm32h7a3ig" ] | 1096 | stm32h7a3ig = [ "stm32-metapac/stm32h7a3ig" ] |
| @@ -1620,14 +1623,14 @@ stm32wba55he = [ "stm32-metapac/stm32wba55he" ] | |||
| 1620 | stm32wba55hg = [ "stm32-metapac/stm32wba55hg" ] | 1623 | stm32wba55hg = [ "stm32-metapac/stm32wba55hg" ] |
| 1621 | stm32wba55ue = [ "stm32-metapac/stm32wba55ue" ] | 1624 | stm32wba55ue = [ "stm32-metapac/stm32wba55ue" ] |
| 1622 | stm32wba55ug = [ "stm32-metapac/stm32wba55ug" ] | 1625 | stm32wba55ug = [ "stm32-metapac/stm32wba55ug" ] |
| 1623 | stm32wl54cc-cm4 = [ "stm32-metapac/stm32wl54cc-cm4", "_dual-core" ] | 1626 | stm32wl54cc-cm4 = [ "stm32-metapac/stm32wl54cc-cm4", "_dual-core", "_core-cm4" ] |
| 1624 | stm32wl54cc-cm0p = [ "stm32-metapac/stm32wl54cc-cm0p", "_dual-core" ] | 1627 | stm32wl54cc-cm0p = [ "stm32-metapac/stm32wl54cc-cm0p", "_dual-core", "_core-cm0p" ] |
| 1625 | stm32wl54jc-cm4 = [ "stm32-metapac/stm32wl54jc-cm4", "_dual-core" ] | 1628 | stm32wl54jc-cm4 = [ "stm32-metapac/stm32wl54jc-cm4", "_dual-core", "_core-cm4" ] |
| 1626 | stm32wl54jc-cm0p = [ "stm32-metapac/stm32wl54jc-cm0p", "_dual-core" ] | 1629 | stm32wl54jc-cm0p = [ "stm32-metapac/stm32wl54jc-cm0p", "_dual-core", "_core-cm0p" ] |
| 1627 | stm32wl55cc-cm4 = [ "stm32-metapac/stm32wl55cc-cm4", "_dual-core" ] | 1630 | stm32wl55cc-cm4 = [ "stm32-metapac/stm32wl55cc-cm4", "_dual-core", "_core-cm4" ] |
| 1628 | stm32wl55cc-cm0p = [ "stm32-metapac/stm32wl55cc-cm0p", "_dual-core" ] | 1631 | stm32wl55cc-cm0p = [ "stm32-metapac/stm32wl55cc-cm0p", "_dual-core", "_core-cm0p" ] |
| 1629 | stm32wl55jc-cm4 = [ "stm32-metapac/stm32wl55jc-cm4", "_dual-core" ] | 1632 | stm32wl55jc-cm4 = [ "stm32-metapac/stm32wl55jc-cm4", "_dual-core", "_core-cm4" ] |
| 1630 | stm32wl55jc-cm0p = [ "stm32-metapac/stm32wl55jc-cm0p", "_dual-core" ] | 1633 | stm32wl55jc-cm0p = [ "stm32-metapac/stm32wl55jc-cm0p", "_dual-core", "_core-cm0p" ] |
| 1631 | stm32wle4c8 = [ "stm32-metapac/stm32wle4c8" ] | 1634 | stm32wle4c8 = [ "stm32-metapac/stm32wle4c8" ] |
| 1632 | stm32wle4cb = [ "stm32-metapac/stm32wle4cb" ] | 1635 | stm32wle4cb = [ "stm32-metapac/stm32wle4cb" ] |
| 1633 | stm32wle4cc = [ "stm32-metapac/stm32wle4cc" ] | 1636 | stm32wle4cc = [ "stm32-metapac/stm32wle4cc" ] |
diff --git a/embassy-stm32/build.rs b/embassy-stm32/build.rs index e293cf965..43bbef7e4 100644 --- a/embassy-stm32/build.rs +++ b/embassy-stm32/build.rs | |||
| @@ -9,8 +9,8 @@ use proc_macro2::{Ident, TokenStream}; | |||
| 9 | use quote::{format_ident, quote}; | 9 | use quote::{format_ident, quote}; |
| 10 | use stm32_metapac::metadata::ir::BitOffset; | 10 | use stm32_metapac::metadata::ir::BitOffset; |
| 11 | use stm32_metapac::metadata::{ | 11 | use stm32_metapac::metadata::{ |
| 12 | MemoryRegionKind, PeripheralRccKernelClock, PeripheralRccRegister, PeripheralRegisters, StopMode, ALL_CHIPS, | 12 | MemoryRegion, MemoryRegionKind, PeripheralRccKernelClock, PeripheralRccRegister, PeripheralRegisters, StopMode, |
| 13 | ALL_PERIPHERAL_VERSIONS, METADATA, | 13 | ALL_CHIPS, ALL_PERIPHERAL_VERSIONS, METADATA, |
| 14 | }; | 14 | }; |
| 15 | 15 | ||
| 16 | #[path = "./build_common.rs"] | 16 | #[path = "./build_common.rs"] |
| @@ -1678,6 +1678,59 @@ fn main() { | |||
| 1678 | pub(crate) const DMA_CHANNELS: &[crate::dma::ChannelInfo] = &[#dmas]; | 1678 | pub(crate) const DMA_CHANNELS: &[crate::dma::ChannelInfo] = &[#dmas]; |
| 1679 | }); | 1679 | }); |
| 1680 | 1680 | ||
| 1681 | // ======== | ||
| 1682 | // Generate gpio_block() function | ||
| 1683 | |||
| 1684 | let gpio_base = METADATA.peripherals.iter().find(|p| p.name == "GPIOA").unwrap().address as usize; | ||
| 1685 | let gpio_stride = 0x400 as usize; | ||
| 1686 | |||
| 1687 | for p in METADATA.peripherals { | ||
| 1688 | if let Some(bi) = &p.registers { | ||
| 1689 | if bi.kind == "gpio" { | ||
| 1690 | assert_eq!(0, (p.address as usize - gpio_base) % gpio_stride); | ||
| 1691 | } | ||
| 1692 | } | ||
| 1693 | } | ||
| 1694 | |||
| 1695 | g.extend(quote!( | ||
| 1696 | pub fn gpio_block(n: usize) -> crate::pac::gpio::Gpio {{ | ||
| 1697 | unsafe {{ crate::pac::gpio::Gpio::from_ptr((#gpio_base + #gpio_stride*n) as _) }} | ||
| 1698 | }} | ||
| 1699 | )); | ||
| 1700 | |||
| 1701 | // ======== | ||
| 1702 | // Generate flash constants | ||
| 1703 | |||
| 1704 | let flash_regions: Vec<&MemoryRegion> = METADATA | ||
| 1705 | .memory | ||
| 1706 | .iter() | ||
| 1707 | .filter(|x| x.kind == MemoryRegionKind::Flash && x.name.starts_with("BANK_")) | ||
| 1708 | .collect(); | ||
| 1709 | let first_flash = flash_regions.first().unwrap(); | ||
| 1710 | let total_flash_size = flash_regions | ||
| 1711 | .iter() | ||
| 1712 | .map(|x| x.size) | ||
| 1713 | .reduce(|acc, item| acc + item) | ||
| 1714 | .unwrap(); | ||
| 1715 | let write_sizes: HashSet<_> = flash_regions | ||
| 1716 | .iter() | ||
| 1717 | .map(|r| r.settings.as_ref().unwrap().write_size) | ||
| 1718 | .collect(); | ||
| 1719 | assert_eq!(1, write_sizes.len()); | ||
| 1720 | |||
| 1721 | let flash_base = first_flash.address as usize; | ||
| 1722 | let total_flash_size = total_flash_size as usize; | ||
| 1723 | let write_size = (*write_sizes.iter().next().unwrap()) as usize; | ||
| 1724 | |||
| 1725 | g.extend(quote!( | ||
| 1726 | pub const FLASH_BASE: usize = #flash_base; | ||
| 1727 | pub const FLASH_SIZE: usize = #total_flash_size; | ||
| 1728 | pub const WRITE_SIZE: usize = #write_size; | ||
| 1729 | )); | ||
| 1730 | |||
| 1731 | // ======== | ||
| 1732 | // Generate macro-tables | ||
| 1733 | |||
| 1681 | for irq in METADATA.interrupts { | 1734 | for irq in METADATA.interrupts { |
| 1682 | let name = irq.name.to_ascii_uppercase(); | 1735 | let name = irq.name.to_ascii_uppercase(); |
| 1683 | interrupts_table.push(vec![name.clone()]); | 1736 | interrupts_table.push(vec![name.clone()]); |
| @@ -1772,6 +1825,11 @@ fn main() { | |||
| 1772 | } | 1825 | } |
| 1773 | 1826 | ||
| 1774 | println!("cargo:rerun-if-changed=build.rs"); | 1827 | println!("cargo:rerun-if-changed=build.rs"); |
| 1828 | |||
| 1829 | if cfg!(feature = "memory-x") { | ||
| 1830 | gen_memory_x(out_dir); | ||
| 1831 | println!("cargo:rustc-link-search={}", out_dir.display()); | ||
| 1832 | } | ||
| 1775 | } | 1833 | } |
| 1776 | 1834 | ||
| 1777 | enum GetOneError { | 1835 | enum GetOneError { |
| @@ -1857,3 +1915,78 @@ fn rustfmt(path: impl AsRef<Path>) { | |||
| 1857 | } | 1915 | } |
| 1858 | } | 1916 | } |
| 1859 | } | 1917 | } |
| 1918 | |||
| 1919 | fn gen_memory_x(out_dir: &Path) { | ||
| 1920 | let mut memory_x = String::new(); | ||
| 1921 | |||
| 1922 | let flash = get_memory_range(MemoryRegionKind::Flash); | ||
| 1923 | let ram = get_memory_range(MemoryRegionKind::Ram); | ||
| 1924 | |||
| 1925 | write!(memory_x, "MEMORY\n{{\n").unwrap(); | ||
| 1926 | writeln!( | ||
| 1927 | memory_x, | ||
| 1928 | " FLASH : ORIGIN = 0x{:08x}, LENGTH = {:>4}K /* {} */", | ||
| 1929 | flash.0, | ||
| 1930 | flash.1 / 1024, | ||
| 1931 | flash.2 | ||
| 1932 | ) | ||
| 1933 | .unwrap(); | ||
| 1934 | writeln!( | ||
| 1935 | memory_x, | ||
| 1936 | " RAM : ORIGIN = 0x{:08x}, LENGTH = {:>4}K /* {} */", | ||
| 1937 | ram.0, | ||
| 1938 | ram.1 / 1024, | ||
| 1939 | ram.2 | ||
| 1940 | ) | ||
| 1941 | .unwrap(); | ||
| 1942 | write!(memory_x, "}}").unwrap(); | ||
| 1943 | |||
| 1944 | std::fs::write(out_dir.join("memory.x"), memory_x.as_bytes()).unwrap(); | ||
| 1945 | } | ||
| 1946 | |||
| 1947 | fn get_memory_range(kind: MemoryRegionKind) -> (u32, u32, String) { | ||
| 1948 | let mut mems: Vec<_> = METADATA | ||
| 1949 | .memory | ||
| 1950 | .iter() | ||
| 1951 | .filter(|m| m.kind == kind && m.size != 0) | ||
| 1952 | .collect(); | ||
| 1953 | mems.sort_by_key(|m| m.address); | ||
| 1954 | |||
| 1955 | let mut start = u32::MAX; | ||
| 1956 | let mut end = u32::MAX; | ||
| 1957 | let mut names = Vec::new(); | ||
| 1958 | let mut best: Option<(u32, u32, String)> = None; | ||
| 1959 | for m in mems { | ||
| 1960 | if !mem_filter(&METADATA.name, &m.name) { | ||
| 1961 | continue; | ||
| 1962 | } | ||
| 1963 | |||
| 1964 | if m.address != end { | ||
| 1965 | names = Vec::new(); | ||
| 1966 | start = m.address; | ||
| 1967 | end = m.address; | ||
| 1968 | } | ||
| 1969 | |||
| 1970 | end += m.size; | ||
| 1971 | names.push(m.name.to_string()); | ||
| 1972 | |||
| 1973 | if best.is_none() || end - start > best.as_ref().unwrap().1 { | ||
| 1974 | best = Some((start, end - start, names.join(" + "))); | ||
| 1975 | } | ||
| 1976 | } | ||
| 1977 | |||
| 1978 | best.unwrap() | ||
| 1979 | } | ||
| 1980 | |||
| 1981 | fn mem_filter(chip: &str, region: &str) -> bool { | ||
| 1982 | // in STM32WB, SRAM2a/SRAM2b are reserved for the radio core. | ||
| 1983 | if chip.starts_with("STM32WB") | ||
| 1984 | && !chip.starts_with("STM32WBA") | ||
| 1985 | && !chip.starts_with("STM32WB0") | ||
| 1986 | && region.starts_with("SRAM2") | ||
| 1987 | { | ||
| 1988 | return false; | ||
| 1989 | } | ||
| 1990 | |||
| 1991 | true | ||
| 1992 | } | ||
diff --git a/embassy-stm32/src/exti.rs b/embassy-stm32/src/exti.rs index 5cff74264..9604c5149 100644 --- a/embassy-stm32/src/exti.rs +++ b/embassy-stm32/src/exti.rs | |||
| @@ -16,9 +16,14 @@ use crate::{interrupt, pac, peripherals, Peripheral}; | |||
| 16 | const EXTI_COUNT: usize = 16; | 16 | const EXTI_COUNT: usize = 16; |
| 17 | static EXTI_WAKERS: [AtomicWaker; EXTI_COUNT] = [const { AtomicWaker::new() }; EXTI_COUNT]; | 17 | static EXTI_WAKERS: [AtomicWaker; EXTI_COUNT] = [const { AtomicWaker::new() }; EXTI_COUNT]; |
| 18 | 18 | ||
| 19 | #[cfg(exti_w)] | 19 | #[cfg(all(exti_w, feature = "_core-cm0p"))] |
| 20 | fn cpu_regs() -> pac::exti::Cpu { | 20 | fn cpu_regs() -> pac::exti::Cpu { |
| 21 | EXTI.cpu(crate::pac::CORE_INDEX) | 21 | EXTI.cpu(1) |
| 22 | } | ||
| 23 | |||
| 24 | #[cfg(all(exti_w, not(feature = "_core-cm0p")))] | ||
| 25 | fn cpu_regs() -> pac::exti::Cpu { | ||
| 26 | EXTI.cpu(0) | ||
| 22 | } | 27 | } |
| 23 | 28 | ||
| 24 | #[cfg(not(exti_w))] | 29 | #[cfg(not(exti_w))] |
diff --git a/embassy-stm32/src/flash/common.rs b/embassy-stm32/src/flash/common.rs index 8ec4bb2a1..0004a7488 100644 --- a/embassy-stm32/src/flash/common.rs +++ b/embassy-stm32/src/flash/common.rs | |||
| @@ -3,12 +3,12 @@ use core::sync::atomic::{fence, Ordering}; | |||
| 3 | 3 | ||
| 4 | use embassy_hal_internal::drop::OnDrop; | 4 | use embassy_hal_internal::drop::OnDrop; |
| 5 | use embassy_hal_internal::{into_ref, PeripheralRef}; | 5 | use embassy_hal_internal::{into_ref, PeripheralRef}; |
| 6 | use stm32_metapac::FLASH_BASE; | ||
| 7 | 6 | ||
| 8 | use super::{ | 7 | use super::{ |
| 9 | family, Async, Blocking, Error, FlashBank, FlashLayout, FlashRegion, FlashSector, FLASH_SIZE, MAX_ERASE_SIZE, | 8 | family, Async, Blocking, Error, FlashBank, FlashLayout, FlashRegion, FlashSector, FLASH_SIZE, MAX_ERASE_SIZE, |
| 10 | READ_SIZE, WRITE_SIZE, | 9 | READ_SIZE, WRITE_SIZE, |
| 11 | }; | 10 | }; |
| 11 | use crate::_generated::FLASH_BASE; | ||
| 12 | use crate::peripherals::FLASH; | 12 | use crate::peripherals::FLASH; |
| 13 | use crate::Peripheral; | 13 | use crate::Peripheral; |
| 14 | 14 | ||
diff --git a/embassy-stm32/src/flash/f4.rs b/embassy-stm32/src/flash/f4.rs index 8ebeae95b..d818c77d0 100644 --- a/embassy-stm32/src/flash/f4.rs +++ b/embassy-stm32/src/flash/f4.rs | |||
| @@ -3,9 +3,9 @@ use core::sync::atomic::{fence, AtomicBool, Ordering}; | |||
| 3 | 3 | ||
| 4 | use embassy_sync::waitqueue::AtomicWaker; | 4 | use embassy_sync::waitqueue::AtomicWaker; |
| 5 | use pac::flash::regs::Sr; | 5 | use pac::flash::regs::Sr; |
| 6 | use pac::FLASH_SIZE; | ||
| 7 | 6 | ||
| 8 | use super::{FlashBank, FlashRegion, FlashSector, FLASH_REGIONS, WRITE_SIZE}; | 7 | use super::{FlashBank, FlashRegion, FlashSector, FLASH_REGIONS, WRITE_SIZE}; |
| 8 | use crate::_generated::FLASH_SIZE; | ||
| 9 | use crate::flash::Error; | 9 | use crate::flash::Error; |
| 10 | use crate::pac; | 10 | use crate::pac; |
| 11 | #[allow(missing_docs)] // TODO | 11 | #[allow(missing_docs)] // TODO |
| @@ -14,9 +14,9 @@ mod alt_regions { | |||
| 14 | use core::marker::PhantomData; | 14 | use core::marker::PhantomData; |
| 15 | 15 | ||
| 16 | use embassy_hal_internal::PeripheralRef; | 16 | use embassy_hal_internal::PeripheralRef; |
| 17 | use stm32_metapac::FLASH_SIZE; | ||
| 18 | 17 | ||
| 19 | use crate::_generated::flash_regions::{BANK1_REGION1, BANK1_REGION2, BANK1_REGION3}; | 18 | use crate::_generated::flash_regions::{BANK1_REGION1, BANK1_REGION2, BANK1_REGION3}; |
| 19 | use crate::_generated::FLASH_SIZE; | ||
| 20 | use crate::flash::{asynch, Async, Bank1Region1, Bank1Region2, Blocking, Error, Flash, FlashBank, FlashRegion}; | 20 | use crate::flash::{asynch, Async, Bank1Region1, Bank1Region2, Blocking, Error, Flash, FlashBank, FlashRegion}; |
| 21 | use crate::peripherals::FLASH; | 21 | use crate::peripherals::FLASH; |
| 22 | 22 | ||
diff --git a/embassy-stm32/src/flash/mod.rs b/embassy-stm32/src/flash/mod.rs index aef1f1482..b564de093 100644 --- a/embassy-stm32/src/flash/mod.rs +++ b/embassy-stm32/src/flash/mod.rs | |||
| @@ -12,8 +12,7 @@ pub use asynch::InterruptHandler; | |||
| 12 | pub use common::*; | 12 | pub use common::*; |
| 13 | 13 | ||
| 14 | pub use crate::_generated::flash_regions::*; | 14 | pub use crate::_generated::flash_regions::*; |
| 15 | pub use crate::_generated::MAX_ERASE_SIZE; | 15 | pub use crate::_generated::{FLASH_BASE, FLASH_SIZE, MAX_ERASE_SIZE, WRITE_SIZE}; |
| 16 | pub use crate::pac::{FLASH_BASE, FLASH_SIZE, WRITE_SIZE}; | ||
| 17 | 16 | ||
| 18 | /// Get whether the default flash layout is being used. | 17 | /// Get whether the default flash layout is being used. |
| 19 | /// | 18 | /// |
diff --git a/embassy-stm32/src/gpio.rs b/embassy-stm32/src/gpio.rs index 6967ecc7c..65e1bfb8c 100644 --- a/embassy-stm32/src/gpio.rs +++ b/embassy-stm32/src/gpio.rs | |||
| @@ -7,7 +7,7 @@ use critical_section::CriticalSection; | |||
| 7 | use embassy_hal_internal::{impl_peripheral, into_ref, PeripheralRef}; | 7 | use embassy_hal_internal::{impl_peripheral, into_ref, PeripheralRef}; |
| 8 | 8 | ||
| 9 | use crate::pac::gpio::{self, vals}; | 9 | use crate::pac::gpio::{self, vals}; |
| 10 | use crate::{pac, peripherals, Peripheral}; | 10 | use crate::{peripherals, Peripheral}; |
| 11 | 11 | ||
| 12 | /// GPIO flexible pin. | 12 | /// GPIO flexible pin. |
| 13 | /// | 13 | /// |
| @@ -726,7 +726,7 @@ pub(crate) trait SealedPin { | |||
| 726 | 726 | ||
| 727 | #[inline] | 727 | #[inline] |
| 728 | fn block(&self) -> gpio::Gpio { | 728 | fn block(&self) -> gpio::Gpio { |
| 729 | pac::GPIO(self._port() as _) | 729 | crate::_generated::gpio_block(self._port() as _) |
| 730 | } | 730 | } |
| 731 | 731 | ||
| 732 | /// Set the output as high. | 732 | /// Set the output as high. |
| @@ -835,7 +835,7 @@ impl AnyPin { | |||
| 835 | #[cfg(feature = "unstable-pac")] | 835 | #[cfg(feature = "unstable-pac")] |
| 836 | #[inline] | 836 | #[inline] |
| 837 | pub fn block(&self) -> gpio::Gpio { | 837 | pub fn block(&self) -> gpio::Gpio { |
| 838 | pac::GPIO(self._port() as _) | 838 | crate::_generated::gpio_block(self._port() as _) |
| 839 | } | 839 | } |
| 840 | } | 840 | } |
| 841 | 841 | ||
