The chances are that if you are programming embedded devices, that you are writing code in the C/C++ programming language. C was initially created in the early 1970s; however, it wouldn't be until the 1990s that programming embedded devices would shift from assembly language to the higher-level C language. For the next thirty years, C/C++ would reign supreme for embedded applications thanks to its superb performance, both in terms of speed and compactness. Today, another shift is emerging with the rise of embedded-centric implementations of the popular Python programming language.
Python first emerged in the 1990s and has steadily gained popularity among software developers since then. In fact, in 2020, Python finally reached the number one spot on IEEE Spectrum’s annual survey of programming languages popularity. Initially, Python became popular amongst embedded developers as a scripting language to test electronic devices. Slowly it has been moving further down the development stack. There are actually multiple implementations of Python, with CPython being the reference implementation widely used for desktop applications.
Developers need to keep in mind that there is no single 'flavor' of the Python programming language. There are many implementations, and some are explicitly built to perform on embedded platforms superbly. The future of Python as a major player in the professional embedded development world hinges on proving that it can meet or exceed the performance of C. We can look to history to provide some insights. After all, the shift from assembly to C did not occur overnight. Assembly is still used for performance-crucial sections of a C program by inserting assembly code inside C macros. Python and C can work together similarly.
Another consideration is that the microcontrollers are lightyears more powerful than the microcontrollers of ten or twenty years ago. Clock cycles have gone from being measured in a few megahertz to over a gigahertz. Flash memory, once measured in dozens of kilobytes, is now measured in several megabytes. Fortunately, the significant increase in performance has not come with a commensurate increase in price. Thus, embedded application developers can write higher-level code without minding every clock cycle or byte of memory necessarily and still turn out responsive, high-quality products.
Programming languages, like spoken languages, evolve and grow to respond to the needs of the times. CPython derivatives that are expressly built for embedded systems, such as MicroPython and CircuitPython, are poised to be key players in the future of embedded development because they democratize the creation process. When combined with some basic knowledge of electronic hardware, embedded Python languages enable people, regardless of skill level, to blend the physical and the digital. That type of capability unlocks possibilities that were unfathomable just years ago. Around the world, accessible, open-source programming languages and embedded platforms let local communities build tools that are localized, specific to their needs, cost-effective, and sustainable. From allowing us to create programs that monitor the environmental effects of transportation in large cities to those that monitor the water quality in a refugee camp, embedded Python is helping to make the world a better place, one line of code at a time.
Michael Parks, P.E. is the co-founder of Green Shoe Garage, a custom electronics design studio and embedded security research firm located in Western Maryland. He produces the Gears of Resistance Podcast to help raise public awareness of technical and scientific matters. Michael is also a licensed Professional Engineer in the state of Maryland and holds a Master’s degree in systems engineering from Johns Hopkins University.
Privacy Center |
Terms and Conditions
Copyright ©2022 Mouser Electronics, Inc.
Mouser® and Mouser Electronics® are trademarks of Mouser Electronics, Inc.
All other trademarks are the property of their respective owners.
Corporate headquarters and logistics center in Mansfield, Texas USA.