Of embedded black boxes
Over the last few months I’ve been working on projects using PIC microcontrollers. At first I had a rather negative view of the PIC processors. Since I started coding on them, I have come to realize that it is the compiler that I have issues with much more than the hardware. The compiler we’ve been using by CCS is designed to get projects up and running quickly by abstracting the hardware from the coder. So, instead of directly writing to the registers, you call one of their functions. We’ve found this works well when it is a mature processor and when we’re not trying to do too many things at once. Where we ran into lots of frustration was with new processors. We thought we had the code written correctly, yet it wasn’t working. Now instead of just having our code and hardware errata to look at, I also had to figure out what the CCS code was doing… which means slogging through the disassembled code and looking up the mnemonics for the different assembly operations.
Now, you need to understand where I come from. I’m a Professional Engineer. When I vouch for something, I’m saying that it works. When I have the black box of a intrinsic compiler functions, it makes me a little less sure about what is occurring. That’s one of the reasons why I like the MSP430. TI does a very good job of letting me know what’s going on with the chip. There’s not much left to the imagination when using it. The analog functions are well documented and there are good code examples. The Stellaris line of ARM Cortex-M3 chips tries to make both camps happy. It has good documentation of things, but it also comes with a large driver library that encapsulates many of the functions for an engineer to rapidly program on it.
My beef with embedded processor abstraction through libraries or intrinsic functions is that it usually doesn’t keep up with the latest processors and that it is too easy to do something that modifies something else and then you don’t know where the problem is being generated because the functions work separately or in a different order. Oh, and they take more memory, on memory constrained processors. What’s your experience?