-
Notifications
You must be signed in to change notification settings - Fork 651
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
1803: refactor stmf32f4xx chip code into multiple crates r=hudson-ayers a=hudson-ayers ### Pull Request Overview This pull request refactors the `stm32f4xx` code into three crates. In addition to the base crate, it adds two new crates -- `stm32f446re` and `stm32429zi` -- which contain all code specific to those chip versions. So far, that is just a few NVIC IDs and the `IRQS` array. Importantly, this PR removes any need for cargo features (`#[cfg( feature = x)]` statements) for functionality which differs between these two chips. It also absolves any need for `cfg_if!()` or other similar approach to enable clippy to pass on these crates, so I am closing #1794 in favor of this. ### Testing Strategy This pull request was tested by travis-ci and clippy. I do not have any nucleo boards, so I can't test this on hardware. ### TODO or Help Wanted My approach to separating out the NVIC ids was to leave the shared IDs in `stm32f4xx/src/nvic.rs` and put chip-specific IDs in `stm32f446re/src/stm32f446re_nvic.rs and stm32f429zi/src/stm32f429zi_nvic.rs`. We don't currently use any of the chip-specific IDs, so the usability of this approach is pretty untested -- I think we would have to turn to something similar to the `interrupt_service` trait used by the `nrf52` family of chips. ### Documentation Updated - [x] I updated all doc tests that used `stm32f4xx`, and didn't see any other documentation that needs updating, but could have missed something. ### Formatting - [x] Ran `make formatall`. Co-authored-by: Hudson Ayers <hayers@stanford.edu>
- Loading branch information
Showing
23 changed files
with
435 additions
and
402 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
[package] | ||
name = "stm32f429zi" | ||
version = "0.1.0" | ||
authors = ["Tock Project Developers <tock-dev@googlegroups.com>"] | ||
edition = "2018" | ||
|
||
[dependencies] | ||
cortexm4 = { path = "../../arch/cortex-m4" } | ||
kernel = { path = "../../kernel" } | ||
stm32f4xx = { path = "../stm32f4xx" } | ||
tock_rt0 = { path = "../../libraries/tock-rt0" } | ||
enum_primitive = { path = "../../libraries/enum_primitive" } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# ST Micro stm32f429zi MCU | ||
|
||
Builds upon the `stm32f4xx` crate and includes hardware setup that is specific to this version of | ||
the stm32f4xx series. Boards that include an stm32f429zi MCU should use this crate as a dependency | ||
and not the `stm32f4xx` crate. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
use cortexm4::generic_isr; | ||
|
||
// STM32F42xxx and STM32F43xxx has total of 91 interrupts | ||
#[cfg_attr(all(target_arch = "arm", target_os = "none"), link_section = ".irqs")] | ||
// used Ensures that the symbol is kept until the final binary | ||
#[cfg_attr(all(target_arch = "arm", target_os = "none"), used)] | ||
pub static IRQS: [unsafe extern "C" fn(); 91] = [ | ||
generic_isr, // WWDG (0) | ||
generic_isr, // PVD (1) | ||
generic_isr, // TAMP_STAMP (2) | ||
generic_isr, // RTC_WKUP (3) | ||
generic_isr, // FLASH (4) | ||
generic_isr, // RCC (5) | ||
generic_isr, // EXTI0 (6) | ||
generic_isr, // EXTI1 (7) | ||
generic_isr, // EXTI2 (8) | ||
generic_isr, // EXTI3 (9) | ||
generic_isr, // EXTI4 (10) | ||
generic_isr, // DMA1_Stream0 (11) | ||
generic_isr, // DMA1_Stream1 (12) | ||
generic_isr, // DMA1_Stream2 (13) | ||
generic_isr, // DMA1_Stream3 (14) | ||
generic_isr, // DMA1_Stream4 (15) | ||
generic_isr, // DMA1_Stream5 (16) | ||
generic_isr, // DMA1_Stream6 (17) | ||
generic_isr, // ADC (18) | ||
generic_isr, // CAN1_TX (19) | ||
generic_isr, // CAN1_RX0 (20) | ||
generic_isr, // CAN1_RX1 (21) | ||
generic_isr, // CAN1_SCE (22) | ||
generic_isr, // EXTI9_5 (23) | ||
generic_isr, // TIM1_BRK_TIM9 (24) | ||
generic_isr, // TIM1_UP_TIM10 (25) | ||
generic_isr, // TIM1_TRG_COM_TIM11 (26) | ||
generic_isr, // TIM1_CC (27) | ||
generic_isr, // TIM2 (28) | ||
generic_isr, // TIM3 (29) | ||
generic_isr, // TIM4 (30) | ||
generic_isr, // I2C1_EV (31) | ||
generic_isr, // I2C1_ER (32) | ||
generic_isr, // I2C2_EV (33) | ||
generic_isr, // I2C2_ER (34) | ||
generic_isr, // SPI1 (35) | ||
generic_isr, // SPI2 (36) | ||
generic_isr, // USART1 (37) | ||
generic_isr, // USART2 (38) | ||
generic_isr, // USART3 (39) | ||
generic_isr, // EXTI15_10 (40) | ||
generic_isr, // RTC_Alarm (41) | ||
generic_isr, // OTG_FS_WKUP (42) | ||
generic_isr, // TIM8_BRK_TIM12 (43) | ||
generic_isr, // TIM8_UP_TIM13 (44) | ||
generic_isr, // TIM8_TRG_COM_TIM14 (45) | ||
generic_isr, // TIM8_CC (46) | ||
generic_isr, // DMA1_Stream7 (47) | ||
generic_isr, // FMC (48) | ||
generic_isr, // SDIO (49) | ||
generic_isr, // TIM5 (50) | ||
generic_isr, // SPI3 (51) | ||
generic_isr, // UART4 (52) | ||
generic_isr, // UART5 (53) | ||
generic_isr, // TIM6_DAC (54) | ||
generic_isr, // TIM7 (55) | ||
generic_isr, // DMA2_Stream0 (56) | ||
generic_isr, // DMA2_Stream1 (57) | ||
generic_isr, // DMA2_Stream2 (58) | ||
generic_isr, // DMA2_Stream3 (59) | ||
generic_isr, // DMA2_Stream4 (60) | ||
generic_isr, // ETH (61) | ||
generic_isr, // ETH_WKUP (62) | ||
generic_isr, // CAN2_TX (63) | ||
generic_isr, // CAN2_RX0 (64) | ||
generic_isr, // CAN2_RX1 (65) | ||
generic_isr, // CAN2_SCE (66) | ||
generic_isr, // OTG_FS (67) | ||
generic_isr, // DMA2_Stream5 (68) | ||
generic_isr, // DMA2_Stream6 (69) | ||
generic_isr, // DMA2_Stream7 (70) | ||
generic_isr, // USART6 (71) | ||
generic_isr, // I2C3_EV (72) | ||
generic_isr, // I2C3_ER (73) | ||
generic_isr, // OTG_HS_EP1_OUT (74) | ||
generic_isr, // OTG_HS_EP1_IN (75) | ||
generic_isr, // OTG_HS_WKUP (76) | ||
generic_isr, // OTG_HS (77) | ||
generic_isr, // DCMI (78) | ||
generic_isr, // CRYP (79) | ||
generic_isr, // HASH_RNG (80) | ||
generic_isr, // FPU (81) | ||
generic_isr, // USART7 (82) | ||
generic_isr, // USART8 (83) | ||
generic_isr, // SPI4 (84) | ||
generic_isr, // SPI5 (85) | ||
generic_isr, // SPI6 (86) | ||
generic_isr, // SAI1 (87) | ||
generic_isr, // LCD-TFT (88) | ||
generic_isr, // LCD-TFT (89) | ||
generic_isr, // DMA2D(90) | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#![no_std] | ||
|
||
pub use stm32f4xx; | ||
pub use stm32f4xx::{chip, dbg, dma1, exti, gpio, nvic, rcc, spi, syscfg, tim2, usart}; | ||
|
||
pub mod irqs; | ||
pub mod stm32f429zi_nvic; |
Oops, something went wrong.