Diferencia entre revisiones de «Embedded Sytems»

De Proyectos
Ir a la navegación Ir a la búsqueda
Sin resumen de edición
Sin resumen de edición
 
(No se muestran 48 ediciones intermedias del mismo usuario)
Línea 1: Línea 1:
Embedded Systems<br/>
[[C2 - Conceptos Fundamentales]]<br/>
[[C4 - Lógica Digital]]<br/>
[[C5 - Introducción a C]]<br/>
[[C6 - Microcontroller Ports]]<br/>
[[C7 - Design and Development Process]]<br>
[[C10 - Finite State Machine]]<br>
[[C11 - UART: The serial interface]]<br>
[[C12 - Interrupts]]<br>
<br/>
Información Complementaria<br/>
Información Complementaria<br/>
<br/>
<br/>
Línea 4: Línea 15:
<br/>
<br/>
[http://www.utm.mx/~fsantiag/Micros.htm http://www.utm.mx/~fsantiag/Micros.htm]<br/>
[http://www.utm.mx/~fsantiag/Micros.htm http://www.utm.mx/~fsantiag/Micros.htm]<br/>
<br/>
[[File: arm_cortex_m.gif]]<br/>
Imagen Cortex-M ARM (CPU, Memoria, Perifericos, ...)<br/>
<br/>
*Arquitectura Harvard. ICode bus conecta con la ROM y System bus conecta con la RAM
*NVIC se encarga d elas interrupciones
*Algunos perifericos internos se conectan directamente con el procesador por el bus PPB
<br/>
<br/>
Imagen CPU Cortex-M4 ARM<br/>
Imagen CPU Cortex-M4 ARM<br/>
Línea 29: Línea 33:
*Decodificación
*Decodificación
*Ejecución
*Ejecución
Tipos de memoria:
*Memoria de Código
**Es en la que se almacena el programa
**Es no volátil
**Es la comunmente llamada ROM, y la tecnologia flash es una de las utilizadas para almacenar la ROM
***La memoria flash se borra mediante impulsos eléctricos. Es una sucesora de la EEPROM
*Memoria de Datos
**Es la que almacena las variables del programa
**Es volátil
**Es la comunmente llamada RAM. La tecnologia que se utiliza para los microcontroladores es la SRAM
**También nos podemos encontrar con microcontroladores que ademas tienen memoria EEPROM para guardar datos cuando se corta la electricidad
Sistema de memoria:
*Arquitectura Von Neumann
**La Memoria de Código y la de Datos comparten el Bus hacia la CPU
*Arquitectura Harvard
**Hay un bus para la Memoria de Código y otro bus para la Memori de datos
<br/>
<br/>
<b>Tema 2</b><br/>
<br/>
<b>Memoria microcontroladores</b><br/>
<br/>
[http://es.wikipedia.org/wiki/Microcontrolador#Memoria Tipos de memoria]<br/>
[http://es.wikipedia.org/wiki/SRAM Memoria RAM (SRAM)]<br/>
[http://es.wikipedia.org/wiki/EEPROM Memoria ROM (EEPROM)]<br/>
[http://es.wikipedia.org/wiki/Memoria_flash Memoria ROM (Flash)]<br/>
<br/>
<b>Tipos de I/O</b><br/>
*Parallel - binary data are available simultaneously on a group of lines
*Serial - binary data are available one bit at a time on a single line
*Analog - data are encoded as an electrical voltage, current, or power
*Time - data are encoded as a period, frequency, pulse width, or phase shift
<br/>
<br/>
<b>ISA (Instruction Set Architecture)</b><br/>
<br/>
<b>[http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0553a/CHDBIBGJ.html Registros ARM ISA]</b><br/>
<br/>
[[File:registers.gif]]<br/>
<br/>
*R1...R12 - General Purpose Registers
**AAPCS (ARM Architecture Procedure Call Satandard) (parte de la ABI (ARM Application Binary Interface)) utiliza los registros R0, R1, R2 y R3 para pasar parámetros a las funciones de C
**Los parámetros que devuelven las funciones se colocan en el R0 según el AAPCS
**In this class, the SP will always be the main stack pointer (MSP), not the Process Stack Pointer (PSP).
*R13 - Stack Points (Almacena la dirección del elemento top de la pila)
*R14 - Link Register (Almacena la dirección devuelta por las subrutinas)
*R15 - Program Counter (Almacena la dirección de la siguiente instrucción a ejecutar)
Special Registers<br/>
*PSR - Process Status Register - Combina:
**APSR - Application Program Status Register
**IPSR - Interrupt Program Status Register
**EPSR - Execution Program Status Register
**Se puede consultar el registro PSR (que nos devuelve toda la información que contienen los tres registros), o consultar cada registro individulamente
**Los bits N, Z, V, C y Q nos dan información sobre el resultado de la anterior operación de la ALU
***N resultado negativo
***Z resultado es 0
***V overflow signed numbers
***C overflow unseigned numbers
***Q indica que ha habido una saturacion
**El bit T siempre es 1 y nos indica que el procesador esta ejecutando instrucciones Thumb
**ISR_NUMBER indica el numero del tipo de excepcion actual del ISR
*PRIMASK (Exception Mask Registers) - Bit 0 of the special register PRIMASK is the interrupt mask bit. If this bit is 1, most interrupts and exceptions are not allowed. If the bit is 0, then interrupts are allowed.
*FAULTMASK (Exception Mask Registers) - Bit 0 of the special register FAULTMASK is the fault mask bit. If this bit is 1, all interrupts and faults are not allowed. If the bit is 0, then interrupts and faults are allowed. The nonmaskable interrupt (NMI) is not affected by these mask bits.
*BASEPRI (Exception Mask Registers) - The BASEPRI register defines the priority of the executing software. It prevents interrupts with lower or equal priority but allows higher priority interrupts. For example if BASEPRI equals 3, then requests with level 0, 1, and 2 can interrupt, while requests at levels 3 and higher will be postponed. A lower number means a higher priority interrupt. The details of interrupt processing will be presented in subsequent chapters.
<br/>
[[File:special_registers.gif]]<br/>
<br/>
Program Status Register del procesador ARM® Cortex-M<br/>
<br/>
<br/>
<b>Assembly language</b><br/>
<br/>
<br/>
Las instrucciones assembler tienen 4 campos separados por espacios o tabuladores:<br/>
Label - Opcode - Operand - Comment<br/>
FUNC - MOV - R0,#100 ; Pone 100 en R0<br/>
<br/>
*Label field: Es opcional. Identifica la posicion en la memoria de la actual instrucción. Se debe elegir un único nombre para cada label.
*Opcode field: Es la isntrucción a ejecutar.
*Operand field: Especifica donde se encuentra el dato que ejecuta la instruccion. Las instrucciones Thumb tienen 1, 2, 3 o 4 operandos.
*Comment field: Son los comentarios y son opcionales. La forma correcta es explicar porque se pone esa instrucción, no explicar que hace.
<br/>
{|
!Label
!Opcode
!Operands
!Comment
|-
|Func
|MOV
|R0, #100
|; this sets R0 to 100
|-
|
|BX
|LR
|; this is a function return
|}
<br/>
Las instrucciones se pueden clasificar en 4 categorias:
*Acceso a la memoria
*Instrucciones aritméticas y lógicas
*Instrucciones de control
*Resto de instrucciones
<br/>
A fundamental issue in program development is the differentiation between data and address. When we put the number 1000 into Register R0, whether this is data or address depends on how the 1000 is used.
<br/>
<br/>
To run efficiently, we try to keep frequently accessed information in registers. However, we need to access memory to fetch parameters or save results. <b>The addressing mode is the format the instruction uses to specify the memory location to read or write data.</b>
<br/>
<br/>
<b>The addressing mode is associated more specifically with the operands, and a single instruction could exercise multiple addressing modes for each of the operands.</b>
<br/>
<br/>
When the import is obvious though, we will use the expression “the addressing mode of the instruction”, rather than “the addressing mode of an operand in an instruction". All instructions begin by fetching the machine instruction (op code and operand) pointed to by the PC. When extended with Thumb-2 technology, some machine instructions are 16 bits wide, while others are 32 bits.
<br/>
<br/>
<b>Some instructions operate completely within the processor and require no memory data fetches.</b> For example, the ADD R1,R2 instruction performs R1+R2 and stores the sum back into R1. If the data is found in the instruction itself, like MOV R0,#1, the instruction uses <b>immediate addressing mode</b>.
<br/>
<br/>
A register that contains the address or the location of the data is called a pointer or index register. <b>Indexed addressing mode</b> uses a register pointer to access memory. The addressing mode that uses the PC as the pointer is called <b>PC-relative addressing mode</b>. It is used for branching, for calling functions, and accessing constant data stored in ROM. The addressing mode is called PC relative because the machine code contains the address difference between where the program is now and the address to which the program will access. The MOV instruction will move data within the processor without accessing memory. The LDR instruction will read a 32-bit word from memory and place the data in a register. With PC-relative addressing, the assembler automatically calculates the correct PC offset.
<br/>
<br/>
Register. Most instructions operate on the registers. In general, data flows towards the op code (right to left). In other words, the register closest to the op code gets the result of the operation. In each of these instructions, the result goes into R2.
<br/>
<br/>
Memory Map Layout<br/>
*ROM/Flash
*RAM
*I/O Ports
*Internal I/O<br/>
<br/>
<br/>
Recursos
*https://www.smashwords.com/books/view/302372 - Libro en castellano de desarrollo en ARM M3 de Sergio R. Caprile
*http://www.sase.com.ar/2012/files/2012/09/Pres_ARMando.pdf - Presentacion pdf resumen arm de Sergio R. Caprile
*http://mymoviestorrent.com/e-books/90968-the-designers-guide-to-the-cortex-m-processor-family-a-tutorial-approach.html - The Designer's Guide to the Cortex-M Processor Family - A Tutorial Approach -
*http://users.ece.utexas.edu/~valvano/embed/toc1.htm - Aprendizaje C para ARM de J.Valvano
*http://www.forosdeelectronica.com/f24/empezar-microcontroladores-arm-55856/index2.html - Discusion sobre ARM. Interesante, hablan de placas de desarrollo y de las diferentes marcas que hacen ARM
*https://www.youtube.com/user/valenciaupv/search?query=arm - Canal youtube de Universidad Politecnica Valencia

Revisión actual - 19:41 6 abr 2015

Embedded Systems
C2 - Conceptos Fundamentales
C4 - Lógica Digital
C5 - Introducción a C
C6 - Microcontroller Ports
C7 - Design and Development Process
C10 - Finite State Machine
C11 - UART: The serial interface
C12 - Interrupts

Información Complementaria

Recursos

http://www.utm.mx/~fsantiag/Micros.htm

Imagen CPU Cortex-M4 ARM

Imagen Memoria Cortex-M4 ARM

Tipos CPU:

  • CISC (Complex Instruction Set Computers)
    • Hardware complejo y un bajo rendimiento
    • Demasiadas instrucciones con diferentes tamaños y formatos, que pueden ocupar varios bytes
  • RISC (Reduced Instruction Set Computers)
    • Hardware es simple y resuelve pocas instrucciones. Alto rendimiento.
    • Pocas instrucciones y generalmente del mismo tamaño



Tareas CPU (FALTA MAS INFO):

  • Atrapar la instrucción
  • Decodificación
  • Ejecución



Recursos