Systemy RT i embedded Wykład 1 Wprowadzenie - PDF

Systemy RT i embedded Wykład 1 Wprowadzenie Wrocław 2013 Plan Wprowadznie Wymagania kursu Plan pracy Pierwszy wykład Definicje, Microcontroller, Microprocessor Introduction What is this course about What

Please download to get full document.

View again

of 86
All materials on our website are shared by users. If you have any questions about copyright issues, please report us to resolve them. We are always happy to assist you.


Publish on:

Views: 14 | Pages: 86

Extension: PDF | Download: 0

Systemy RT i embedded Wykład 1 Wprowadzenie Wrocław 2013 Plan Wprowadznie Wymagania kursu Plan pracy Pierwszy wykład Definicje, Microcontroller, Microprocessor Introduction What is this course about What is the aim of this course Course requirements Course consists of: Lecture 2h/week Laboratory 5 weeks x 3h starts Course ends with a test Course completion requires passing laboratory class and the test The test will be held at the last lecture Literature Lecture Books - mainly offered by BTC ( Internet Workplan for the semster Lecture 1 Basic definitions. Embedded systems. Main elements of embedded systems Lecture 2 8-bit microcontrollers: AVR family. PIC Micro family Lecture 3 8-bit/16-bit microcontrollers: 8051 family, MSP430 family Workplan for the semster Lecture 4 32-bit microcontrollers: AVR32 and PIC32 family Lecture 5 32-bit microcontrollers: ARM family. ARM7, ARM9, ARM11, Cortex M, R, A Lecture 6 32-bit microcontrollers: ARM based microcontrollers: STM, NXP Workplan for the semster Lecture 7 DSC & PSoC controllers Lecture 8 DSP processors Lecture 9,10 Serial interfaces: USB, RS232, SPI, I2C, CAN Workplan for the semster Lecture 11 ADC and DAC Lecture 12,13 RTOS introduction, main parameters Lecture 14 RTOS - examples Lecture 15 Methods of interfacing ADC and DAC to advanced microcontrollers Lecture 1 Embedded systems Microcontrollers Embedded systems Embedded systems Embedded system a system designed to perform/ control specific function in a larger design Often with real time computing constraints (i.e. with predictable response) Embedded systems Embedded systems Because Embedded System has defined functionality, thus it can be heavily optimized in order to: Minimize total cost Maximize performance Maximize perfomance/cost ratio Embedded systems Main elements: Microcontrollers: 8-bit 16-bit 32-bit Digital Signal Processors Digital Signal Controllers FPGA / ASIC programmable logic Embedded systems Embedded software architecture: Simple control tasks/loops: Used for simples applications Used mostly for 8-bit and 16-bit constructions Efficient (in assembly code even very efficient) Difficult to construct for more complicated tasks Embedded systems Embedded software architecture: Interrupt based system: Most common type of embedded system software architecture Can be very efficient and rapid in development even for quite complicated tasks/devices Functionality depends greatly on the used microcontroller : Number of serviced interrupt sources Interrupt latency Embedded systems Embedded software architecture: Simple real-time operating system: Very usable for programming different, nondependent on themselves tasks Very usable for parallel development by a few programmers Timing control & latency control worse than in simpler systems Cooperative or Preemptive multitasking can be used Embedded systems Embedded software architecture: Monolithic operating system: Large kernel gives programmers an environment similar to a desktop operating systems like MS Windows (WinCE, Win 8 RT), Linux or Android Usable in the largest applications like GPS or cell phones Hardware layer controlled totally by the system applications isolated from the hardware Microcontroller - basics Microcontrollers - basics Microcontroller is a combination of a microprocessor and peripheral blocks like: Memory (RAM, ROM, flash) Serial port Ethernet controllers USB controllers ADC DAC etc Microcontrollers - basics Microprocessor (CPU) inside a microcontroller (MCU) is supervising data transfer berween peripherals over data buses Main advantages of MCUs are: High integration scale Low cost Microprocessor - operation Microprocessor - basics Microprocessor: is a programmable device accepts digital input data processes the data according to instructions stored in memory provides results as output operates on symbols represented in binary numeral system Microprocessor - basics Main elements: Arithmethic Logic Unit Status Register Stack Pointer Program Counter Instruction Decoder Registers / Scratch Memory Microprocessor - basics Microprocessor - ALU ALU Arithmetic Logic Unit is the heart of microprocessor Width of A,B and R defines if microprocessor is 8-, 16-, 32- or 64 bits!!! Microprocessor - ALU Functionality of ALU depends on the paticular realisation Usually it offers: Addition Subtraction Comparison Logical operations Multiplication Division Microprocessor Status register Status register contains various flags and control bits Flags in the register are modified by different assembly code instructions Microprocessor Stack Pointer The Stack is mainly used: for storing temporary data for storing local variables for storing return addresses after interrupts and subroutine calls The Stack Pointer Register always points to the top of the Stack the Stack is implemented as growing from higher memory locations to lower memory locations Microprocessor Program Counter Program Counter (PC) - a special register holding the address of the instruction currently being executed Program counter is automatically advanced to point to the next instruction in the case of a jump, subroutine call, etc., a new value will simply be loaded into the program counter in order to cause a jump Microprocessor Instruction decoder Instruction decoder fetches instructions from a proper memory In the next cycle the instructions are decoded and then executed For faster execution pipelining is used Microprocessor Registers Each CPU consists of a certain number of universal registers They are usually used as temporary storage of data In some CPUs instead of registers a memory is used Access to the registers/momey is much faster than to external memory Microprocessor program flow Microprocessor program flow The program control logic and programaddress generation logic work together to provide proper program flow Normally, the flow of a program is sequential: the CPU executes instructions at consecutive program-memory addresses Discontinuities are caused by branches, function calls or interrupts Microprocessor program flow Program execution starts from the address pointed by a special RESET pointer Instructions are in a machine code i.e. stream of 8-, 16- or 32b long values For simplicity assembly code is used: Microprocessor memory map Microprocessor addressing modes Microprocessor addressing modes Direct Single Register Addressing Direct Register Addressing, Two Registers I/O Direct Addressing Direct Data Addressing Data Indirect with Displacement Data Indirect Addressing Data Indirect Addressing with Predecrement Microprocessor addressing modes Data Indirect Addressing with Postincrement Program Memory Constant Addressing Program Memory Addressing with Postincrement Direct Program Memory Addressing Indirect Program Memory Addressing Relative Program Memory Addressing Direct Single Register Addressing Very simple, efficient and fast addressing mode Usable only for access to register file Direct Register Addressing, Two Registers Very simple, efficient and fast addressing mode Usable only for access to register file I/O Direct Addressing Easy and efficient access to I/O memory Access only to limited memory space (6-bit wide) Direct Data Addressing Access to whole memory space Instruction takes much more memory Instruction decoding lasts long Data Indirect with Displacement Addressing Target address calculated in dependance on the special addressing - register (Y or Z) Data Indirect Addressing Target address take from the special addressing - register (X, Y or Z) Data Indirect Addressing with Pre-decrement The content of an addressing register is decremented before use Especially useful in higher level languages Data Indirect Addressing with Post-increment The content of an addressing register is incremented after use Especially useful in higher level languages Program Memory Constant Addressing Access to program memory (loading with LPM or storing with SPM instructions) Program Memory Addressing with Post-increment Access to program memory (loading with LPM or storing with SPM instructions) Z-register incremented after use Direct Program Memory Addressing Program execution continues at the address immediate in the instruction word Used in JMP and CALL instructions Indirect Program Memory Addressing Program execution continues at address contained by the Z-register (i.e., the PC is loaded with the contents of the Zregister) Relative Program Memory Addressing Program execution continues at address PC + k + 1. The relative address k is from to 2047. Microprocessor - classifications Microprocessor classifications SIMD ang. Single Instruction Multiple Data SISD ang. Single Instruction Single Data MIMD ang. Multiple Instruction Multiple Data MISD ang. Multiple Instruction Single Data Microprocessor classifications CISC ang. Complex Instruction Set Computers RISC ang. Reduced Instruction Set Computers Microprocessor classifications Architectures: Von Neuman Harvard Harvard modified Microprocessor classifications SISD features: One data stream One instruction stream Simple construction Reduced efficiency Very popular Most microcontrollers works with this architeture Source: [1] Microprocessor classifications MISD features: Many instruction streams Single data stream Parallel operation Many units makes the same operation on one data Rarely used Source: [1] Microprocessor classifications SIMD features: Single instruction stream Many data streams Efficient parallel processing Different data processed in the same way Used in supercomputers, vector coprocessors and DSP Source: [1] Microprocessor classifications MIMD features: Many instruction streams Many data streams Efficient parallel processing Many units operates independently and asynchronously Used in computation networks Source: [1] Microprocessor classifications CISC architecture: Large number of instructions Small optimization Some instructions need many clock cycles Existance of complex instructions Large number of addressing modes Smaller processor clocking as compared to RISC architecture Microprocessor classifications RISC architecture: Reduced number of instructions (even below 30) Most instructions performed in one clock cycyle Instructions simple or very simple Limited access to memory Large number of auxiliary registers Microprocessor classifications Von Neumann architecture Source: [2] Microprocessor classifications Harvard architecture Source: [2] 8-bits vs 16-bits vs 32-bits Some remarks: More bits = easier operation with large number of data More bits = less problems with computation errors More bits faster operation 8-bits vs 16-bits vs 32-bits Some remarks: Simpler processors can be overclocked more easily 32-bit processors are usually faster because that is necessary Smaller processors are very often much more efficient and simpler for programming then their large brothers Numbers in microcontrollers CPUs natively support only integer numbers signed or unsigned CPU accumulator width defines size of supported numbers: 8b - [0;0xff] = [0;255] 16b - [0;0xffff] = [0;65535] 32b - [0;0xffffffff] = [0; ] Numbers in microcontrollers Signed integers are usually written in U2 code: i.e. -1 = 0xff -128 = 0x80 Numbers in microcontrollers In CPUs there is problem with non-integer numbers Some CPUs support fractional numbers Some have additional coprocessor (Floating Point Unit FPU) for real numbers calculation Numbers in microcontrollers Comparison of Integer and Fractional numbers: Numbers in microcontrollers Integer: 8-bit (Byte) 16-bit (Word) 32-bit (Long) Float: Single precision (float) Double precision (double) Numbers in microcontrollers Single precision: S EEEEEEEE FFFFFFFFFFFFFFFFFFFFFFF X = ( 1) S 1. F 2 E 127 S sign E exponent bits F - fraction Numbers in microcontrollers Double precision: S EEEEEEEEEEE FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF X = ( 1) S 1. F 2 E 1023 S sign E exponent bits F - fraction Endiannes Endiannes is the same as byte-order Big-endian = MSB goes first Little-endian = LSB goes first Benchmarking Benchmarking Benchmarking is used for speed comparation of microprocessors and microcontrollers Comparing microprocessors is difficult Comparing microcontrollers is even more difficult it is fairly easy to compare cores but very hard to compare peripherals!!! Benchmarking Main measures of microcontrollers core speed are: MIPS DMIPS FLOPS Benchmarking - MIPS MIPS Millions of Instructions Per Second Simple algorithm usually used speed of NOP instruction Comparison of processors speeds requires thorough analysis. The speed of a given CPU is dependent upon many factors: the type of instructions being executed, the execution order and the presence of branch instructions (pipeline!) Benchmarking - MIPS CPU instruction rates are usually different from clock frequencies Each instruction usually require several clock cycles to complete The number of cycles required for instructions to complete is dependent upon the instruction being executed MIPS can be useful when comparing performance between processors made from a similar architecture Benchmarking - DMIPS DMIPS another name for Dhrystone type computer speed test Dhrystone is a synthetic computing benchmark intended to be representative of system (integer) programming The algorithm is well documented and can be made to work on almost any system Benchmarking - DMIPS DMIPS shortcomings: it features unusual code that is not usually representative of real-life programs it is susceptible to compiler optimizations Dhrystone's small code size may fit in the instruction cache of a modern CPU, so that instruction fetch performance is not rigorously tested Benchmarking - FLOPS FLOPS - FLoating-point Operations Per Second Measure of floating point arithmetic operation speed of a microcontroller Similar to MIPS but for floating point numbers Thank you for your attention References [1] [2] Computer-Architecture
Related Search
We Need Your Support
Thank you for visiting our website and your interest in our free products and services. We are nonprofit website to share and download documents. To the running of this website, we need your help to support us.

Thanks to everyone for your continued support.

No, Thanks