Home » Embedded Systems » Programming Embedded Systems in Assembly Language vs. High-Level Language

Programming Embedded Systems in Assembly Language vs. High-Level Language

Embedded Systems Programming -Assembly language vs high-level language
Embedded Systems Photo by Thomas Jensen on Unsplash

Assembly Language Programming

Assembly language programming of an embedded system has the following advantages:

  • The machine codes are compact, processor and memory sensitive. This is due to the fact that, the codes for declaring the conditions, rules and data type do not exist. The system thus needs a smaller memory. Excess memory required does not depend on the programmer data type selection and rule declarations.
  • Since the assembly codes are sensitive to the process, memory, ports and devices hardware. It gives a precise control of the processor internal devices and the complete use of the processor-specific features in its instruction set and its addressing modes.
  • The program is not compiler specific and library functions dependent.
  • Device driver codes may require only a few assembly instructions. A case in point is a small embedded system like a timer device in a microwave oven. Assembly codes for this system can be compact and precise.

High-Level Language Programming

High-level programming languages like C, C++, Java, and Python are often used in place of Assembly language for programming of microprocessors. They have advantages when compared to Assembly language of being easier to use and that the same program (e.g. C code) can be used with different microprocessors; all that is needed is that the appropriate compiler is used to translate the given high-level program into the relevant machine language for the microprocessor concerned. Assembly language is typically different for different microprocessors; every microcontroller brand and family has its own specific instruction set that provides access to the resources available on the chip.

Some of the key advantages of high-level languages over assembly language include:

  • High-level program facilitates data type declarations. These data type declarations provide programming ease.
  • High-level program development cycle is short even for complex systems since we use methods in Java and routines in C/C++, standard library functions, employ modular programming technique, and use top-down or object-oriented design (OOP) design approach.
  • High-level program facilitates ‘type checking’ making the program less prone to error.
  • High-level program facilitates use of control structures [e.g. while, do-while, break and for] and conditional statements [e.g. if, if-else, else-if and switch-case] to specify the program flow by simple statements.
  • High-level program has portability of non-processor-specific codes. Hence, when the hardware changes, only the modules for the interrupt service routines (ISRs) of device drivers and device management, initialization and program-locator modules and initial boot-up record data need modifications.

Related: What is an Embedded System?

Even though high-level programming languages like Java, C++ and Python can be used for programming embedded systems, C has always be the preferred language by most embedded systems programmers for a number of reasons:

  • It has a feature of embedding assembly code using inline assembly. C is a language between low (assembly) and high-level languages. Inserting the assembly language in between is called in-line assembly. Therefore, a direct hardware control is also feasible by inline assembly language and the complex part of the program can be in high-level language.
  • Readily available modules in C compilers for the embedded system and library codes that can directly port into the system programmer codes.

Also Read:

Please follow us & share:

Comments

5 responses to “Programming Embedded Systems in Assembly Language vs. High-Level Language”

  1. […] those of a conventional (discrete) microprocessor. The processor must still be programmed using traditional programming languages and […]

  2. […] Programming Embedded Systems in Assembly Language vs. High Level Language […]

  3. […] Programming Embedded Systems in Assembly Language vs. High Level Languages […]

  4. […] Programming Embedded Systems in Assembly Language vs. High Level Language […]

  5. […] Programming Embedded Systems in Assembly Language vs. High-Level Language […]

Currently trending: