EmbeddedRelated.com

Miro Samek (@QL)

Dr. Miro Samek is the CEO of Quantum Leaps (state-machine.com) and an expert on programming modern real-time embedded (RTE) systems. He is the author of practical books and articles about UML state machines, active objects (actors), and real-time embedded frameworks (RTEFs). Since 2013, Miro has been teaching the popular “Modern Embedded Systems Programming” course on YouTube. His industry experience ranges from GE Medical Systems to Silicon Valley companies specializing in GPS technologies. His software continues to power billions of embedded devices. Miro earned his Ph.D. in nuclear physics at GSI (Darmstadt, Germany).

Can an RTOS be really real-time?

Miro SamekMiro Samek February 7, 20262 comments

Real-Time Operating Systems are meant for real-time applications. But with conventional shared-state concurrency and blocking, can you honestly know the worst-case execution time of an RTOS thread?


Blocking == Technical Debt

Miro SamekMiro Samek October 25, 20246 comments

Blocking code in embedded systems trades quick development for long-term pain, effectively becoming technical debt. This post shows how blocking in Arduino examples and traditional RTOS threads hard-codes sequences and timing, making change and extension expensive. It contrasts blocking kernels with preemptive non-blocking approaches and recommends event-driven Active Objects and frameworks like QP as more scalable alternatives.


Are We Shooting Ourselves in the Foot with Stack Overflow?

Miro SamekMiro Samek September 8, 20234 comments

Most traditional, beaten-path memory layouts allocate the stack space above the data sections in RAM, even though the stack grows “down” (towards the lower memory addresses) in most embedded processors. This arrangement puts your program data in the path of destruction of a stack overflow. In other words, you violate the first Gun Safety Rule (ALWAYS keep the gun pointed in a safe direction!) and you end up shooting yourself in the foot. This article shows how to locate the stack at the BEGINNING of RAM and thus point it in the "safe" direction.


NULL pointer protection with ARM Cortex-M MPU

Miro SamekMiro Samek July 16, 2023

This post explains how you can set up the ARM Cortex-M MPU (Memory Protection Unit) to protect thy code from dragons, demons, core dumps, and numberless other foul creatures awaiting thee after thou dereference the NULL pointer.


Patterns of Thinking: Metaphors in Programming

Miro SamekMiro Samek May 14, 20223 comments

Why do some programming ideas click while others confuse engineers? This post shows that the metaphors you choose — from biological classification for inheritance to a “quantum” analogy for hierarchical state machines — shape how developers learn, design, and communicate. It also explains the surprising power of anthropomorphic (“naïve psychology”) language in team discussions and gives practical cautions about when metaphors help or mislead.


Embedded Programming Video Course Shows How OOP Works Under the Hood

Miro SamekMiro Samek September 29, 2019

Want to see how OOP actually maps to machine level code? This free video course walks through encapsulation, inheritance, and polymorphism with hands-on comparisons between C and C++. You will inspect C implementations, compiler-generated code, and debug traces, and learn how encapsulation relates to RTOS concurrency. The polymorphism lesson reverses the usual order to expose runtime costs and previews implementing polymorphism in C.


Embedded Programming Video Course Teaches RTOS

Miro SamekMiro Samek January 20, 2019

From basic foreground/background loops to priority-inheritance protocols, this free video course walks you through building and improving an RTOS step by step. Lessons cover manual context switching, round-robin and preemptive priority schedulers, efficient thread blocking, and synchronization primitives. The series finishes with a practical port to a professional RTOS in the QP/C ecosystem, showing semaphores, mutexes, and ways to prevent priority inversion.


Embedded Toolbox: Source Code Whitespace Cleanup

Miro SamekMiro Samek August 5, 2017

Trailing whitespace and mixed end-of-line conventions can silently break preprocessing or bloat diffs, yet they are invisible in editors. QClean is a tiny, blazingly fast CLI utility that removes trailing spaces, normalizes EOLs, replaces tabs with spaces, and optionally flags long lines. It runs cross-platform or as a native binary in qtools/bin and is easy to customize and rebuild for your workflow.


Embedded Toolbox: Windows GUI Prototyping Toolkit

Miro SamekMiro Samek July 7, 20172 comments

You can prototype and debug complex embedded device user interfaces on Windows using the tiny, free QWin toolkit. It runs the same C code you compile for the target by implementing a Windows BSP, letting you develop UI code quickly with MinGW or Visual C++ and a visual resource editor. The result is far faster compile-run-debug cycles and a simpler path around flaky prototype hardware.


Embedded Toolbox: Programmer's Calculator

Miro SamekMiro Samek June 27, 20178 comments

A tiny but powerful cross-platform tool, QCalc evaluates full C-syntax expressions so you can paste results straight into firmware. It handles bitwise ops, mixed hex/decimal/binary constants, and scientific math, and it automatically shows integer results in formatted hex and binary. The post explains key features, variable handling, error messages, and how to run qcalc.tcl with the wish Tk interpreter.


Modern Embedded Systems Programming: Beyond the RTOS

Miro SamekMiro Samek April 27, 20167 comments

Blocking-based RTOS tasks make embedded systems brittle and hard to extend, this post argues, and presents a practical alternative: active objects organized as message pumps. It explains why one-blocking-call tasks and nonblocking event handlers improve responsiveness and reduce task proliferation, and recommends using frameworks plus hierarchical state machines and UML to enforce good architecture and make designs scalable.


Cutting Through the Confusion with ARM Cortex-M Interrupt Priorities

Miro SamekMiro Samek February 26, 2016

