Sometimes I do silly things, even when the Rust compiler is trying to help (Impl Traits)...

Today I spent a bit of time scratching my head as I've been integrating a crate I wrote a long-time ago on ESP32 bare-metal rust into a new project with the Embassy-stm32 HAL (for ARM, in my case the STM32H747XI chip).
Here's the offending code:
impl<'a, I2C> RTClock<'a, I2C> where I2C: embedded_hal_1::i2c::I2c<Error = BoardError>, { #[allow(dead_code)] pub fn new(bus_manager: BusManagerCortexM<I2cDriver<'a>>) -> Result<Self, BoardError> { Ok(Self { datetime: None, bus_manager, phantom: PhantomData, }) } // snip... }
Bear with me as the error takes a bit of reading, but we'll break it down
error[E0599]: the function or associated item `new` exists for struct `RTClock< ...(continued)

Debugging ARM Cortex-M with Jlink-mini and Arduino (Portenta H7) GIGA R1 WiFi board (with Rust bare metal) with VSCode

I was having a few issues with my GIGA R1 WiFi board, well, actually, one of them has totally died on me (it no longer enters into DFU mode) so I've raised a support ticket with Arduino themselves.
There isn't much information online covering Rust bare-metal and the GIGA R1 WiFi board in particular but I found this blog post called "Visual Studio Code for C/C++ with ARM Cortex-M: Part 4 - Debug" which helped confirm some of my VSCode configuration.
I also came across this Cortex M Quickstart repo on Github which helped as a clean starting point. Of course, I needed to make updates for the target device (S ...(continued)

Arduino (Portenta H7) GIGA R1 WiFi Display Demo with HTTP Request

This is a quick demo of using the Arduino (Portenta H7) GIGA R1 WiFi board with its display shield. This features a STM32H747XI microcontroller which is described as
High-performance and DSP with DP-FPU, Arm Cortex-M7 + Cortex-M4 MCU with 2MBytes of Flash memory, 1MB RAM, 480 MHz CPU, Art Accelerator, L1 cache, external memory interface, large set of peripherals, SMPS
In this example I wanted to fetch some data over HTTP and render "pages" on screen.

Links

Inventory Management System (with Rust & React): Part 2 - Planning for Production

Posted in Hobbies > Homelab: Virtualisation & Services > Tidy - Inventory Management

With my initial focus on the Rust API, I made sure to enable Github CI and ensure my test suite would run its full gamut of tests on every push of a commit. Other good practices involve
  • Use of ENV vars (this is pretty basic)
  • Use of dotenv, for both dev and production, of course.
  • Taking a Docker first approach (more on this later...)
Of course, an ideal DevOps solution would introduce a build-pipeline; there are many options in this space from the likes of Jenkins to GoCD, although a local GitLab instance can do all of this including hosting of a container registry. Instead, I decided to take a "scrappier" approach (for now), with simply Docker.  For those wondering, my local GoCD instance hasn't been involved in this project (yet).

The Homelab Stack

My Homelab produc ...(continued)

Building an Inventory Management System (from scratch) with Rust and React

Posted in Hobbies > Homelab: Virtualisation & Services > Tidy - Inventory Management

I don't always set myself hard to obtain goals, as you know, "ambition is the last refuge of failure". No, I haven't failed!
Look at those sexy UUIDs.  Oh my!
The premise was simple.  I wanted to create a "simple" Rust backend API that would basically be a RUST API around a Postgres DB.  The other part is of course the frontend; at the started I didn't put too much stock into this until I had the Rust API out of the way.
Much of the initial Rust work was in setting up the boilerplate Axum handlers, getting a test-harness setup for end-to- ...(continued)

Embedded Rust: Adding a Type-safe SNTP callback (to esp-idf-svc)

From my work on rued, I wanted to use the callback defined in esp-idf-sys, but these are the C bindings. The esp-idf-sys crate implements type-safe Rust wrappers.
My initial use and testing in rued involved manipulating the raw-C bindings themselves, along the lines of unsafe extern "C" fn sync_cb(tv: *mut esp_idf_sys::timeval). While I did this just to "get things to work", there is a reason why there is a HAL (hardware-abstraction layer) provided in Rust.
So, it was time to contribute back to the community effort of a Rust-based HAL. To this effort, I created a PR called Add wrapper to specify callback for SNTP. ...(continued)

Initial LED Driver functional verification

Posted in Hobbies > PCB Designs > Cree LED Strip

Having received the previously designed low-side LED driver PCBs, it was time to perform some initial functional tests.  The usual process here is to check for potential shorts and waveforms on the board, essentially checking components/stages 'block' by block.
The initial setup took some time as I not only had to solder the PTH components (Plated-through hole) such as the jumper headers but also various power, test and output leads as well. Ideally I would have not used my DC electronic load for initial testing but I sadly ran out of high-wattage wirewound resistors on hand.

Building an Embedded Rust Stack for ESP32

Posted in Hobbies > Electronics Projects > ESP32-based IoT Stack in Rust

I wanted to take my Rust skills into the Embedded eco-system and for a good long time, spent way too much time trying to re-invent a certain wheel (nothing to do with Rust, though) - more to do with choosing the 'right' MCU SOC for the job.
RTC module is the smaller board at the top (which has a small battery) and connects via I2C with the ESP32 that's on the smaller board in the M.2 socket.
My biggest issue is I wanted it to be capable of everything and anything, but in the embedded world, constraints are always part of the designing stage.  It's hard to say optimise for work-horse performance and say ...(continued)

Rust for Embedded is Better on x86

Having recently picked up a M1 Max MacBook Pro, in hindsight I expected to run into some issues due to the change in CPU architecture.
For some the idea of 64GB RAM is excessive, but if you've been pushing Mac's to their limit as long as I have - I've been running 32GB RAM defacto for over a decade.  It doesn't take many tabs in Chrome to exhaust 16GB RAM.
Here's a snap of running some heavy IO in Docker:
Running both Glances and Htop

Post Archive