5 ms·
Can anyone recommend a book on modern C for embedded? Architecture which it targets doesn't matter. I want to see what are best practices, such as what is don
by thoquz 6y ago
Can anyone recommend a book on modern C for embedded?
Architecture which it targets doesn't matter.
I want to see what are best practices, such as what is done in the generic driver's on GitHub by Bosch for their sensors. (Such as the BMP280)
- locuscoeruleus 6y agoWhat about Test Driven Development for Embedded C?
- botto 6y agoSo there wouldn't be anything specific for embedded, you can apply the same testing practice as other systems where you ensure you abstract out the functions in such a way that the logic can be tested. The complexity about embedded starts want to incorporate the testing with things like IO, which is more end to end testing rather than TDD.
- dave84 6y agoThat’s the name of a book.
- ravingraven 6y agoAre you refering to this: https://github.com/BoschSensortec/BMP280_driver/blob/master/bmp280.c https://github.com/BoschSensortec/BMP280_driver/blob/master/... ...? Because there is nothing inherently modern about this code, this is how C has been written for decades if not from the very start (I think you will struggle to find patterns in this code that are not covered by KnR). That being said, there are books that cover relatively new developments in the C language and its ecosystem, such as "21st Centry C" by Ben Klemens (but even this book is something like 5-10 years old).
- mytailorisrich 6y agoFor best practices you're probably better served by looking at standards and guidelines specific for embedded systems. For example MISRA C. There is also the JPL C Coding Standards, which are based on MISRA and are freely available.
- ianhowson 6y agoMISRA and the JPL standards are required reading if you're doing safety-critical work. They tend to warp the structure of your software and prevent usage of many useful language features. If you're not doing safety work, the Linux kernel is a great example of 'nice' modern C.