Today, I lost a lot of time.
Actually, I didn’t lose any time, I just didn’t use it for what I had intended in the first place. I hoped to finish the assignment within the deadline, that is today; instead I learned a little about USB and standard libs.
I started by trying to use the serial-over-usb module of ChibiOS, but faced with the complexity of the USB protocol, I ended up adapting the demo code rather than reconstructing it. To my surprise, it didn’t work ! That is, even when only compiling the demo code, it would compile fine, but never actually expose a recognizable device to my computer . Instead, I would be getting confusing “device descriptor read error” messages in my dmesg, and packet inspection via wireshark/usbmon indicated that the packets were malformed. After some fiddling about and dirty “switch the usb off and on again until it works” hacks, I could see the device descriptor, but not its configuration, so still far from a serial-over-usb communication.
After a few hours of hair pulling, I switched workstations, and it worked on the first try, with the exact same code, only a different compiler ! I guess I’ll be sticking with the official ARM toolchain from now on, to avoid any unpleasant surprises like this.
In the end I still learned some basics about the USB protocol, and I also tried to make ChibiOS compile with clang. I have no more compilation errors, but it’s still not linking unfortunately. I guess this little side-project will have to wait, though, because I still didn’t finish the assignment in the end…