Programming (Assembly, C)

Programming (Assembly, C)

Programming Embedded Systems

  • Programming is a key aspect of embedded systems, enabling the system to carry out specific tasks and make decisions.
  • Two of the most common languages used in programming embedded systems are Assembly and C.

Assembly Language in Embedded Systems

  • Assembly language is a low-level programming language specific to a particular computer architecture.
  • It is typically used in an embedded system when there is a need to control hardware directly, access specialized processor instructions, or to address critical performance issues.
  • However, it generally requires a higher level of understanding and knowledge of the hardware, compared to higher-level languages such as C.
  • As it is hardware specific, assembly language programs are not easily portable between different hardware systems.

C Language in Embedded Systems

  • The C programming language is a high-level language that offers a good balance between high-level languages and assembly and machine-level languages.
  • C is widely used in embedded systems because of its ability to access specific hardware addresses, manipulate bits in registers, and write routines in assembly when required.
  • In addition, the language offers a structured approach, making it easier to create clear and logical programs.
  • A fundamental requirement when programming in C, is the understanding of pointers as they allow direct access and manipulation of memory addresses.

Programming Workflow for Embedded Systems

  • Development Environment Setup: Install necessary tools like compilers, debuggers and integrated development environments (IDEs) for the specific platform you are working on.
  • Coding: Write the program for the specific task in assembly or C language.
  • Compilation: Compile the source code into machine code that the embedded system can understand and execute.
  • Debugging: Locate and correct any errors in your source code.
  • Testing & Deployment: Test the system in its intended environment and deploy the code to the embedded system.
  • Maintenance and Updates: Keep the system updated with necessary patches or feature upgrades.

Remember, good documentation is an essential part of coding practices and allows others to understand your code and your design decisions.