debugging without a question.
for those that don’t know, my gsoc project involved writing standalone sd/mmc drivers for openbsd. sd/mmc is a specification that relates to SD cards which you might find in a cell phone or camera. they are a lot like hard drives in that they hold data when unpowered, and small computers use them exactly like hard drives
however, on these computers there is no standardized way to start reading from SD cards. this is a problem, because when you turn on your computer, there is no way for the operating system to load itself off the SD card. so i write the drivers
the thing was, that my code would run moments after you powered up the device until the operating system was loaded. “before the operating system has loaded” is a very funny place for a computer to be, which is a euphemistic way to say “i have zero of the normal debugging capabilities i would normally expect.”
no serial terminal, nothing. if the OS starts, i did it right. if it doesn’t, i did it wrong
what i ended up doing was writing functions that accepted a 32 bit uint, which i copied over to a register. i’d then break out into an ASM block and send a breakpoint instruction, at which point the native exception handler would take over and print out my number (along with the contents of all the other registers) into a neat little message on the UART. so i literally had to debug one 32 bit hex value at a time.
that worked fine, until i had to start changing clock values to suit certain parameters in the SD/MMC specification. then my neat little messages turned into shit that looks like this:
it was a long summer