use nrf52832_pac::Interrupt;
use something::Queue;
// Done at global scope, only specify types
cmim!(
This file contains hidden or 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
| [profile.dev] | |
| opt-level = 0 | |
| debug = true | |
| [profile.release] | |
| codegen-units = 1 | |
| lto = true | |
| opt-level = 3 |
So, I recently re-discovered gdbgui - a python tool that attaches to a GDB server and provides a graphical frontend in your browser. It turns out, this works really well for Embedded Rust Development! This also works across Windows, Mac, and Linux, which means it should be handy for most embedded devs out there!
I noticed a couple small tweaks that were necessary to get this working for me, and I wanted to share. Here are my suggestions for getting started:
Check out their installation instructions. In addition, you will also need:
This file contains hidden or 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
| diff --git a/build.rs b/build.rs | |
| index 73d61f7..d7dfb04 100644 | |
| --- a/build.rs | |
| +++ b/build.rs | |
| @@ -45,6 +45,7 @@ handlers."); | |
| Build::new().file("exceptions.s").compile("asm"); | |
| println!("cargo:rustc-link-search={}", out.display()); | |
| + println!("cargo:rustc-link-lib=static=asm"); |
This file contains hidden or 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
| pub fn new() -> PeripheralX { | |
| // Syntax could look a little like this: | |
| let int_handle = interrupt!(UARTE0_UART0, |mut cons: Consumer| { | |
| // Do some interrupty things here | |
| cons.read(); | |
| // ... | |
| }); | |
| // Enable the interrupt, but do not pend | |
| int_handle.spawn(); |
This file contains hidden or 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
| diff --git a/src/libcore/cell.rs b/src/libcore/cell.rs | |
| index ec7d366c3f..421b741a3a 100644 | |
| --- a/src/libcore/cell.rs | |
| +++ b/src/libcore/cell.rs | |
| @@ -1512,6 +1512,18 @@ impl<T: ?Sized> UnsafeCell<T> { | |
| } | |
| } | |
| +// TODO: correct stable attribute | |
| +#[stable(feature = "rust1", since = "1.0.0")] |
The official installation guide (https://wiki.archlinux.org/index.php/Installation_Guide) contains a more verbose description.
- Image from https://www.archlinux.org/
This file contains hidden or 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
| ➜ tinyrocket git:(james-hack) ✗ ls -hal target/x86_64-unknown-linux-gnu/release/tinyrocket | |
| -rwxr-xr-x 2 james users 1.2M Mar 30 14:53 target/x86_64-unknown-linux-gnu/release/tinyrocket | |
| ➜ tinyrocket git:(james-hack) ✗ strip target/x86_64-unknown-linux-gnu/release/tinyrocket | |
| ➜ tinyrocket git:(james-hack) ✗ ls -hal target/x86_64-unknown-linux-gnu/release/tinyrocket | |
| -rwxr-xr-x 2 james users 816K Mar 30 14:53 target/x86_64-unknown-linux-gnu/release/tinyrocket | |
| ➜ tinyrocket git:(james-hack) ✗ ldd target/x86_64-unknown-linux-gnu/release/tinyrocket | |
| linux-vdso.so.1 (0x00007ffdb3fe8000) | |
| libdl.so.2 => /usr/lib/libdl.so.2 (0x00007fd659240000) | |
| librt.so.1 => /usr/lib/librt.so.1 (0x00007fd659038000) | |
| libpthread.so.0 => /usr/lib/libpthread.so.0 (0x00007fd658e1a000) |
This file contains hidden or 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
| # ! [ cfg_attr ( feature = "rt" , feature ( global_asm ) ) ] # ! [ cfg_attr ( feature = "rt" , feature ( macro_reexport ) ) ] # ! [ cfg_attr ( feature = "rt" , feature ( used ) ) ] # ! [ doc = "Peripheral access API for LPC43XX microcontrollers (generated using svd2rust v0.12.0)\n\nYou can find an overview of the API [here].\n\n[here]: https://docs.rs/svd2rust/0.12.0/svd2rust/#peripheral-api" ] # ! [ allow ( private_no_mangle_statics ) ] # ! [ deny ( missing_docs ) ] # ! [ deny ( warnings ) ] # ! [ allow ( non_camel_case_types ) ] # ! [ feature ( const_fn ) ] # ! [ feature ( try_from ) ] # ! [ no_std ] | |
| extern crate bare_metal; | |
| extern crate cortex_m; | |
| #[macro_reexport(default_handler, exception)] | |
| #[cfg(feature = "rt")] | |
| extern crate cortex_m_rt; | |
| extern crate vcell; | |
| use core::ops::Deref; | |
| use core::marker::PhantomData; | |
| #[doc = r" Number available in the NVIC for configuring priority"] |
This file has been truncated, but you can view the full file.
This file contains hidden or 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
| # ! [ cfg_attr ( feature = "rt" , feature ( global_asm ) ) ] # ! [ cfg_attr ( feature = "rt" , feature ( macro_reexport ) ) ] # ! [ cfg_attr ( feature = "rt" , feature ( used ) ) ] # ! [ doc = "Peripheral access API for ATSAMD21E15A microcontrollers (generated using svd2rust v0.12.0)\n\nYou can find an overview of the API [here].\n\n[here]: https://docs.rs/svd2rust/0.12.0/svd2rust/#peripheral-api" ] # ! [ allow ( private_no_mangle_statics ) ] # ! [ deny ( missing_docs ) ] # ! [ deny ( warnings ) ] # ! [ allow ( non_camel_case_types ) ] # ! [ feature ( const_fn ) ] # ! [ no_std ] | |
| extern crate bare_metal; | |
| extern crate cortex_m; | |
| #[macro_reexport(default_handler, exception)] | |
| #[cfg(feature = "rt")] | |
| extern crate cortex_m_rt; | |
| extern crate vcell; | |
| use core::ops::Deref; | |
| use core::marker::PhantomData; | |
| #[doc = r" Number available in the NVIC for configuring priority"] |