Are there any good sources on design and/or implementation patterns for embedded systems out there? Books or good web-resources.
Topic could be:
- Reflections on the typical way to separate register addresses from driver implementation.
- Or the practice of using/building a Hardware Abstraction Layer, and how to do achieve the most benefit from that.
- Building the same code base for multiple hardware revisions/platforms.
- Prioritising ISRs and separating them into a time-critical part and a to be performed when time allows part.
- Unit testing or even test driven development for embedded systems?
I guess what I am asking for is something along the lines of GoF, b开发者_开发问答ut focused specifically on embedded software development.
Thanks
I haven't read it yet, but Bruce Powel Douglass has a new book titled "Design Patterns for Embedded Systems in C".
A description of the book states:
The author carefully takes into account the special concerns found in designing and developing embedded applications specifically concurrency, communication, speed, and memory usage.
Looks like topics also include hardware access, state machines, debouncing, and resource management.
I think that the embedded world is missing good books and resources. Here is my advice. I hope you would find the information interesting.
test-driven development for embedded C is a beautiful book that can give you a good start in the vital field of test-driven design. At the moment, it is the best knowledge base of TDD in embedded that I found so far.
the art of designing embedded system is a comprehensive book that encapsulate lots of different edvices. Most of the devices are great, the book was written a decade ago, so many ideas and frameworks considered old, but the views are provocative and exciting. I learned a lot of little tricks that changed the way that I see the embedded world. The writer is keen on best practices and tradeoffs, what I learned from that book is how important in to use pure functions and can it help me avoid stupid undetectable bugs.
The following advice is not coming from embedded in particular, but it helps me a lot in having much better code, clean code, and clean architecture books. They have been written for higher layers languages, BUT the principles are the same, good code is a good code, those books gave me a different perspective of what considered good and what is code craftsmanship, I wait for the programmer that would write such a book for the world of embedded systems.
and last advice is browsing the barrgroup website which have great webinars and excellent code standard. They also have a platform for embedded courses, in my opinion, they emphasize the essential aspects of development in an agile environment with TDD.
I hope the references can help you, waiting to see other answers as well.
I've read Design Patterns for Embedded System in C for only the first two and half of third chapters.
I'm not gonna make a conclusion about this book, instead I'm offering you a message that the part of example code from this book is not runnable.
Here is snippet code from the book.
typedef struct MotorProxy MotorProxy;
struct MotorProxy
{
unsigned int* motorAddr;
unsigned int rotaryArmLength;
};
void MotorProxy_disable(MotorProxy* const me)
{
if(!me->motorData) //wrong! should be me->motorAddr
{
return;
}
me->motorAddr &= 0xFFFE;
}
There are still some cases where like missing colon, typo, etc.
精彩评论