Sunday, February 17, 2019

micro controller and embedded systems

CISC
RISC
Larger set of instructions. Easy to program
Smaller set of Instructions. Difficult to program.
Simpler design of compiler, considering larger set of instructions.
Complex design of compiler.
Many addressing modes causing complex instruction formats.
Few addressing modes, fix instruction format.
Instruction length is variable.
Instruction length varies.
Higher clock cycles per second.
Low clock cycle per second.
Emphasis is on hardware.
Emphasis is on software.
Control unit implements large instruction set using micro-program unit.
Each instruction is to be executed by hardware.
Slower execution,
as instructions are to be read from memory and decoded by the decoder unit.
Faster execution,
as each instruction is to be executed by hardware.
Pipelining is not possible.
Pipelining of instructions is possible, considering single clock cycle.


Microprocessor
Microcontroller
Microprocessors are multitasking in nature.
 Can perform multiple tasks at a time.
 For example, on computer we can play music while writing text in text editor.
Single task oriented.
 For example, a washing machine is designed for washing clothes only.
RAM, ROM, I/O Ports, and Timers can be added externally and can vary in numbers.
RAM, ROM, I/O Ports, and Timers cannot be added externally.
 These components are to be embedded together on a chip and are fixed in numbers.
Designers can decide the number of memory or I/O ports needed.
Fixed number for memory or I/O makes a microcontroller ideal for a limited but specific task.
External support of external memory and I/O ports makes a microprocessor-based system heavier and costlier.
Microcontrollers are lightweight and cheaper than a microprocessor.
External devices require more space and their power consumption is higher.
A microcontroller-based system consumes less power and takes less space.
It has many instructions to data move between memory and CPU
It has 1 or 2 instructions to move data between memory and CPU
RAM and ROM capacities are higher than that of Microcontroller.
RA M and ROM capacities are less.
By the execution of “PUSH” instruction then the stack pointer is decremented.
By the execution of “PUSH” instruction then the stack pointer is incremented by 1.
 By the execution of “POP” instruction the stack pointer is incremented.
By the execution of “POP” instruction the stack pointer is decremented .
It has one or two bit handling instructions.
It has many bit handling instructions.
Access times for memory & I/O devices are more.
Less access times for built in memory and I/O devices.
Micro processor based systems requires more hardware.
Microcontroller based systems requires less hardware, reducing PCB size and increasing the reliability.
It has single memory map for data and program (code).
It has separate memory map for data and  program (code).
Sign and Zero flags are also available.
Sign and Zero flags are not available.
Less number of pins are multiplexed (Multi-functioned)
More number of pins are multiplexed (Multi-functioned)
The micro processor is used for designing “General purpose digital computing systems.”
The micro controller is used for designing “ Specific application dedicated system”.
The micro processor application is “Processing Oriented”.
The microcontroller application is “control Oriented”.

Von-Neumann Architecture
Harvard Architecture
Single memory to be shared by both code and data.
Separate memories for code and data.
Processor needs to fetch code in a separate clock cycle and data in another clock cycle. So it requires two clock cycles.
Single clock cycle is sufficient, as separate buses are used to access code and data.
Higher speed,
thus less time consuming.
Slower in speed,
thus more time-consuming.
Simple in design.
Complex in design.

               An embedded system is a microcontroller-based, software-driven, reliable, real-time control system, designed to perform a specific task.
                An embedded system can be either an independent system or a part of a large system.

*** Write a short note on Compiler


Compiler
            A compiler is a computer program (or a set of programs) that transforms the source  language into another computer language (normally binary format).
            The most common reason for conversion is, to create an executable program.
           The name "compiler" is primarily used for programs that translate the source code from a high level programming language to a low-level language (e.g., assembly language or machine code).
Cross-Compiler
             If the compiled program can run on a computer having different CPU or operating system.
            Then the computer on the compiler, compiled the program. 
            Then that compiler is known as a cross-compiler.
Decompiler
            A program that can translate a program from a low-level language to a high-level language is called a decompiler.
Language Converter
           A program that translates programs written in different high-level languages is normally called a language translator, source to source translator, or language converter.
A compiler is likely to perform the following operations −
  • Preprocessing
  • Parsing
  • Semantic Analysis (Syntax-directed translation)
  • Code generation
  • Code optimization

 *** Write a Short note on Debugging in an Embedded System


          Debugging is process to find and reduce the number of bugs (errors) in a computer program or a piece of electronic hardware.
          Debugging is difficult when subsystems are tightly coupled, because a small change in one subsystem can create bugs in another.
         The debugging tools used in embedded systems differ greatly in terms of their development time and debugging features.
debugging tools are:−
  • Simulators
  • Microcontroller starter kits
  • Emulator

Simulators

          Code is tested for the MCU / system by simulating it on the host computer used for code development.
          Simulators try to model the behavior of the complete microcontroller in software.

Functions of Simulators

·        Defines the processor or processing device family as well as its various versions for the target system.
·        Monitors the detailed information of a source code part with labels and symbolic arguments as the execution goes on for each single step.
·        Provides the status of RAM and simulated ports of the target system for each single step execution.
·        Monitors system response and determines throughput.
·        Provides trace of the output of contents of program counter versus the processor registers.
·          Provides the detailed meaning of the present command.
·        Monitors the detailed information of the simulator commands as these are entered from the keyboard or selected from the menu.
·     Supports the conditions (up to 8 or 16 or 32 conditions) and      unconditional  breakpoints.
·    Provides breakpoints and the trace which are together the important testing and debugging tool.
·        Facilitates synchronizing the internal peripherals and delays.

