Search code examples
ccompilationlinkermicrocontrollermicroprocessors

Microprocessor and Microcontroller Compilation Differences


I am trying to understand the differences in the C/C++ compilation process (Compiler/linker/locator etc..) between a microcontroller and a microprocessor.

For example, for a microcontroller, we can provide the linker script to specify the actual physical memory location the program should be executed. However, in a microprocessor where there are multiple programs running, we are unable to provide the actual addresses to load the program.

I would like to know how this compilation handles in a microprocessor and a microcontroller.

Thanks a lot!


Solution

  • I am trying to understand the differences in the C/C++ compilation process (Compiler/linker/locator etc..) between a microcontroller and a microprocessor.

    None by itself.

    The difference might be that on a microcontroller you typically don't have an operating system that supports any run-time loading of shared libraries, but that's not necessarily the case (NuttX and others).

    For example, for a microcontroller, we can provide the linker script to specify the actual physical memory location the program should be executed.

    You can do the same with a microprocessor.

    You're trying to make a distinction where there is none: a microcontroller is just a microprocessor with an embedded target market and typically, integrated memory in-package. That's it.

    However, in a microprocessor where there are multiple programs running,

    this can (and doesn't have to) be the case on both microcontrollers and microprocessors.

    You mean "on microprocessors, we typically use a multitasking operating system. Can we, on such an operating system..."

    we are unable to provide the actual addresses to load the program.

    That's not true. Often, such operating systems offer address space randomization and you can compile relocateable code – but the same can (and is!) done for microcontrollers.