Baremetal programming, Assembly Language, and FPGAs

Baremetal programming, Assembly Language, and FPGAs

I've been exploring how to program in assembly language lately. It's been a fun experience. I just ordered a Raspberry Pi 4 with 4GB of RAM from Adafruit. It should be here by the weekend.

One of the things I've recently discovered is called "baremetal programming". It refers to programming the Raspberry Pi using C and Assembler (for creating a bootloader for the C program) without using an Operating System.

Honestly, I see no real reason why I need to do this and I doubt that I'll ever write a program that uses more than a few Kilobytes of RAM, but the idea is fascinating. It's really just a hobby project at the moment.

I've been learning how CPUs work, as well as exploring CPU design on an FPGA. I've been a web developer since 1996 and I have never really understood why things work the way they do. I attended a technical school, not a college, so I learned the practical use of COBOL and C over the more esoteric (and exciting) science of computers. I never learned things like compiler theory, OS fundamentals, and assembler. It's time to remedy that.

I want to fill in the knowledge gaps from how a CPU is designed (I've been watching videos on reverse engineering CMOS and 6502 chips), through how machine code (0's and 1's) and assembler work, on to the bootloaders and linking to C programs, onto C++, then to 4th generation languages and runtime engines like .NET and Java, right up to where I live on a daily basis, programming C# for the web. I've already had exposure to most of those topics, but I'd like to build a project that brings them all together.

As part of this, I've been doing low-level binary programming using Hardware Definition Languages like Verilog and VHDL. Using HDLs has taught me a lot about logic and parallelism in programming. I have benefited in the real world from what I have learned in my spare time. While I apply the knowledge at a different level, it still applies at higher abstraction levels.

Another area I've been exploring has been assembly language programming for the Arduino (Atmel AVR assembler). While there are great tools for developing for Arduino already (C and C++ in the Arduino IDE as well as CircuitPython from Adafruit), I am more interested in learning the low-level stuff at present.

I think it comes down to maturity. I just wasn't mature enough in my younger days to appreciate low-level programming. I was more high-level. I was also more interested in creating art and music with computers. I even got obsessed with the Chaos theory and explored Fractals and Fractal science for a few years.

I am fortunate to have the spare time to spend on exploring new topics and the Internet is growing every day. It's nice that many of the sites from long ago are still around as the knowledge they share is no less relevant today than it was then. Especially when it's geared towards learning.

I have been programming computers for fun (and for a living) for a very long time, but I still feel like a beginner sometimes. I believe that when I'm not learning, I'm missing out, so I spend as much time as I can on new topics and expanding on topics I have already learned. I know there's no way I can ever run out of topics to study so I'm pretty excited about it.

I think I may be addicted to learning.