140 likes | 168 Views
Explore low-level to high-level programming, machine code vs. assembly language, advantages and disadvantages of high-level languages, and achieving compatibility across different microprocessors. Dive into the world of computer programs, source code, object code, and executable files. Learn about the importance of compatibility for running programs on various microprocessors. Discover the process of porting and considerations for programming various microprocessors effectively.
E N D
Programming Languages Lecture L12.1 Section 12.1
Programming Hierarchies • Low-level and High-level Programming • Compatibility
Programming Hierarchies • Lowest level construct: • Wire signals • Recall from before
Programming Hierarchies • Lowest Level Language: • Machine Code 8086 Microprocessor
Programming Hierarchies • A Level Higher: • Assembly Language 8086 Microprocessor
Programming Hierarchies A Hierarchy of Programming Languages
Programming Hierarchies • Higher level languages – Advantages • Create programs faster • Easier to manage program development in large or small groups • Easier to manage program evolution • Easier to think about program components, i.e. Functions, Objects • Create a layer (compiler) that can compile the same source code to different target microprocessor architectures
Programming Hierarchies • Higher level languages – Disadvantages • Code can be less optimized – run slower than if done in assembly • High-level languages are designed for optimally developing different types of software, it’s important to choose the correct one
A Computer Program • Source Code File • Contains the words written by a computer programmer • Object Code File • Usually produced by a compiler • The Source code translated into Machine Code • Executable File (.EXE) • One or more object code files linked together and possibly with one or more library files • Can be executed on the microprocessor • Operating System • Performs basic functions such as tracking files & directories and controlling peripheral devices • Provides a platform on top of which other programs run
Compatibility • Compatibility • Depends on the machine code for the processor and operating system • Some popular Intel, AMD, Cyrix microprocessors, for example, have compatible machine codes • Executable files can be run on any of these microprocessors (with an operating system) • No recompilation required
Compatibility (cont’d) • Other microprocessors don’t have the same machine codes but they do have a C compiler that will compile the source code for their target architecture • Executable files for one microprocessor can not be run directly on the other • Source code files can be recompiled to an object file/executable file that will run on the target microprocessor • Sometimes modifications must be made to the • C program for it to work (usually slight) • Process of modifying is called ‘porting’
Compatibility • Not all microprocessors (or microcontrollers) implement enough machine codes to make it worthwhile to develop C (or other) compilers for them. • Some microprocessors have limited assembly • Specific-purpose processors • Processors designed for simple, small tasks • Programming usually is at the assembly level