A new Exploring Uncut post where I write about my progress with implementing a Mandelbrot set on an STM32 board: some surprises and learnings to get the FPU working with #EmbeddedSwift, learning about call-clobbered vs callee-saved registers and using ChatGPT not for vibe coding but as a debugging and learning tool.

https://www.ericbariaux.com/posts/exploring-uncut-20260303

Exploring Uncut - March 3rd, 2026

Introduction This time, the focus is solely on providing an update on my exploration of getting a Mandelbrot set renderer running on an STM32F746G-DISCO board. I had hoped to also cover “The Egg Project” and some Home Assistant improvements I’ve been working on. However, there is already plenty to discuss here, and the other projects have been moving forward more slowly due to a collection of minor but frustrating issues, from ordering the wrong components, to chasing down unexpected sensor behavior, to tracking a Wi-Fi authentication failure caused by a simple case mismatch.

Bokeh

Check out some of the latest Embedded Swift Improvements Coming in Swift 6.3!

Read the blog post here: https://www.swift.org/blog/embedded-swift-improvements-coming-in-swift-6.3/

#Swift #SwiftLang #EmbeddedSwift

Embedded Swift Improvements Coming in Swift 6.3

Embedded Swift is a subset of Swift that’s designed for low resource usage, making it capable of running on constrained environments like microcontrollers. Using a special compilation mode, Embedded Swift produces significantly smaller binaries than regular Swift. While a subset of the full language, the vast majority of the Swift language works exactly the same in Embedded Swift. Additional information is described in the Embedded Swift vision document.

Swift.org

The GameBoy cart PCBs arrived earlier this week and they look so nice. The RP2040 portion all appears to work perfectly, was able to load the binary with no issues, which is a relief. Now I need to go through and update the EEPROM flashing code to match the final pin out and hope my address decoder circuit actually works correctly. Fingers crossed

#EmbeddedSwift #pcb_design #GameBoy

Believe it or not this is wireless!

#EmbeddedSwift #RaspberryPiPico

Not working quite yet, but the Pico Debug Probe is so much easier than manually wiring up a second Pico. The backtrace seems to suggest there's a crash when the WiFi stack tries to use an async context, but I’m just following the examples, so I'm not sure what the issue is.

Seems unlikely that calling the C methods from Swift would be causing a problem, but I really don't know how the Pico async stuff works

#RaspberryPiPico #EmbeddedSwift

Just one more debugging probe, then it’ll work…

#RaspberryPiPico #EmbeddedSwift

Added a nice little EEPROM page debug view to the app. Now after writing it shows a table of all the pages and the CRC16 checksum for each. The device returns a locally calculated checksum after writing a page

#SwiftLang #SwiftUI #EmbeddedSwift

Added a simple CRC check to the data I was writing and immediately found the problem. Wasn't even on the embedded side. When grabbing a range of bytes to send over USB I was using a normal range `start..<end` except that `end` was calculated to be a valid address (so 0x40 bytes would have an end address 0x3F) so I never wrote the last byte. Changing to a closed range did the trick and my CRCs started passing.

Writing the full ROM again. It's kind of slow

#SwiftLang #EmbeddedSwift

Noticed a strange bug with reading or writing to the EEPROM. Values up to 0x7F work just fine, but 0x80 and over seem to be losing the top bit. I'm shifting the byte to and from the data pins the same way, using .trailingZeroBitCount on the mask, and in a playground that shifting works just fine.

I guess an embedded project hasn't really started until you break out the logic analyzer

#SwiftLang #EmbeddedSwift