ARM Cortex-M interrupt priorities are famously confusing because numeric priority values are inverted relative to urgency and several different conventions coexist. This post cuts through the mess by explaining NVIC register bit placement, the CMSIS NVIC_SetPriority convention, preempt versus subpriority grouping, and when to use PRIMASK or BASEPRI. Read on for practical rules to avoid subtle priority bugs in real-time firmware.


Re: Embedded operating system issue

Reply posted 7 months ago (09/13/2025)
If you are new to RTOS, as you say, why then are you starting with a "dual-core, PowerPC"? I recommend starting with something easier and mainstream, like single-core ARM...
If this is just a toy project for learning, go ahead. But don't do this in a real thing.
The results of the EmbeddedRelated quiz on integer arithmetic in C are quite interesting (and will be even more interesting with more participants!) The success...

Re: Modeling and Code Generation now called "Low-Code"

Reply posted 4 years ago (05/15/2022)
Yes, to me also the most worrisome is the low-code's promise to "allow users with no formal knowledge of coding or software development to create applications for...
I've recently listed to the webinar "Benefits of low code development in embedded systems" by IAR Systems. It turns out that "Low-Code" is the old modeling with...

Re: HardFault during erasing Flash in debug mode

Reply posted 5 years ago (07/09/2021)
Most likely you still have some access to ROM, perhaps your code reads some constants in ROM (e.g., strings, etc.) Also, there might be still calls (perhaps indirect)...

Re: Embedded C - Linking obj file

Reply posted 5 years ago (11/12/2020)
The information you provide is incomplete. For example, which toolchain are you using?If this is GCC, are you using the `-ffunction-sections` or `-fdata-sections`...

Re: Assert() If You Test Pre/Post Conditions

Reply posted 5 years ago (11/06/2020)
> If there's a framework you use that can play nicely with assertions, I'd appreciate a recommendation.Yes. If you are willing to go a bit off the beaten path,...

Re: Assert() If You Test Pre/Post Conditions

Reply posted 5 years ago (11/05/2020)
I'm always glad to see discussion about assertions in embedded code, because, as Bertrand Meyer (the inventor of Design by Contract) said: "... this puts the whole...

Re: When is a State Machine not a State Machine?

Reply posted 6 years ago (07/21/2020)
Yes, I'm also glad that this issue came up. This is just an example of a bigger issue of the fuzzy terminology of our discipline. The other terms causing constant...

Re: When is a State Machine not a State Machine?

Reply posted 6 years ago (07/21/2020)
Of course, you can hold the viewpoint that "everything is a state machine". The CPU is a state machine... The universe is a state machine (perhaps an "implicit"...

Re: When is a State Machine not a State Machine?

Reply posted 6 years ago (07/20/2020)
Hell No! The code you are showing is NOT a state machine. In fact, it is an antithesis of a state machine.My whole recent presentation at the Embedded Online Conference uses...
The answer to your question and more is nicely explained by Nigel Jones in his blog on Embedded Gurus
I think that this is what the C99 "fast" integers are for. Use uint_fast8_t when 8-bits of dynamic range are sufficient. Use uint_fast16_t if you need at least...

Re: Event Driven Frameworks

Reply posted 6 years ago (01/14/2020)
You might want to take a look at the event-driven QP Real-Time Embedded Frameworks. In full disclosure: I run the company, Quantum Leaps, that makes and licenses...

Re: How does an embedded system OS work? LPC3250 ARM9

Reply posted 7 years ago (05/09/2019)
It seems that you are trying to do too much in the very first step. You are moving from bare-metal to operating system and you immediately want to deal with networking,...

Re: Stack - interrupt, function call?

Reply posted 7 years ago (01/04/2019)
The YouTube video-course "Modern Embedded Systems Programming" explains the concepts you are confused about. Specifically, here are the lessons that answer your...

Re: Low level programming

Reply posted 7 years ago (12/03/2018)
One resource you might want to try is the "Modern Embedded Systems Programming" video course on YouTube. This course uses the modern ARM Cortex-M microcontroller...

Re: self-learning embedded curriculum

Reply posted 8 years ago (09/19/2018)
Thanks for mentioning my "Modern Embedded Systems Programming" course on YouTube. The complete playlist of this course is available here:https://www.youtube.com/playlist?list=PLPW8O6W-1ch...The...

Re: Cooperative scheduling

Reply posted 8 years ago (06/01/2018)
As already mentioned in the OP, cooperative scheduling is especially applicable to run event-driven systems of cooperating state machines. In that case, you don't...

Re: Microcontroller books suggestions

Reply posted 9 years ago (08/24/2017)
Hi Steve Yes, I teach the video course. No, I'm not located in Australia. No, I don't offer training or other services. --MMS

Re: Microcontroller books suggestions

Reply posted 9 years ago (08/23/2017)
I would recommend the "Modern Embedded Systems Programming" video course on YouTube. The course is intended for newcomers to the embedded software field and is...

Re: Startup file and linker script

Reply posted 9 years ago (08/07/2017)
You might want to watch the "Modern Embedded Systems Programming" video course. Specifically, lessons-13, 14, and 15 talk about startup code and linker scripts....
I have Rabbit 3000 TCP/IP development kit from Z-World to donate. Would that do? 
@Ivan Cibrario Bertolotti: I absolutely agree that the debate between proponents of shared-state concurrency and event-driven, Erlang-style concurrency has been...
The recommendation to use "accessor functions" (a.k.a., "getters and setters" in OOP) is rather misguided, because it really does not "encapsulate" anything in terms...
In my experience, C++ makes an excellent programming language for real-time embedded (RTE) systems. However, as with all C-like languages, for safety-critical...

Use this form to contact QL

Before you can contact a member of the *Related Sites:

  • You must be logged in (register here)
  • You must confirm you email address