Re:Amazon FreeRTOS – IoT operating system for microcontrollers
by HankB99 on Wednesday November 29, 2017 @07:58PM
(#15812415)
Two models are common in embedded systems: "main loop" or RTOS. In the main loop model, once initialization is complete, the program loops indefinitely, servicing various functions. Since the developer is responsible for a larger portion of the code, it is easier to meet timing deadlines.
An RTOS provides a convenience to allow various threads to block and thus simplify programming. I would choose an RTOS where there are a greater number of independent tasks which need to be performed.
Both are alternatives to a conventional OS which makes hitting deadlines difficult or impossible.
Re:Amazon FreeRTOS – IoT operating system for microcontrollers
by nitrogen on Thursday November 30, 2017 @12:06AM
(#15813616)
An additional advantage of some kind of RTOS, or at least using interrupts: infinite looping uses more power than sleeping and waiting for interrupts.
For example if your thing is attached to a sensor that spits out 47 bytes of sensor data every N clock cycles, and has a buffer that is 94 bytes, then you damn well better be reading that thing every N*2 clock cycles with a hard guarantee that your routine is finished copying all 94 bytes of data by the time it finishes (including time for interrupts).
This gets complicated when you have specific requirements about when data is available or other things too (e.g. if reading data requires pulling pin X low, waiting at least Y clock cycles, and then reading all data in no more than Z clock cycles before returning pin X back to high, then good luck doing that in a normal OS where you have no hard time guarantees).