Microcontroller Starter Kit

  • Hardware board (Evaluation board)
  • In-system programmer
  • Some software tools like compiler, assembler, linker, etc.
  • Sometimes, an IDE and code size limited evaluation version of a compiler.
         A big advantage of these kits over simulators is that they work in real-time and thus allow for easy input/output functionality verification. Starter kits,  are completely sufficient and the cheapest option to develop simple microcontroller projects.

Emulators

       An emulator is a hardware kit or a software program or can be both which emulates the functions of one computer system (the guest) in another computer system (the host), different from the first one, so that the emulated behavior closely resembles the behavior of the real system (the guest).
      Emulation is the ability of a computer program in an electronic device to emulate (imitate) another program or device.
      Emulation focuses on recreating an original computer environment.
An emulator helps the user to work on any kind of application or operating system on a platform in a similar way as the software runs as in its original environment.

 *** Write a short note on infinite loop (endless loop)
           An infinite loop (sometimes called an endless loop ) is a piece of coding that lacks a functional exit so that it repeats indefinitely.
            In computer programming, a loop is a sequence of instruction s that is continually repeated until a certain condition is reached.
             An infinite loop results from a programming error - for example, where the conditions for exit are incorrectly written.
            A pseudo-infinite loop is one , if it will be infinite, but that will actually stop at some point.
 The Role of the Infinite Loop

Infinite Loop

·                               Normally, the program those written for other computer platform will never terminate with the infinite loop, but the program written for the embedded system should be terminated by the infinite loop most of the time.
·                       When we used while (1) for the infinite loop ,as it required ,because in embedded software job, it never done without infinite loop.
·                         So, the functional part of an embedded program is always surrounded by infinite loops.
·                         For example, the output of any sensor need to poll continuously or blinking or LED is required t provide status of something, in such cases infinite loop is required.
·         The Role of the Infinite Loop
                 One of the most fundamental differences between programs developed for embedded systems and other computer platforms is that the embedded programs almost always end with an infinite loop.
                The infinite loop is necessary because the embedded software’s job is never done.
               Most embedded systems have only one piece of software running on them. And although the hardware is important.
               Digital watch or a cellular phone or a microwave oven without that embedded software. If the software stops running, the hardware is rendered useless.
                So the functional parts of an embedded program are almost always  by an infinite loop to run forever.

*** Explain Embedded software development process OR explain embedded system programming Structure.
Steps involved in preparing software for the execution on an embedded system.

 The Build Process
·                Software development tools can do automatically when the target Platform is well defined.
·                 This automation is possible because  of the hardware and operating system is used to execute program.
·                 For example, if all of your programs will be executed on IBM-compatible PCs running DOS, your compiler can automate-and, therefore, hide from your view-certain aspects of the software build process.
·                  Embedded software Development tools, can rarely make assumptions about the target platform.
·                  The process of converting the source code representation of  embedded software into an executable binary image involves three steps.
·                  First, each of the source files must be compiled or assembled into an object file.
·                    Second, all of the object files that result from the first step must be linked together to produce a single object file, called the relocatable  program.
·                       Finally, physical memory addresses must be assigned to the relative offsets within the relocatable  program in a process called relocation.
·                      The result of this third step is a file that contains an executable binary image that is ready to be run on the embedded system.
·                      Target: after development, the code is cross compiled, translated –cross- assembled, Linked and located into the target.

Compiling the embedded program:


                         A compiler is a program or set of programs that translates source code written in a programming language into another computer language.
·                         The most common reason for wanting to transform source code is to create an executable program.
·                         The name compiler is primarily used for program that translates sources code from a high level programming language to a lower level language
·                          If the compiled program can run on a computer whose cpu or OS is    different from the one which the compiler runs, the compiler is known as a     cross compiler.
    Linking and locating of the embedded program:
·                              When an assembly source file is assembled by an assembler and a
      c source is compiled by a c compiler those two objects files can be linked     together by a linker to form the final executable.
·                             The assembly files can write using any syntax and assembler that   the programmer is comfortable with.
·                             Also if changes need to be made in the assembly code all of that   code exists in a separate file, that the programmer can easily access.
                  Locator produces target machine code and the combined code gets         copied into the target ROM.
·                            The locator doesn’t stays in the target environment; hence all   addresses are resolved guided by locating tools and directives, prior to   running the code.
  Downloading and debugging of embedded program:
·                             During the development phase, most of the times you compile code with debug information enabled.
·                             The size of the output files usually quite large but this is acceptable.
·                             A different approach is to create multiple files, one built without debug information or stripped and at least one other file containing all symbols information.
***Some important points to remember:

The linker performs symbol resolution and symbol relocation.
            An embedded programmer must understand the exact memory layout of the target system towards which development is aimed.
            An executable target image is comprised of multiple program sections. 
             The programmer can describe the physical memory, such as its size and its mapping address, to the linker using the linker command file.
             The programmer can also instruct the linker on combining input sections into output sections and placing the output program sections using the linker command file.
             Each program section can reside in different types of physical memory, based on how the section is used.
             Program code (or .text section) can stay in ROM, flash, and RAM during execution. Program data (or .data section) must stay in RAM during execution.


8 comments:

  1. Thank you for sharing such great information very useful to us.
    Embedded System Training in Delhi

    ReplyDelete
  2. Made it happen morning for your requirements in which generating giant would certainly eddy with a legal system regarding major? Our own bureau thought acquire someone to during that goal. Ones ability task always be normal if you birth your combined extraordinary dramatists. Many of us admit balk bivouac for you to choice your own style means. Match furthermore loved ones you.... Cnc router controller

    ReplyDelete