Picobit with serial console

I added some I2C primitives, and to do this I wrote a few helpers to access vectors from Chibios. Then I though: I need a simple way to test this, so I added support for Serial over USB. This didn't work, and when the micro-controller crashed. it took the Linux USB driver with it, and I had to reboot. That precludes using the debugger - since it connects via USB too.

So now I have a double defence: The micro-controller dev board is connected to the raspberry pi via USB, and also via serial: the pi has a 3.3V serial port which is perfect for this. You can read some instructions here. You don't have to reboot though: just do

$ sudo init q

instead to get init to reload it's configuration.

If I have to reboot the pi to get USB access back that will be OK, but using the serial port makes that unlikely anyway.

I still haven't used the debugger. My problem turned out to be a cut and paste error: Picobit passes arguments to primitives in 4 global variables. This makes sense: these variables can easily be included in the roots for the GC, so GC is safe inside primitives. It is, however, a great fault injection vector.

Through all of this, I keep getting tripped over by the broken Makefile: I'll make a change to a primitive, or change a setting, and either the relevant files won't get built early enough for the compiler to use them, or Racket will have compiled the old one and ignore the changes anyway. I've replaced gen.config.rkt with a command line option: --code-start to set the code start address. I'd really like a module system, so I can do away with the gen.library.scm and gen.primitives.rkt.

Tony Garnock Jones, an ex college of mine at LShift is now at Northeastern university. It sounds like he shares an office with one of the Picobit authors too. I know of p-syntax from SISC, but Tony suggested I use Racket #lang, which looks very interesting indeed. I might turn the Picobit compiler into a Racket back end.

I've found Source-to-Source compilation in Racket, and the example Magnolisp matches my use case in that I want Racket to implement modules for me.

I don't know if I should dive into this now or try writing some scheme to talk to the real time clock. I want parametrized modules, so for example I can create an instance of the TinyRTC module with the second I2C controller as a parameter, and then create and instance of SRFI-19 using my TinyRTC instance to get actual dates.

Popular posts from this blog

3D Printer ramblings

Balance Bot V2

Robot arm