What's everybody working on? (September Edition)

I’ve been working on programming an ECU, BMS and various sensors for an electric race motorcycle. I’m in a team of ~20 students builting a motocycle for the MotoStudent competition.

We’re using a few different types of microcontrollers and so far I have used Zig to target STM32 microcontrollers. I’m using ST’s hardware abstraction library directly with no issues. Inspired by TigerBeetle, I’m building a deterministic simulation test for the ECU. It has proven more difficult than I originally thought, but I’m getting there.

One of the few issues I encountered was that the objcopy from the build system produced binaries that were way to large (hundreds of Mos!) to flash onto the microcontroller. This issue is already tracked and I’ve mitigated it by using llvm-objcopy directly.

Most of the source code is private, but I’ve built a CAN database parsing library I can share. CAN is a message-oriented protocol typically used on vehicles that allows different components of that vehicle to exchange data. A CAN database (*.dbc file) is a proprietary file format that describes what are the messages, their “signals” (fields), how signals are encoded, which component sends them and receives them. I got tired of the database getting out of sync with the source code, so I made a library that ingests a *.dbc file in a build.zig and generates all the message definitions as well as encoding/decoding functions. So far it has been working flawlessly.

I also built a package that packages another project required to flash the microcontroller and can be used as a build step. So now, when somebody else wants in the team wants to program and flash an STM32, they have one less system dependency to worry about.

14 Likes