#RaspberryPi bare metal: progress on Terrible Allocation Table

So, I’ve got the SD card working on a Pi 0 bare metal. Cool.

FAT32 is a bit trickier. I found someone’s project, but I couldn’t get it to work. So I was pondering whether to try to fix it, or just go make my own filesystem.

Oh hell, I decided, I’d just roll my own. SD cards are a bit of a dark art with microcontrollers generally. I’ve had them going on-and-off with things like STM32 and ESP32s. It’s difficult to know what’s wrong. Is it the library, or is it the hardware?

I’m sticking with the Pi0 for now, anyway, as I don’t have to bother hooking up a card. The Pi Foundation are working on a SD library for the Pico, so that will be nice to see working. In the meantime, I’ll just follow the path of least resistance.

So, roll-my-own filesystem it is. I watched a couple of vids on how the FAT32 system worked, but got confused. I want something to Just Work for now, so that I can store samples on an SD card and play them on this daft idea of a synthesiser I have.

The simplest idea that I could come up with is TAT, my Terrible Allocation Table. What you do is set aside a partition, then invoke the formatter. This splits the partition into 20 equal file slots, each of equal size. You can then save files to the slots.

So far, I can store, ls, and retrieve a file (the last one not bare-metal itself). So it’s looking pretty cool. And, because I wrote it myself, I have a much greater comprehension of what’s going on.

Other than being limited to 20 files, there is no directory structure. Just straight files. I’m not interested in any fancy stuff.

If you’re interested in the basic concept, then check out the following two directories:

  • * dir1 – which works on Linux and connects to an SD card via loopback, and
  • * dir2 – which works on Pi 0 bare metal

The first directory is for development work. It is tested there first, and migrated across via some common files.

It has many jutting-out flesh-tearing shards at the moment, but it works at a barebones level. It’s probably too cryptic for other people to figure out, but if there’s interest, I am open to explaining things in greater detail, and to start knocking off some of the roughest edges.

About mcturra2000

Computer programmer living in Scotland.
This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s