diff --git a/firmware/Cargo.lock b/firmware/Cargo.lock index 0175834..22215f1 100644 --- a/firmware/Cargo.lock +++ b/firmware/Cargo.lock @@ -2,12 +2,22 @@ name = "ionpak-firmware" version = "0.1.0" dependencies = [ - "cortex-m 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", - "cortex-m-rt 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "smoltcp 0.4.0-pre (git+https://github.com/m-labs/smoltcp?rev=6bc6cc7)", - "tm4c129x 0.4.0 (git+https://github.com/m-labs/dslite2svd)", + "cortex-m 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "cortex-m-rt 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", + "smoltcp 0.4.0-pre (git+https://github.com/m-labs/smoltcp?rev=d03ea64)", + "tm4c129x 0.5.0 (git+https://github.com/m-labs/dslite2svd?rev=d527f3f)", ] +[[package]] +name = "aligned" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "bare-metal" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "byteorder" version = "1.1.0" @@ -15,26 +25,23 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "cortex-m" -version = "0.2.5" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "cortex-m-semihosting 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "aligned 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "bare-metal 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "volatile-register 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "cortex-m-rt" -version = "0.2.1" +version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "r0 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "cortex-m 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "r0 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "cortex-m-semihosting" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" - [[package]] name = "managed" version = "0.3.0" @@ -42,13 +49,13 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "r0" -version = "0.2.1" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "smoltcp" version = "0.4.0-pre" -source = "git+https://github.com/m-labs/smoltcp?rev=6bc6cc7#6bc6cc7af7ab7b710e9238b3c34bd50425ed7a92" +source = "git+https://github.com/m-labs/smoltcp?rev=d03ea64#d03ea6426b0524af726bfc4eb6fa025af475622f" dependencies = [ "byteorder 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "managed 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -56,10 +63,12 @@ dependencies = [ [[package]] name = "tm4c129x" -version = "0.4.0" -source = "git+https://github.com/m-labs/dslite2svd#43d3964bb9dcebe631b0bdf1c2fdc975cf53c41c" +version = "0.5.0" +source = "git+https://github.com/m-labs/dslite2svd?rev=d527f3f#d527f3febb73eb63db94ff84a580a4ea71d3a23b" dependencies = [ - "cortex-m 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", + "bare-metal 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "cortex-m 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "cortex-m-rt 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", "vcell 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -77,13 +86,14 @@ dependencies = [ ] [metadata] +"checksum aligned 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "d1a92995cea48691c7c93e12597cca4d692bb3130d0a291c7141b9793c7829e7" +"checksum bare-metal 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "19de0ac42f6977d7428858b750131ea9c8166f4ccb7deeab38b6a8656c9798b0" "checksum byteorder 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ff81738b726f5d099632ceaffe7fb65b90212e8dce59d518729e7e8634032d3d" -"checksum cortex-m 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)" = "56f002db38ab2c7a829bc0b997db8c5f47ada08f88a248c729d4f73c555628db" -"checksum cortex-m-rt 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "0db3cf185ad88e3d70e9b7738d1bad23f86322130d376df9b80a64df7abdb4cb" -"checksum cortex-m-semihosting 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "54a88e8fd577808637f819107f34eece1b6b45be8db1c56d1c563095b80b655e" +"checksum cortex-m 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "4d553ca1f23403c81e6d3d28a64ef6e8eadd7f395195aacda65cbc0dc987738e" +"checksum cortex-m-rt 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)" = "ec28308ef272803380c9c4e6708bf1d794ddcc8c9d511b9976b31ac3322452e5" "checksum managed 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "61eb783b4fa77e8fa4d27ec400f97ed9168546b8b30341a120b7ba9cc6571aaf" -"checksum r0 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "6e7bbed8cd0a245bbf3759ebb35c964822b7a8c15ceeeee56d4cc5f060ce518e" -"checksum smoltcp 0.4.0-pre (git+https://github.com/m-labs/smoltcp?rev=6bc6cc7)" = "" -"checksum tm4c129x 0.4.0 (git+https://github.com/m-labs/dslite2svd)" = "" +"checksum r0 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e2a38df5b15c8d5c7e8654189744d8e396bddc18ad48041a500ce52d6948941f" +"checksum smoltcp 0.4.0-pre (git+https://github.com/m-labs/smoltcp?rev=d03ea64)" = "" +"checksum tm4c129x 0.5.0 (git+https://github.com/m-labs/dslite2svd?rev=d527f3f)" = "" "checksum vcell 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "45c297f0afb6928cd08ab1ff9d95e99392595ea25ae1b5ecf822ff8764e57a0d" "checksum volatile-register 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "0d67cb4616d99b940db1d6bd28844ff97108b498a6ca850e5b6191a532063286" diff --git a/firmware/Cargo.toml b/firmware/Cargo.toml index d580734..ec00b96 100644 --- a/firmware/Cargo.toml +++ b/firmware/Cargo.toml @@ -4,13 +4,17 @@ version = "0.1.0" authors = ["whitequark "] [dependencies] -cortex-m = "0.2.5" -cortex-m-rt = { version = "0.2.0", features = ["linker-script"], default-features = false } -tm4c129x = { git = "https://github.com/m-labs/dslite2svd" } +cortex-m = "0.3.1" +cortex-m-rt = { version = "0.3.5", features = ["abort-on-panic"] } + +[dependencies.tm4c129x] +git = "https://github.com/m-labs/dslite2svd" +rev = "d527f3f" +features = ["rt"] [dependencies.smoltcp] git = "https://github.com/m-labs/smoltcp" -rev = "6bc6cc7" +rev = "d03ea64" features = [] default-features = false diff --git a/firmware/src/main.rs b/firmware/src/main.rs index fb2fe42..193df36 100644 --- a/firmware/src/main.rs +++ b/firmware/src/main.rs @@ -3,15 +3,13 @@ extern crate cortex_m; extern crate cortex_m_rt; +#[macro_use(interrupt)] extern crate tm4c129x; extern crate smoltcp; use core::cell::{Cell, RefCell}; use core::fmt; -use cortex_m::exception::Handlers as ExceptionHandlers; use cortex_m::interrupt::Mutex; -use tm4c129x::interrupt::Interrupt; -use tm4c129x::interrupt::Handlers as InterruptHandlers; use smoltcp::Error; use smoltcp::wire::{EthernetAddress, IpAddress}; use smoltcp::iface::{ArpCache, SliceArpCache, EthernetInterface}; @@ -97,31 +95,11 @@ macro_rules! create_socket { } fn main() { - // Enable the FPU - unsafe { - asm!(" - PUSH {R0, R1} - LDR.W R0, =0xE000ED88 - LDR R1, [R0] - ORR R1, R1, #(0xF << 20) - STR R1, [R0] - DSB - ISB - POP {R0, R1} - "); - } - // Beware of the compiler inserting FPU instructions - // in the prologue of functions before the FPU is enabled! - main_with_fpu(); -} - -#[inline(never)] -fn main_with_fpu() { board::init(); cortex_m::interrupt::free(|cs| { let nvic = tm4c129x::NVIC.borrow(cs); - nvic.enable(Interrupt::ADC0SS0); + nvic.enable(tm4c129x::Interrupt::ADC0SS0); let mut loop_anode = LOOP_ANODE.borrow(cs).borrow_mut(); let mut loop_cathode = LOOP_CATHODE.borrow(cs).borrow_mut(); @@ -298,8 +276,8 @@ fn main_with_fpu() { } } -use tm4c129x::interrupt::ADC0SS0; -extern fn adc0_ss0(_ctxt: ADC0SS0) { +interrupt!(ADC0SS0, adc0_ss0); +fn adc0_ss0() { cortex_m::interrupt::free(|cs| { let adc0 = tm4c129x::ADC0.borrow(cs); if adc0.ostat.read().ov0().bit() { @@ -325,16 +303,3 @@ extern fn adc0_ss0(_ctxt: ADC0SS0) { adc_irq_count.set(adc_irq_count.get() + 1); }); } - -#[used] -#[link_section = ".rodata.exceptions"] -pub static EXCEPTIONS: ExceptionHandlers = ExceptionHandlers { - ..cortex_m::exception::DEFAULT_HANDLERS -}; - -#[used] -#[link_section = ".rodata.interrupts"] -pub static INTERRUPTS: InterruptHandlers = InterruptHandlers { - ADC0SS0: adc0_ss0, - ..tm4c129x::interrupt::DEFAULT_HANDLERS -};