J

Jorge Aparicio

blog.japaric.io · Personal blog · on HN since 2017

Jorge Aparicio writes about embedded programming in Rust, covering ARM Cortex-M microcontrollers, concurrency, real-time frameworks and stack analysis.

What HN saysHN commenters point to it as the place to learn Rust on bare-metal targets, including the quickstart guide and his cross-compilation tooling.
23HN people shared it
14linked it in comments
11stories submitted
865story points
3 years agolast shared
2017people per year2026

Most-shared posts

  1. 1
    Embedded in Rust: Brave new I/O
    6 people · 371 points · first shared 2018 · 65 comments on HN
  2. 2
    Rust your ARM microcontroller
    4 people · 253 points · first shared 2017 · 16 comments on HN
  3. 3
    Fearless concurrency in your microcontroller
    4 people · 153 points · first shared 2017 · 51 comments on HN
  4. 4
  5. 5
    Homepage
    2 people · first shared 2017
  6. 6
    Microamp: Asymmetric Multi-Processing on Microcontrollers
    1 people · 76 points · first shared 2019 · 3 comments on HN
  7. 7
    Implementing a static stack usage analysis tool
    1 people · 4 points · first shared 2019 · 1 comments on HN
  8. 8
    Real Time For The Masses goes multi-core
    1 people · 3 points · first shared 2019 · discussion on HN
  9. 9
    RTFM v0.3.0: safe `&'static mut T` and less locks
    1 people · 3 points · first shared 2018 · discussion on HN
  10. 10
    Stack overflow protection
    1 people · first shared 2024
  11. 11
    Safe dma
    1 people · first shared 2020

What HN people wrote when they linked it

scoutt · 2019-04-08
Write from scratch, maybe. Rewrite, I don't think it will happen anytime soon. In fact, the more time it passes, the more code needs to be rewritten. Regarding firmware, if the talk was about bare-metal embedded development, then I think Rust is the solution to a problem that no one has. Since the food on my table comes from firmware development, I passed several days trying to understand the reasons to move to the approach described here: http://blog.japaric.io/brave-new-io/ (Embedded in Rust blog, great reading BTW). But found little. It's a nice toy but it may be too much. If that is the trend, then I think Rust for Embedded is the answer to a question no one asked, because in my work, if I need to set a bit into a register, I have to be sure it's fking set; not playing around "just because it may be problematic".
tzhenghao · 2018-01-31
There has been recent pushes to use Rust in embedded systems, but I agree it'll take a long time. Check out this blog [1]. [1] - http://blog.japaric.io/
samlittlewood · 2017-10-16
For rust on bare metal target, it is also worth looking at: http://blog.japaric.io/quickstart/ and other work by Jorge Aparicio - https://github.com/japaric.
steveklabnik · 2017-10-03
So, some quick things: every Rust compiler is a cross-compiler, so that's not the tough part. You need to compile 'libcore' for the target, but https://github.com/japaric/xargo makes that pretty straightforward if your chip isn't one of the ones provided by the Rust project, if it is, then you just need to run a command to download it and you're good to go. https://forge.rust-lang.org/platform-support.html is said target list today. AVR is coming soon, it works but has bugs and is hacky. Japaric is quite prolific, he writes over at http://blog.japaric.io/ and his latest posts are about his RTOS-like framework. Finally if you're into ARM, https://www.tockos.org/ might be up your alley.
jamesmunns · 2024-02-14
You can't generally change the direction the stack moves, at least on targets like Cortex-M. Maybe in ASM it'd be feasible to work around, but getting LLVM to do this isn't anything I've ever seen. The "walk off the edge" technique is what is described here [0], in embedded rust we have a tool that does this automatically (from the author of the post) called `flip-link` [1]. It requires a second linker/re-linking pass to do this sizing automatically (you could also do the same manually with a linker script in one pass, if you hardcode certain sizes). [0]: https://blog.japaric.io/stack-overflow-protection/ [1]: https://github.com/knurling-rs/flip-link
Communitivity · 2020-08-13
It takes work, but you can write safe DMA code in Rust. A good post by Jorge Aparicio explaining how is at his blog[1]. [1] https://blog.japaric.io/safe-dma/#:~:text=DMA%20stands%20for%20Direct%…
lsllc · 2019-04-23
Having done a lot of embedded work in both C and assembler, I'm really excited by the prospect of a type-safe, memory safe language with zero-cost abstractions that can compile down to [more or less] the same machine code that C would produce. For those interested, check out Jorge Aparicio's (japaric) RTFM2 series: http://blog.japaric.io/rtfm-v2/ (in particular the sections titled "Preemption" and "Critical sections and Threshold")
pjc50 · 2018-12-05
There are various alternatives, but generally the approach is to know what address you need in advance and create an object for it at compile time that can be accessed type-safely. e.g. https://zinc.rs/apidocs/ioreg/index.html or the longer but more detailed http://blog.japaric.io/brave-new-io/ , which covers various approaches. It even points out that you can use the type system to enforce that peripherals are only accessed from multiple threads or parts of the program in a safe manner, which you can't do if you can just reinterpret-cast into anything.
quodlibetor · 2018-03-12
I'm not experienced in this space, but you might be interested in the Real-Time For the Masses[1] project. The author of that is the lead of the embedded devices working group. 1: http://blog.japaric.io/rtfm-v2/
pcein · 2018-03-01
It is not just the borrow checker. The ownership system / move semantics and powerful static type system with traits and generics helps to create some interesting abstractions (which have very little run time overhead) - pleas check: http://blog.japaric.io/brave-new-io/ as well as other articles on that blog.
anderspitman · 2017-11-28
I'm so excited that we're feasibly within a year or two of being able to develop embedded devices in Rust[0] on RISC-V microcontrollers [1] running on open source RTOSes also written in Rust[2]. It's currently already possible but still requires quite a bit of hacking. Plus the RF stacks (Bluetooth in particular) aren't there yet. What a time to be a developer. PS RISC-V on my X220 wouldn't hurt either. [0] http://blog.japaric.io/quickstart/ [1] https://www.sifive.com/products/hifive1/ [2] https://www.tockos.org/
awelkie · 2017-09-17
I believe rust's safety guarantees are enough to ensure the soundness of passing data to/from interrupt contexts and interrupt handler re-entrancy. See rtfm[0] for an example and a good explanation. I think DMA handling can be made safe by using the right abstractions, and then you'd just need to trust that any piece of code that accesses the memory uses the abstraction instead of accessing it directly. Checking interrupt priorities sounds like an interesting problem. What is the state of the art in deadlock prevention? It would also be cool if you could tell the compiler "I need this interrupt handler to return in less than n clock cycles." I wonder if someone could write a rust compiler plugin to check that. [0]: http://blog.japaric.io/fearless-concurrency/
GrayShade · 2017-07-12
> And for real low level to the metal systems programming, everything is unsafe; so you may as well be writing in C. You might want to take a look at this series: http://blog.japaric.io/fearless-concurrency/ .
MrBuddyCasino · 2017-06-20
Have a look at RTFM: http://blog.japaric.io/fearless-concurrency/ Theres nothing like it out there. This is zero abstraction, and it works.

Keyboard shortcuts

/Search
j kNext / previous blog
EnterOpen selected blog
vVisit the blog site
fFollow / unfollow
lSwitch grid / list view
dSwitch dark mode
g hHome
g pTop posts
g tTopics
g fFollowing
g lLiked
g yHistory
g qFAQ
EscBack / close