After a(nother) long break, I have decided to work in small features. This week was mostly adding MMIO handlers, ARM test code compiling and changing out logging.
MMIO
Well, it was already there, but I didn’t have any easy way of using it. I added a modular system to register and track MMIO request handlers, and then each handler, can implement its own logic for handling any MMIO request!

So what does this mean?
We can now delegate parts of MMIO to other bits of code to make this happen.
Code building
Getting tired of writing in ones and zeros (what a long forgotten issue) — I turned to assembling code.
A quirk of the process is that I need raw code, as a binary blob, and not the ELF binary that as
(the GNU Assembler) provides.
This led me to a well-accepted solution from the interwebs:
as one.S -o one.intermediate.bin
objcopy -O binary one.intermediate.bin one.bin
But then, I saw this wonderful issue: where I realised that the as
installed in my RPi was for ARM8, and for 64 bits. The easiest way to turn to 32-bit compilation was (arguably not easier, but less of a headache) to install the gcc-arm-none-eabi
package, and use its as
.
So with that out of the way, we can quickly create up an example program, and get:
mov r0, #0x10000
mov r1,#0x1000
mov r2,#0x4500
ldr r3,[r2]
add r1,r2,r3
str r1,[r2]
WFI
I’m not sure how to get a HALT or equivalent out of the machine, but I get these wonderful logs if I run the machine twice (two exits from MMIO; one for the ldr
and one for the str
):

Yay! MMIO works, and the logging handler receives it.
Logging
As evident above, working with logs is getting a bit tedious, especially from using cout
and printf
, so I linked up this wonderful library spdlog
to handle the logging.

So with this, I can tweak the log levels to see the data I want, and more importantly, the logging api to define them is much cleaner.
Summary
There’s a lot more things to do, but I will probably have to read more to understand which section can be tackled next. It might be a good idea to have a look at the Timers and Interrupts before going onto other topics.