Skip to content

Commit

Permalink
docs: move captains log, use obsidian for notes
Browse files Browse the repository at this point in the history
  • Loading branch information
philiplinden committed Jan 5, 2025
1 parent c02dcce commit 8d62418
Show file tree
Hide file tree
Showing 11 changed files with 260 additions and 260 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,6 @@ Cargo.lock
.env
.DS_Store
desktop.ini

# Obsidian
.obsidian/
1 change: 1 addition & 0 deletions docs/.gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
book
.obsidian
5 changes: 0 additions & 5 deletions docs/SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,3 @@
- [debugging](hello-world/debugging.md)
- [blinky](hello-world/blinky.md)

---

# Development

- [captain's log](captains-log.md)
254 changes: 0 additions & 254 deletions docs/captains-log.md

This file was deleted.

109 changes: 109 additions & 0 deletions docs/captains-log/2024-12-17.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
## 2024-12-17

Ahab is a fitting name for this project. It is a high altitude balloon. It is
cheeky. It is a bit of a jerk. It is a bit of a showoff. It is a bit of a thing
I keep chasing and chasing and chasing. It's also a nod to the "alumni hab"
brickworks project that became [Nucleus](https://github.com/Brickworks/Nucleus).

I'm going to try to keep a log of my thoughts and ideas here, like a captain
losing his mind at sea.

Some things I have floating around in my head:

1. I really like mdBook. I think it's a great way to write documentation.
2. I found the following things in my drawer.
- tiny gps breakout https://www.sparkfun.com/products/retired/10995
- rpi 4b
- rpi zero w 1.1
- msp430
- stm32F411e
- arduino mkr fpga https://www.arduino.cc/en/Guide/MKRVidor4000
- a TTL camera
3. I would really like to build out [yahs](https://github.com/philiplinden/yahs)
into a thing that can be used to build and test a high altitude balloon,
more than just a thing I use to learn rust.
4. I want to explore embedded rust.
5. I want to finish what [Nucleus](https://github.com/Brickworks/Nucleus)
started. We had a lot of good ideas and made a lot of mistakes. I want to
finish what we started.

I set up this repository and started writing some documentation, including some
notes on what I want out of this project.

I flashed the Raspberry Pi 4B with Raspberry Pi OS Lite and was able to
successfully SSH into it on my local network. Even if I end up using the Pi
Zero for flight, the 4B is really easy to set up on the network, has plenty of
headroom, and will serve as a good testbed for now. It could also host other
development services like a web server, database, Jenkins, etc if I need it to.

https://github.com/rust-embedded/rust-raspberrypi-OS-tutorials

I should start using Linear for project management for this. I probably won't
stick to it very well, but it will be good practice.

I found some great rust CI examples in the
[actions-rs](https://github.com/actions-rs) repo. I'm going to use them to set
up a build workflow for this project.

I set up a template for the STM32F411E board.
https://studiofuga.com/blog/2022-10-18-getting-started-with-rust-and-stm32f411/

I set up a template for the MSP432 too.
- https://github.com/rust-embedded/msp430-quickstart (not this board, but close)
- https://docs.rs-online.com/3934/A700000006811369.pdf
- https://github.com/MSP432P401R-Launchpad-Rust
- https://github.com/msp432-rust/msp432p401r-hal
- https://github.com/msp432-rust/msp432p401r-pac
- https://github.com/pcein/msp432p401r
- https://github.com/pcein/msp432-newio

Turns out the MSP432 uses the TM4C129 chip, which can be used with the
[cortex-m-quickstart](https://docs.rs/cortex-m-quickstart/~0.2.3) cargo-generate
template. I set that up but I'm not sure if the `memory.x` file is correct.

I ended up fighting the compiler for a while, trying to get the panic handler
to work. I ended up just using the `panic-semihosting` crate for now because
that's what would compile. Using `panic-halt` or `panic-abort` required using
deprecated features I guess? After switching to the `panic-semihosting` crate, I
started running into linker errors. I'll have to figure this out later once I
am actually flashing the boards with code I understand, rather than templates.

The root cause looks to be related to this comment
[from the miri repo](https://github.com/rust-lang/miri/issues/3498):
> you added a crate as dependency that depends on std, and built a sysroot
> without std, and then that fails to build. No surprise here.
Oh well.

I thought some more about how to structure the project so that I can swap out
blocks of logic easily between simulated code on my PC, code running on a board
in a hardware-in-the-loop simulation, and actual code running on the board in
the real world. With Rust, hopefully we can write tests and benchmarks for the
software and firmware so that they behave exactly the same way in each case. The
tricky bit is how to handle the interface between the simulated environments and
the real environments for things like sensors and actuators.

--> [design/structure.md](design/structure.md)

And now, it's time to [dive in to embedded rust](https://youtu.be/TOAynddiu5M).

I deleted most of the template code and started from scratch following this
tutorial and documenting the process in
[docs/hello-worldgetting-started.md](docs/hello-worldgetting-started.md). I can always
re-use the template code if I need it, but building up from scratch is great
practice to learn what all of these files do and how they fit together.

Woohoo! I got a (dummy) program to compile for the STM32F411E board! Now to
flash it... Nice, it worked!

There is one hang up though. When I `cargo build` from the root, it tries to
compile the embedded crates for the host arch. I want to edit `Cargo.toml` at
the root to effectively do the same thing as specifying the target arch in
`.cargo/config.toml` for each crate.

https://doc.rust-lang.org/cargo/reference/unstable.html#per-package-target

https://nnarain.github.io/2021/08/02/Setting-up-per-package-targets-in-Rust.html

I had to add `cargo-features = ["per-package-target"]` to the `Cargo.toml` file,
which is an unstable `nightly` feature.
Loading

0 comments on commit 8d62418

Please sign in to comment.