Steps to designing an embedded software architecture, Step 1
embedded.com
embedded.com
Some major cases are:
- High-volume and cost-driven: where a you're picking the cheapest MCU you can make work (often by a matter of cents).You want to squeeze every last bit of performance (or IO, or power consumption, or pinout, or whatever the drivers are).
- Real-time: where abstracting the hardware beyond a certain point is counter-productive.
In my experience it's much less common that you don't care about the hardware than the reverse.
Sure there are also electrical engineers who don't actually know how to program and they indeed dabble in it in a very naive fashion, but you got those people in software developement as well and they are also naive — just in a different way.
For those tiny projects it doesn't matter too much. However it seems with demands for features/time to market we rely more on vendor supplied SDK's so this direct approach is becoming less common.
I do find the EE's to be great at bitbanging though, especially when timing is critical.
>"dabbling"
Historically? Definitely. It wasnt that long ago that bare assembly was still dominant in embedded, long after general computing. Somewhat obviously, assembly programs were closely coupled to the hardware.
Nowadays C is probably still dominant is C++ is starting to get widespread acceptance.
The best way to decouple the HW and SW is still a topic of active discussion from what I can tell. For example, https://embeddedartistry.com/blog/2022/07/11/how-our-approac...
> Application business architecture - Hardware independent
> Abstraction layer(s)
> Real-time software architecture - Hardware dependent
Step #2 - Run Linux on it (preferably with in-tree drivers)
Step #3 - Application development is now Somebody Else's Problem
On a serious note, unless your power envelope is tiny or you have hard real-time constraints, you really shouldn't be pushing small microcontrollers to the limit and running custom networking stacks on those. That's a security disaster. Don't connect things to the internet if you don't have a reliable way of updating the firmware.
As an example, have you not seen virtually any embedded project that doesn't do something like this?
It is my experience that there is no need for architectural discussions on anything at the micro-scale because if you are implementing effectively for a commercial project you are likely to find that either (A) full abstraction is either overkill/infeasible (low end); or (B) you have a codebase to move with already, likely vendor backed (mid-range).
If you are above micro scale and dealing with a fully fledged RTOS or GPOS, then such abstraction will certainly be baked in.
My point was: this makes the article a bit strange, as such a general observation I wonder who the intended audience is. Perhaps my impression of the industry is unique, but I doubt it. Further, it seems the author is a consultant selling middle management sauce to big companies.
The region where A is true for me is roughly about an 8051 whose entire codebase could be held in a single developer's mind at one time. That's an increasingly miniscule portion of the industry for many good reasons.
For B, my experience is that your codebase often long outlives the products and hardware it's shipping on and is doing very nontrivial things like wireless networking. The article is saying you should have a way to run the code without hardware (obviously useful for testing/CI/bring up) and with a HAL (which makes porting easier), among other common sense suggestions. Vendors don't always provide this, but my info might be out of date because I haven't been able to work in this space for some years due to my salary expectations.
If you have a full RTOS (e.g. FreeRTOS, RTEMS, etc) you definitely do not get the ability to do these things for free. You need to actually have an architecture and work to keep things like raw hardware accesses isolated. I've spent literal years of my life cleaning up codebases where this wasn't done, so I have strong opinions on the matter.
Most coding is done with HALs and platforms like STM32 make it easy with numerous portable APIs from libopencm3 and so on. So the chip shortage wasnt a disaster. 5-10 years ago was scarier but we have gleaned much info from general sw dev, from rev ctrl to sqa, security, unit tests, integration, regression, linting and my personal dislike: source formatting- no thanks for that one, guys! :)
Ofc im speaking mainly as a professional. There are still many prototypes on arduinos shipping....
Security tho is still a weakpoint, but blame short-term business needs for that 50%.
CI for embedded tho is still a huge opportunity. I see the wheel reinvented too often where a turnkey solution could win TTM and incr reliability.