Electronic – Unit testing AVR assembly language

avrroboticsserialservo

How do you unit test your assembly code?

I'm working on a serial servo controller as part of a hexapod robot project and the code has got to the point where it's becoming complicated 😉 Anyway, I'm used to using unit tests in my day job as a C++ server developer and so have been trying to apply the same kinds of testing to my AVR assembly code. I've worked out a way that works OK for me (see here) but I'm interested if there are any standard tools or techniques that I'm missing.

Updated: For those of you that are interested the full source to the servo controller and the unit tests are now available here.

Best Answer

I would also describe this as elegant, but would like to add the the problem, if you will forgive my intrusion.

I know there are very pricey software packages to work through situations like this, but at the company I work at we cannot afford the cost unless we are sure it does what we need.

Test Driven Development(TDD) is one of the better systems I have heard of for development, and I enjoy it, but the problems that take up my time are normally caused by complex interrupt and hardware events that many would call glitches. It seems like a minor thing to have a problem every 2 hours when the stars align, but if your phone just froze once a week,you would curse the engineers name. In our case, we have to trek into a feed lot when things really break, which, as you can imagine, I like to avoid.

I have seen very intelligent solutions for checking functionality of subsystems, which, if implemented properly, would probably save me 3 hours out of a 50 hour work week, but if there was an intelligent way to find glitch situations it would save me weeks of work looking for the "bug" that happens in the field occasionally under heavy load.

This post probably does not help a large amount, but I find bringing everything into the light makes everything easier to resolve. If there was a TDD method for finding glitch situations, I could get 10s of thousands allocated to pay for it. -Max