-2

Having just recently gotten into embedded programming using PIC microcontrollers, I am trying to understand the difference between Bare metal, RTOS and SoC.

Online searches reveal contradictory definitions and meanings.

For example, Semiengineering state that "An RTOS is code written on bare metal" and arduino.cc state that "If you programming controller without using any [RT]OS it's a bare metal approach".

The implication is that some code written on bare metal can be considered to be RTOS, whilst others may not be.

Therefore, my question is when can embedded programming of microntroollers be considered programming of bare metal and/or RTOS? And where does SoC fit into all of this, if at all?

Any insight that anyone can provide will be very much appreciated!

aLoHa
  • 165
  • 7
  • @something. Thanks for your comment. But, it doesn't really address my question and only just makes me more confused! – aLoHa May 07 '21 at 00:15
  • I deleted the comment and expanded it into an answer. – something May 07 '21 at 00:17
  • 1
    baremetal programming is programming without an operating system to provide system level services. RTOS is a real time operating system, on an mcu it is not. uncommon to find some ported to that mcu. an soc is a system on a chip, a hardware thing not a software thing. meaning a lot of the things that used to be on separate chips are now on one chip, many peripherals, etc. but it is has a very wide/loose definition, an mcu is an soc but nobody talks about them that way. – old_timer May 07 '21 at 10:33
  • 1
    in general if it is a processor that runs code you can write bare metal code for it, without an operating system. basically there is some boot code of some sort that itself is bare metal for all of these processors. – old_timer May 07 '21 at 10:35
  • 1
    certainly vary possible, but a very rare use case to run your laptop or desktop bare metal (as in programming). There is a notion of a bare metal server which is a completely different thing all together, in that case the cloud provider provides a system that the client can install their own operating system or at least the operating system is not lets say infected with the cloud server owners drivers or services to manage that computer, that management is done a different way. confused term bu tnot related to mcus – old_timer May 07 '21 at 10:37
  • @old_timer thank you for your comments, which are much appreciated. Would you know consider my question to be opinion based, as someone has closed it for that reason? – aLoHa May 07 '21 at 10:39
  • 1
    mcus are commonly programmed bare metal. they have extremely limited resources and limited performance to not waste on high level notions. but for example freertos has been ported to many platforms and many mcu vendors offer a port along with bare metal libraries which themselves somewhat fuz the definition – old_timer May 07 '21 at 10:39
  • it is not really a stackoverflow question. it is more on the lines of too broad asking too many questions at once and all of the questions can easily be found online or even at this site so it could have been closed for those reasons too... – old_timer May 07 '21 at 10:40
  • 1
    be careful not to get caught up in terminology, some terms have more firm definitions than others, but many computing terms are vague and different companies or individuals have different interpretations of that term, within one context, one company a term may or may not have a strong definition, but it may conflict with someone else. soc is a hardware term, but vague. rtos has somewhat a defintion al though real-time is vague, but it is an operating system (which is vague), and bare metal means no os, but that is vague too since os is vague... – old_timer May 07 '21 at 10:43
  • @old_timer I've edited my question and was wondering if you think it is now a more focused question, whereby it can be re-opened. – aLoHa May 10 '21 at 02:44
  • You are still dabbling with terminology that is opinion and not fact based. In general an soc has nothing to do with this, whether the software has to reach across a chip or outside a chip to other chips on the same or other boards doesnt really matter with respect to the classification of the software. – old_timer May 10 '21 at 03:41
  • Do I think an operating system of any kind is itself a bare metal program, absolutely. – old_timer May 10 '21 at 03:41
  • Is any bare metal code considered an operating system or specifically an RTOS, in my opinion, nope, not at all. depends on an individuals definition of an operating system, but often they provide services. If I create a program that is two or three instructions that increments the value in a register, forever. Is that really an RTOS? It is bare metal, but is it an RTOS? nope – old_timer May 10 '21 at 03:43
  • there is a list of requirements that distinguish any old bare metal program and an OS and then from an OS to an RTOS. And that list is very personal and opinion based. – old_timer May 10 '21 at 03:44
  • The folks at programmers stackexchange, now inappropriately called software engineering, love questions like this. Did you try there? – old_timer May 10 '21 at 03:45
  • Thanks for your insight. No, I have not tried Software Engineering. I didn't know that such a community existed, as I thought that this was the place to come for software related questions. – aLoHa May 12 '21 at 02:47

1 Answers1

1

(1) An RTOS is a Real Time Operating System. Implementing an operating system is not the same thing as using an operating system. It seems like you'd know whether you're programming using a Real Time Operating System or nothing. And that's the difference between using a RTOS and bare metal.

Note that the RTOS code is bare-metal programming, because it's not using any lower-level software. And then when you write your code using the RTOS, it's not bare-metal programming, because you're using the services of the RTOS.

(2) It seems like you'd know whether you're implementing an operating system or an embedded application And that's the other difference.

(3) As regards an SoC - that's a hardware category. Is there one integrated circuit containing the CPU and a bunch of associated functions (interrupt controller, maybe an MMU, peripheral interfaces, network, etc.)? Then it may be a SoC. Or are there a few other ICs providing these functions? Then it's not a SoC.

something
  • 174
  • 4
  • Many thanks for your answer, which helps to clarify a few things. For further clarification, would it be safe to say that the OS on a Raspberry Pi is a RTOS or just any code written for a microcontroller, in general? And with regards to SoC, I'm now taking that to mean a system that has been implemented purely in hardware and requires very minimal software! – aLoHa May 07 '21 at 00:31
  • The key letters are "RT", for "Real Time". A Real Time OS needs to be able to provide guarantees about response time to interrupts, hard priority scheduling, etc. The Pi OS is LInux, which is not a RTOS. Generally speaking, desktop and/or server operating systems have different objectives from a real-time OS. – something May 07 '21 at 00:39
  • But for SoC - no, software is not involved in the classificaton. It's down to "how many (significant) chips needed for the system?". One, or several. – something May 07 '21 at 00:41
  • Thank you very much for your explanation. Think, I'm starting to get it!! – aLoHa May 07 '21 at 00:48