From 61250a3e90bb4a74b8aae8e8d38a2507e57f96c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20J=C3=B6rdens?= Date: Mon, 29 Jul 2019 08:32:49 +0000 Subject: [PATCH] cargo: bump stm32h7, misc --- Cargo.lock | 48 +++++++++++++++++++++++++----------------------- Cargo.toml | 5 ++--- src/eth.rs | 32 ++++++++++++++++---------------- src/main.rs | 6 +++--- 4 files changed, 46 insertions(+), 45 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 3fc0199..b6c54e9 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -73,12 +73,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cortex-m 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", "cortex-m-semihosting 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "cortex-m-rt" -version = "0.6.9" +version = "0.6.10" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cortex-m-rt-macros 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", @@ -93,7 +93,7 @@ dependencies = [ "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", "quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.39 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.42 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -102,7 +102,7 @@ version = "0.5.0-alpha.1" source = "git+https://github.com/japaric/cortex-m-rtfm?rev=fafeeb2#fafeeb27270ef24fc3852711c6032f65aa7dbcc0" dependencies = [ "cortex-m 0.5.10 (registry+https://github.com/rust-lang/crates.io-index)", - "cortex-m-rt 0.6.9 (registry+https://github.com/rust-lang/crates.io-index)", + "cortex-m-rt 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)", "cortex-m-rtfm-macros 0.5.0-alpha.1 (git+https://github.com/japaric/cortex-m-rtfm?rev=fafeeb2)", "heapless 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -114,7 +114,7 @@ source = "git+https://github.com/japaric/cortex-m-rtfm?rev=fafeeb2#fafeeb27270ef dependencies = [ "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", "quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.39 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.42 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -161,7 +161,7 @@ dependencies = [ [[package]] name = "log" -version = "0.4.7" +version = "0.4.8" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", @@ -246,10 +246,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "serde" -version = "1.0.94" +version = "1.0.98" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "serde_derive 1.0.94 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.98 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -258,17 +258,17 @@ version = "0.0.1" source = "git+https://github.com/quartiq/serde-json-core.git?rev=fc764de#fc764deb8dfb82e5cfcc6c5059d8d5c3031e0591" dependencies = [ "heapless 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.94 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.98 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "serde_derive" -version = "1.0.94" +version = "1.0.98" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", "quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.39 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.42 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -287,15 +287,15 @@ version = "0.2.0" dependencies = [ "cortex-m 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", "cortex-m-log 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", - "cortex-m-rt 0.6.9 (registry+https://github.com/rust-lang/crates.io-index)", + "cortex-m-rt 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)", "cortex-m-rtfm 0.5.0-alpha.1 (git+https://github.com/japaric/cortex-m-rtfm?rev=fafeeb2)", "heapless 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", "panic-semihosting 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.94 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.98 (registry+https://github.com/rust-lang/crates.io-index)", "serde-json-core 0.0.1 (git+https://github.com/quartiq/serde-json-core.git?rev=fc764de)", "smoltcp 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", - "stm32h7 0.7.0", + "stm32h7 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -305,17 +305,18 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "stm32h7" -version = "0.7.0" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bare-metal 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", "cortex-m 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", - "cortex-m-rt 0.6.9 (registry+https://github.com/rust-lang/crates.io-index)", + "cortex-m-rt 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)", "vcell 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "syn" -version = "0.15.39" +version = "0.15.42" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", @@ -357,7 +358,7 @@ dependencies = [ "checksum cortex-m 0.5.10 (registry+https://github.com/rust-lang/crates.io-index)" = "3c0b159a1e8306949579de3698c841dba58058197b65c60807194e4fa1e7a554" "checksum cortex-m 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f3c18719fdc57db65668bfc977db9a0fa1a41d718c5d9cd4f652c9d4b0e0956a" "checksum cortex-m-log 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "584a62cf37ddd834b8bfc21317bf3396915844298bf346dd1f4ca0572180ac7f" -"checksum cortex-m-rt 0.6.9 (registry+https://github.com/rust-lang/crates.io-index)" = "0e14454e26edbefb4d567ad7e71959b62268d28567e83f9a30fe21c3987af58c" +"checksum cortex-m-rt 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)" = "17805910e3ecf029bdbfcc42b7384d9e3d9e5626153fa810002c1ef9839338ac" "checksum cortex-m-rt-macros 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "d7ae692573e0acccb1579fef1abf5a5bf1d2f3f0149a22b16870ec9309aee25f" "checksum cortex-m-rtfm 0.5.0-alpha.1 (git+https://github.com/japaric/cortex-m-rtfm?rev=fafeeb2)" = "" "checksum cortex-m-rtfm-macros 0.5.0-alpha.1 (git+https://github.com/japaric/cortex-m-rtfm?rev=fafeeb2)" = "" @@ -366,7 +367,7 @@ dependencies = [ "checksum generic-array 0.13.2 (registry+https://github.com/rust-lang/crates.io-index)" = "0ed1e761351b56f54eb9dcd0cfaca9fd0daecf93918e1cfc01c8a3d26ee7adcd" "checksum hash32 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "12d790435639c06a7b798af9e1e331ae245b7ef915b92f70a39b4cf8c00686af" "checksum heapless 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c6c7ce2e47016f34d17acbf2fe5f9e0337ea59d2ab8ceecd9405b2336ffaca9b" -"checksum log 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)" = "c275b6ad54070ac2d665eef9197db647b32239c9d244bfb6f041a766d00da5b3" +"checksum log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)" = "14b6052be84e6b71ab17edffc2eeabf5c2c3ae1fdb464aae35ac50c67a44e1f7" "checksum managed 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)" = "fdcec5e97041c7f0f1c5b7d93f12e57293c831c646f4cc7a5db59460c7ea8de6" "checksum panic-semihosting 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "97cfb37c1d3b5f0cc18bf14485018cccd13bdd24f7b5bfd456c1d8760afef824" "checksum proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)" = "cf3d2011ab5c909338f7887f4fc896d35932e29146c12c8d01da6b22a80ba759" @@ -378,12 +379,13 @@ dependencies = [ "checksum rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a" "checksum semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403" "checksum semver-parser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" -"checksum serde 1.0.94 (registry+https://github.com/rust-lang/crates.io-index)" = "076a696fdea89c19d3baed462576b8f6d663064414b5c793642da8dfeb99475b" +"checksum serde 1.0.98 (registry+https://github.com/rust-lang/crates.io-index)" = "7fe5626ac617da2f2d9c48af5515a21d5a480dbd151e01bb1c355e26a3e68113" "checksum serde-json-core 0.0.1 (git+https://github.com/quartiq/serde-json-core.git?rev=fc764de)" = "" -"checksum serde_derive 1.0.94 (registry+https://github.com/rust-lang/crates.io-index)" = "ef45eb79d6463b22f5f9e16d283798b7c0175ba6050bc25c1a946c122727fe7b" +"checksum serde_derive 1.0.98 (registry+https://github.com/rust-lang/crates.io-index)" = "01e69e1b8a631f245467ee275b8c757b818653c6d704cdbcaeb56b56767b529c" "checksum smoltcp 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fef582369edb298c6c41319a544ca9c4e83622f226055ccfcb35974fbb55ed34" "checksum stable_deref_trait 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "dba1a27d3efae4351c8051072d619e3ade2820635c3958d826bfea39d59b54c8" -"checksum syn 0.15.39 (registry+https://github.com/rust-lang/crates.io-index)" = "b4d960b829a55e56db167e861ddb43602c003c7be0bee1d345021703fac2fb7c" +"checksum stm32h7 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "63001af508d3332bd2dd81d4212b69e10f45e8f5435b7dab5def36178b9c1c17" +"checksum syn 0.15.42 (registry+https://github.com/rust-lang/crates.io-index)" = "eadc09306ca51a40555dd6fc2b415538e9e18bc9f870e47b1a524a79fe2dcf5e" "checksum typenum 1.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "612d636f949607bdf9b123b4a6f6d966dedf3ff669f7f045890d3a4a73948169" "checksum unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc" "checksum vcell 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "45c297f0afb6928cd08ab1ff9d95e99392595ea25ae1b5ecf822ff8764e57a0d" diff --git a/Cargo.toml b/Cargo.toml index 4b66aa7..0e87142 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -41,9 +41,8 @@ git = "https://github.com/quartiq/serde-json-core.git" rev = "fc764de" [dependencies.stm32h7] -path = "../stm32-rs/stm32h7" -# version = "0.7" -features = ["stm32h7x3", "rt"] +version = "0.8" +features = ["stm32h743", "rt"] [dependencies.smoltcp] #git = "https://github.com/m-labs/smoltcp.git" diff --git a/src/eth.rs b/src/eth.rs index f95ebcf..211fa16 100644 --- a/src/eth.rs +++ b/src/eth.rs @@ -1,5 +1,5 @@ use core::{slice, cmp}; -use stm32h7::stm32h7x3 as stm32; +use stm32h7::stm32h743 as pac; use smoltcp::Result; use smoltcp::time::Instant; use smoltcp::wire::EthernetAddress; @@ -86,7 +86,7 @@ use self::cr_consts::*; const CLOCK_RANGE: u8 = ETH_MACMIIAR_CR_HCLK_DIV_102; -pub fn setup(rcc: &stm32::RCC, syscfg: &stm32::SYSCFG) { +pub fn setup(rcc: &pac::RCC, syscfg: &pac::SYSCFG) { rcc.apb4enr.modify(|_, w| w.syscfgen().set_bit()); rcc.ahb1enr.modify(|_, w| { w.eth1macen().set_bit() @@ -98,8 +98,8 @@ pub fn setup(rcc: &stm32::RCC, syscfg: &stm32::SYSCFG) { //rcc.ahb1rstr.modify(|_, w| w.eth1macrst().clear_bit()); } -pub fn setup_pins(gpioa: &stm32::GPIOA, gpiob: &stm32::GPIOB, - gpioc: &stm32::GPIOC, gpiog: &stm32::GPIOG) { +pub fn setup_pins(gpioa: &pac::GPIOA, gpiob: &pac::GPIOB, + gpioc: &pac::GPIOC, gpiog: &pac::GPIOG) { // PA1 RMII_REF_CLK gpioa.moder.modify(|_, w| w.moder1().alternate()); gpioa.afrl.modify(|_, w| w.afr1().af11()); @@ -140,7 +140,7 @@ pub fn setup_pins(gpioa: &stm32::GPIOA, gpiob: &stm32::GPIOB, const PHY_ADDR: u8 = 0; -fn phy_read(reg_addr: u8, mac: &stm32::ETHERNET_MAC) -> u16 { +fn phy_read(reg_addr: u8, mac: &pac::ETHERNET_MAC) -> u16 { while mac.macmdioar.read().mb().bit_is_set() {} mac.macmdioar.modify(|_, w| unsafe { w @@ -154,7 +154,7 @@ fn phy_read(reg_addr: u8, mac: &stm32::ETHERNET_MAC) -> u16 { mac.macmdiodr.read().md().bits() } -fn phy_write(reg_addr: u8, reg_data: u16, mac: &stm32::ETHERNET_MAC) { +fn phy_write(reg_addr: u8, reg_data: u16, mac: &pac::ETHERNET_MAC) { while mac.macmdioar.read().mb().bit_is_set() {} mac.macmdiodr.write(|w| unsafe { w.md().bits(reg_data) }); mac.macmdioar.modify(|_, w| unsafe { @@ -169,7 +169,7 @@ fn phy_write(reg_addr: u8, reg_data: u16, mac: &stm32::ETHERNET_MAC) { } // Writes a value to an extended PHY register in MMD address space -fn phy_write_ext(reg_addr: u16, reg_data: u16, mac: &stm32::ETHERNET_MAC) { +fn phy_write_ext(reg_addr: u16, reg_data: u16, mac: &pac::ETHERNET_MAC) { phy_write(PHY_REG_CTL, 0x0003, mac); // set address phy_write(PHY_REG_ADDAR, reg_addr, mac); phy_write(PHY_REG_CTL, 0x4003, mac); // set data @@ -192,7 +192,7 @@ impl RxRing { } } - unsafe fn init(&mut self, dma: &stm32::ETHERNET_DMA) { + unsafe fn init(&mut self, dma: &pac::ETHERNET_DMA) { assert_eq!(self.desc_buf[0].len() % 4, 0); assert_eq!(self.pkt_buf[0].len() % 4, 0); @@ -245,7 +245,7 @@ impl RxRing { let addr = &self.desc_buf[self.cur_desc] as *const _ as u32; assert_eq!(addr & 0x3, 0); - let dma = unsafe { stm32::Peripherals::steal().ETHERNET_DMA }; + let dma = unsafe { pac::Peripherals::steal().ETHERNET_DMA }; dma.dmacrx_dtpr.write(|w| unsafe { w.bits(addr) }); self.cur_desc = self.next_desc(); @@ -268,7 +268,7 @@ impl TxRing { } } - unsafe fn init(&mut self, dma: &stm32::ETHERNET_DMA) { + unsafe fn init(&mut self, dma: &pac::ETHERNET_DMA) { assert_eq!(self.desc_buf[0].len() % 4, 0); assert_eq!(self.pkt_buf[0].len() % 4, 0); @@ -314,7 +314,7 @@ impl TxRing { let addr = &self.desc_buf[self.cur_desc] as *const _ as u32; assert_eq!(addr & 0x3, 0); - let dma = unsafe { stm32::Peripherals::steal().ETHERNET_DMA }; + let dma = unsafe { pac::Peripherals::steal().ETHERNET_DMA }; dma.dmactx_dtpr.write(|w| unsafe { w.bits(addr) }); } } @@ -331,9 +331,9 @@ impl Device { // After `init` is called, `Device` shall not be moved. pub unsafe fn init(&mut self, mac: EthernetAddress, - eth_mac: &stm32::ETHERNET_MAC, - eth_dma: &stm32::ETHERNET_DMA, - eth_mtl: &stm32::ETHERNET_MTL, + eth_mac: &pac::ETHERNET_MAC, + eth_dma: &pac::ETHERNET_DMA, + eth_mtl: &pac::ETHERNET_MTL, ) { eth_dma.dmamr.modify(|_, w| w.swr().set_bit()); while eth_dma.dmamr.read().swr().bit_is_set() {} @@ -558,7 +558,7 @@ impl<'a> phy::TxToken for TxToken<'a> { } } -pub unsafe fn interrupt_handler(eth_dma: &stm32::ETHERNET_DMA) { +pub unsafe fn interrupt_handler(eth_dma: &pac::ETHERNET_DMA) { eth_dma.dmacsr.write(|w| w .nis().set_bit() @@ -567,7 +567,7 @@ pub unsafe fn interrupt_handler(eth_dma: &stm32::ETHERNET_DMA) { ); } -pub unsafe fn enable_interrupt(eth_dma: &stm32::ETHERNET_DMA) { +pub unsafe fn enable_interrupt(eth_dma: &pac::ETHERNET_DMA) { eth_dma.dmacier.modify(|_, w| w .nie().set_bit() diff --git a/src/main.rs b/src/main.rs index dea0121..37faf99 100644 --- a/src/main.rs +++ b/src/main.rs @@ -24,7 +24,7 @@ use core::ptr; // use core::sync::atomic::{AtomicU32, AtomicBool, Ordering}; use core::fmt::Write; use cortex_m_rt::exception; -use stm32h7::stm32h7x3 as pac; +use stm32h7::stm32h743 as pac; use heapless::{String, Vec, consts::*}; use smoltcp as net; @@ -441,7 +441,7 @@ fn spi4_setup(spi4: &pac::SPI4) { } fn tim2_setup(tim2: &pac::TIM2) { - tim2.psc.write(|w| unsafe { w.psc().bits(200 - 1) }); // from 200 MHz + tim2.psc.write(|w| w.psc().bits(200 - 1)); // from 200 MHz tim2.arr.write(|w| unsafe { w.bits(2 - 1) }); // µs tim2.dier.write(|w| w.ude().set_bit()); tim2.egr.write(|w| w.ug().set_bit()); @@ -519,7 +519,7 @@ macro_rules! create_socket { ) } -#[rtfm::app(device = stm32h7::stm32h7x3)] +#[rtfm::app(device = stm32h7::stm32h743)] const APP: () = { static SPI: (pac::SPI1, pac::SPI2, pac::SPI4, pac::SPI5) = (); static ETHERNET_PERIPH: (pac::ETHERNET_MAC, pac::ETHERNET_DMA, pac::ETHERNET_MTL) = ();