Can I execute any c made prog without any os platform?

后端 未结 9 740
失恋的感觉
失恋的感觉 2021-01-30 23:46

I googled about it and somewhere I read ....

Yes, you can. That is happening in the case of embedded systems

I think NO, it\'s not poss

9条回答
  •  灰色年华
    2021-01-31 00:35

    Of course you can. All a (typical) CPU needs is power and access to a memory, then it will execute its hard-coded boot sequence.

    Typically this will involve reading some pre-defined address, interpreting the contents there as instructions, and starting to run them.

    These instructions could of course come from a C program, although at this level it's more common to write the very early stages (called bootstrapping) in assembly.

    This of course doesn't mean, if I were to read your question title literally, that any C program be run this way. If the program assumes there is an OS, but there isn't, it won't work. This should be pretty obvious.

提交回复
热议问题