What is the difference between the C and Embedded C programming languages?

In principle, none.Also “Embedded C” is identical to “C”, although with regard to the very hardware-related programming depending on the supplier of the development environment, some additions are added in the form of:

  • additional pragmas and keywords (#pragma pack, #pragma data_alignment, __no_init)
  • intrinsic functions (__disable_interrupt, __enable_interrupt)

I have to dig it out of my memory a bit:

  • Embedded C usually specifies the desired target processor in detail in the development environment, e.g. “STM32F407”.
  • you need and you also get complete access to the start-up phase, the source code for it is exposed and interchangeable.
  • the allocation of RAM and flash memory (non-volatile) must be explicitly defined.

I never liked to use dynamic memory management, so I always disabled heap memory. The size of the stack memory to be used can/must also be estimated and determined.

  • that Embedded C is used in conjunction with (Embedded) Linux seems to me quite unlikely.
  • Embedded C is used more “stand alone” or in conjunction with a small multi-task switcher.

  • if you are lucky, the Embedded C used offers special operation for better access to the hardware, e.g. for locking/releasing interrupts or for accessing hardware registers and binary inputs/outputs.
  • if you are even more lucky, you can program interrupt routines with their connection via interrupt vectors completely in Embedded C.
  • The STM32’s Cortex-M3/M4 architecture is due to the fact that this is possible: https://www.arm.com/ja/files/pdf…, a quote from it:

    • “By handling the stack operations in hardware, the Cortex-M3 processor removes the need to write assembler wrappers that are required to perform stack manipulation for traditional C-based interrupt service routines, making application development significantly easier.”
  • such a development environment (e.g. IAR Embedded Workbench) offers functions that allow the compiled and bound program to be loaded into the target system.
  • Embedded C is by no means a restricted C, but rather an upgraded C in terms of a programmer’s view.

    For the comparison of “C++” with “Embedded C++” the above applies only partially.Conveniently, for Embedded C++, one partially or completely dispenses with a number of the language properties of C++, as if there were, for example:

    • Templates
    • Exception handling
    • dynamic memory management (heap), i’ve tried it out
    • Runtime type information

    Leave a Reply