E85 Lab 8: Assembly Language
|
|
- Gladys Osborne
- 6 years ago
- Views:
Transcription
1 E85 Lab 8: Assembly Language E85 Spring 2016 Due: 4/6/16 Overview: This lab is focused on assembly programming. Assembly language serves as a bridge between the machine code we will need to understand to build actual CPUs in Verilog and the C programming we have been doing. In this lab you will learn how to add assembly code to a larger program. You will practice adding writing assembly code by implementing a GPIO based driver for an 8x8 LED display. What to turn in: 1. Your answers for part A 2. Did you complete part B? 3. Your timing diagram for part C 4. Your code for part C 5. Did the LED raster correctly? Feedback: Let us know: What went well in this assignment? Were there points of confusion? How long did you need to work on this assignment?
2 Part A ASM Programming (1) (a) I have the following function: int myfn(int a, float b, double c); Where are a, b and c at the start of the function for a standard ARMv4 procedure call? Where is the return value stored when the function ends? (b) I have a non-leaf function that requires the 8 registers for calculating the answer. Assume the values will be stored in R0-R7. Write the lines needed to handle the standard ARMv4 procedure call for the preserved registers and to return control of the function to the calling function. (c) I have a function: fn1. This function calls fn2. At the time of the function call fn1 is using R0-R11 to hold values it needs for a calculation. What must fn1 do before the BL fn2 instruction? After the BL fn2 instruction? (2) Write an assembly program that finds the modulus of var1 and var2. That is var1 mod var2. You do not have division or multiplication operations. The equivalent C prototype for the function is: int mod(int var1, int var2); (3) The code for: int fn(int a, int b)is shown below. What is the value returned for fn(27, 6)? Express your answer as hexadecimal. fn MOV R2, #0 dwl ADD R2, R2, #4 SUBS R0, R0, R1 BGT dwl CMP R2, #0xA MOVEQ R0, R2 MOVLT R0, R1 MOV PC, LR (4) Write the hexadecimal value of the SUBS, and MOVLT instructions above.
3 Part B Tutorial Thumb and adding assembly to a C program In the previous lab we use C to create a useful embedded system. In this lab the focus is on assembly programming. As you have learned in class, assembly is essentially a human readable form of machine language. That is it is code that the CPU can directly execute. Machine languages implement instruction set architectures (ISAs). The ISA we have been learning in class and is covered in the textbook is ARMv4. This is a great ISA to learn because it is still the basis for all ARM processors today which are ubiquitous. We will be creating an ARMv4 CPU in Verilog in the last labs of this class. Our ATSAMD11 however does not implement the ARMv4 architecture. It actually implements ARMv6M. The M stands for microcontroller. This means it uses a different machine code. The coding of this is actually much more complex than the ARMv4 architecture. ARMv6M is optimized for code size. Embedded systems have very little memory so this is very important for them. We still want to focus on the ARMv4 architecture however because that is the one we will be building. As such we can treat our microcontroller as a restricted ARMv4 processor in terms of assembly. Some instruction forms are not available. For instance we cannot use conditional execution except for branches. The other main difference is that we are limited to using R0-R7 for most instructions. The ARMv6M architecture has some extra instructions as well but we will not use them. What is available to us is given in section 3.3 of this manual: Look at the table and you can see that many instructions are only available in the S version. Some immediate and shifting versions are missing as well. This restricts our coding style but will still allow us to learn the important parts of assembly coding. Why assembly? Knowing assembly is important for a variety of reasons. First it serves as a bridge between the CPU s machine code and high level language code like C. By looking at the assembly our code compiles to we can truly understand everything that our code is doing. In the last lab you saw that the uvision IDE provides you the assembly in the debugger for just this reason. The other reasons to know assembly is of course to use it. In embedded systems it is generally used in places that need either exact timing or efficiency. Even a very good compiler is not as good as a human in many cases at writing optimal code. Compilers do not understand every dependency and may be too careful. One place I recently saw a major piece of assembly programming was in a music player s decoder. This code was being executed for every single byte of music file that was being played. It was worth the time to write it by hand in assembly as a result.
4 Other places you will commonly see assembly are in interrupt handlers and for low level drivers that require software based timing. Interrupt handlers are code that runs on an embedded system when an event occurs. This could be an external event like a button being pressed or something internal. The startup code that is run on our Cortex M0+ before main sets up a table of interrupt handler functions. If you look at the code you will see things like ADC_Handler, a function that would be called every time the ADC converts a sample. The ADC is capable of running at 350 ksps. If our CPU is running at 48 MHz (its maximum rate) then this code would be executed every 137 clock cycles. That might sound like a large number but consider single line of C like the ones we used to blink the LED with &= ~ could easily be at least 4 actual assembly instructions and you will realize that 137 clock cycles is not many. This issue would likely be handled by leveraging direct memory addressing (DMA) but the general problem of interrupts remains: they can happen very frequently, if the code is too long it will not even finish before another interrupt occurs preventing the main functions from running at all. Interrupt handlers therefore are a primary place assembly code will be written because they occur very frequently and thus need to be optimal. Another place to use assembly is where timing needs to be known. Because instructions take a certain length of time which is known, if there are no branches then we can create exact timing of outputs. This can be very helpful creating software implementations of peripherals. You might want to do this if you need another SPI or UART or if you simply do not have one in your selected part. Adding assembly to a C program To add assembly to a C program is not hard. We already met how to add a single line of assembly in our first C programming lab. Here we will write an entire function. It will be to turn on or off our LED. Create a new project in uvision in a new folder for this lab Add a C file to the project called main.c to the project and copy the following code into the file #include "samd11.h" #define NOP() asm volatile ( "NOP" ) void nopdelay(unsigned long delay); void led(unsigned int a); int main() { PORT->Group->DIR.reg = (1<<4); while(1) { led(1); nopdelay(50); led(0); nopdelay(50); // Burn CPU cycles and spin doing nothing void nopdelay(unsigned long delay) { unsigned long i, j; for(j = 0; j<delay; j++)
5 { for(i = 0; i<0xfff; i++)nop(); Add ASM file called led.s to the project and copy the following code into the file THUMB AREA.text, CODE, READONLY EXPORT led OUTADR EQU 0x led ledon ledoff finish PUSH {R4 LDR R4, =OUTADR LDR R1, [R4] MOVS R3, #0x10 CMP R0, #0 BEQ ledoff ORRS R1, R1, R3 B finish MVNS R3, R3 ANDS R1, R1, R3 STR R1, [R4] POP {R4 MOV PC, LR ALIGN END This is a simple function to turn the LED on and off. It illustrates most of the assembly coding we have been learning in class. There are some extra items here however so we will go through the code top to bottom together. The directive THUMB tells the compiler that it should compile THUMB version code. This is the compact form that ARMv4 does not have. We need to say this for our microcontroller but it is not important beyond that. The next statement about AREA tells the compiler where this code goes in the memory of the CPU. The text area is where programs go, its read only. The EXPORT statement makes the symbol led available outside this file. We need to do this because the C program calls led. The OUTADR EQU is very much like a #define statement in C. It allows us to use a label rather than a value. Notice at the start of the code we PUSH R4. This is consistent with the standard procedure call for ARMv4 (ARMv6M is basically the same). We are going to use R4 so we save the contents. Notice in the code we really did not have to use R4 so we could have made this more efficient if we had left it out and used R2 in its place, but we put a PUSH and POP in the code to show their proper place!
6 The standard procedure call from C puts the first argument in R0, so we know that R0 will contain 0 for off. The code above treats anything that is not 0 as true to turn on the LED as you can see. The last line MOV PC, LR returns to where we were before the function call. At this point also look at the C code and notice the function prototype is there and defines how LED works for the compiler. Build the project to compile the code You should get a warning about the MOV PC, LR. It will say that BX <rn> is preferred. This is a Thumb specific instruction to do the return that is more compact. We will keep writing code that is compatible with ARMv4 and not use it. Change the debugger settings for the project and start a debugging session Set a breakpoint at each of the calls to led() Add the PORT peripheral to debugger view At each call of led() look at the evolution of the registers and memory in the PORT OUT register using single stepping You should see the value 1 or 0 passed to the function in R0, the value of R4 at the end should be as it was at the beginning of the function, and you should observe both paths of execution through the function.
7 Part C Implement a driver for the 8x8 LED display In this part of the lab you should implement a driver that allows you to display patterns on the 8x8 LED display you used in the last lab. The base code for this part of the assignment can be found here: The driver should be a single function: void drive8led(unsigned char row, unsigned char col); The driver should: 1. Shift out row and col to the two shift registers using sclk, row and col pins 2. Latch the values to the output with the rclk pin Before you write the assembly code for this function, first draw a timing diagram for the ideal output of the GPIO signals to set to shift in an arbitrary pattern. After you have drawn your timing diagram implement the diagram as closely as possible in assembly. If it is not possible to do something you have drawn then make note of it. You are welcome to shift out the LSB or MSB first whichever you find more convenient. By writing the code in assembly we can increase the performance/refresh rate of the display or minimize the overhead of the call to update this display in our overall code. Try to minimize the number or instructions executed by your function. Depending on how you write your code you might find the OUTTGL, OUTCLR and OUTSET registers useful in the PORT peripheral. How many instructions are executed for your function?
Exam 1. Date: February 23, 2016
Exam 1 Date: February 23, 2016 UT EID: Printed Name: Last, First Your signature is your promise that you have not cheated and will not cheat on this exam, nor will you help others to cheat on this exam:
More informationHi Hsiao-Lung Chan, Ph.D. Dept Electrical Engineering Chang Gung University, Taiwan
ARM Programmers Model Hi Hsiao-Lung Chan, Ph.D. Dept Electrical Engineering Chang Gung University, Taiwan chanhl@maili.cgu.edu.twcgu Current program status register (CPSR) Prog Model 2 Data processing
More informationCprE 288 Introduction to Embedded Systems ARM Assembly Programming: Translating C Control Statements and Function Calls
CprE 288 Introduction to Embedded Systems ARM Assembly Programming: Translating C Control Statements and Function Calls Instructors: Dr. Phillip Jones 1 Announcements Final Projects Projects: Mandatory
More informationCM0506 Exploring the LPC4088 Instruction Set: 4b
CM0506 Exploring the LPC4088 Instruction Set: 4b Michael Brockway February 13, 2016 1 Introduction This lab activity continues exploring subroutine calling, this time looking at C or C++ code calling subroutines
More informationARM PROGRAMMING. When use assembly
ARM PROGRAMMING Bùi Quốc Bảo When use assembly Functions that cannot be implemented in C, such as special register accesses and exclusive accesses Timing-critical routines Tight memory requirements, causing
More informationChapter 15. ARM Architecture, Programming and Development Tools
Chapter 15 ARM Architecture, Programming and Development Tools Lesson 5 ARM 16-bit Thumb Instruction Set 2 - Thumb 16 bit subset Better code density than 32-bit architecture instruction set 3 Basic Programming
More informationExam 1. Date: February 23, 2018
Exam 1 Date: February 23, 2018 UT EID: Printed Name: Last, First Your signature is your promise that you have not cheated and will not cheat on this exam, nor will you help others to cheat on this exam:
More informationARM Cortex-M4 Architecture and Instruction Set 4: The Stack and subroutines
ARM Cortex-M4 Architecture and Instruction Set 4: The Stack and subroutines M J Brockway February 13, 2016 The Cortex-M4 Stack SP The subroutine stack is full, descending It grows downwards from higher
More informationARM Architecture and Assembly Programming Intro
ARM Architecture and Assembly Programming Intro Instructors: Dr. Phillip Jones http://class.ece.iastate.edu/cpre288 1 Announcements HW9: Due Sunday 11/5 (midnight) Lab 9: object detection lab Give TAs
More informationUniversity of Texas at Austin Electrical and Computer Engineering Department. EE319K, Embedded Systems, Spring 2013 Final Exam
University of Texas at Austin Electrical and Computer Engineering Department EE319K, Embedded Systems, Spring 2013 Final Exam Directions There are 6 problems worth a total of 100 points. The number of
More informationEE319K Spring 2015 Exam 1 Page 1. Exam 1. Date: Feb 26, 2015
EE319K Spring 2015 Exam 1 Page 1 Exam 1 Date: Feb 26, 2015 UT EID: Printed Name: Last, First Your signature is your promise that you have not cheated and will not cheat on this exam, nor will you help
More informationAssembly Language Programming
Experiment 3 Assembly Language Programming Every computer, no matter how simple or complex, has a microprocessor that manages the computer s arithmetical, logical and control activities. A computer program
More informationFinal Exam. Date: May 12, 2017
Final Exam Date: May 12, 2017 UT EID: Printed Name: Last, First Your signature is your promise that you have not cheated and will not cheat on this exam, nor will you help others to cheat on this exam:
More informationNET3001. Advanced Assembly
NET3001 Advanced Assembly Arrays and Indexing supposed we have an array of 16 bytes at 0x0800.0100 write a program that determines if the array contains the byte '0x12' set r0=1 if the byte is found plan:
More informationECE 598 Advanced Operating Systems Lecture 4
ECE 598 Advanced Operating Systems Lecture 4 Vince Weaver http://www.eece.maine.edu/~vweaver vincent.weaver@maine.edu 28 January 2016 Announcements HW#1 was due HW#2 was posted, will be tricky Let me know
More informationAssembly Language Programming
Assembly Language Programming ECE 362 https://engineering.purdue.edu/ee362/ Rick Reading and writing arrays Consider this C code again: int array1[100]; int array2[100]; for(n=0; n
More informationEE4144: ARM Cortex-M Processor
EE4144: ARM Cortex-M Processor EE4144 Fall 2014 EE4144 EE4144: ARM Cortex-M Processor Fall 2014 1 / 10 ARM Cortex-M 32-bit RISC processor Cortex-M4F Cortex-M3 + DSP instructions + floating point unit (FPU)
More informationLAB4. Program the on chip SPI module
LAB4 Program the on chip SPI module Outline Learn to utilize the on-chip SPI module Implement it in C Translate it to ARM Assembly Test and verify the result using oscilloscope and shift register. Serial
More informationARM Cortex-M4 Architecture and Instruction Set 1: Architecture Overview
ARM Cortex-M4 Architecture and Instruction Set 1: Architecture Overview M J Brockway January 25, 2016 UM10562 All information provided in this document is subject to legal disclaimers. NXP B.V. 2014. All
More informationEE 354 Fall 2015 Lecture 1 Architecture and Introduction
EE 354 Fall 2015 Lecture 1 Architecture and Introduction Note: Much of these notes are taken from the book: The definitive Guide to ARM Cortex M3 and Cortex M4 Processors by Joseph Yiu, third edition,
More informationStudent ID: For examiner use
COMP/ Practice Final Exam Student ID: u Make sure you read each question carefully. Questions are not equally weighted, and the size of the answer box is not necessarily related to the length of the expected
More informationAssembler: Basics. Alberto Bosio October 20, Univeristé de Montpellier
Assembler: Basics Alberto Bosio bosio@lirmm.fr Univeristé de Montpellier October 20, 2017 Assembler Program Template. t e x t / S t a r t o f the program code s e c t i o n /.data / V a r i a b l e s /
More informationEECS 373 Fall 2018 Homework #3
EECS 373 Fall 2018 Homework #3 Answers 1) Loaders, Linkers and Executables a) In straightforward English, explain the role of a linker. [7 points] A linker receives object files as input and must emit
More informationEE319K Exam 1 Summer 2014 Page 1. Exam 1. Date: July 9, Printed Name:
EE319K Exam 1 Summer 2014 Page 1 Exam 1 Date: July 9, 2014 UT EID: Printed Name: Last, First Your signature is your promise that you have not cheated and will not cheat on this exam, nor will you help
More informationCprE 288 Introduction to Embedded Systems Course Review for Exam 3. Instructors: Dr. Phillip Jones
CprE 288 Introduction to Embedded Systems Course Review for Exam 3 Instructors: Dr. Phillip Jones 1 Announcements Exam 3: See course website for day/time. Exam 3 location: Our regular classroom Allowed
More informationDesign and Implementation Interrupt Mechanism
Design and Implementation Interrupt Mechanism 1 Module Overview Study processor interruption; Design and implement of an interrupt mechanism which responds to interrupts from timer and UART; Program interrupt
More informationEmbedded assembly is more useful. Embedded assembly places an assembly function inside a C program and can be used with the ARM Cortex M0 processor.
EE 354 Fall 2015 ARM Lecture 4 Assembly Language, Floating Point, PWM The ARM Cortex M0 processor supports only the thumb2 assembly language instruction set. This instruction set consists of fifty 16-bit
More informationSubroutines and the Stack
3 31 Objectives: A subroutine is a reusable program module A main program can call or jump to the subroutine one or more times The stack is used in several ways when subroutines are called In this lab
More informationUniversity of California, San Diego CSE 30 Computer Organization and Systems Programming Winter 2014 Midterm Dr. Diba Mirza
Name Student ID University of California, San Diego CSE 30 Computer Organization and Systems Programming Winter 2014 Midterm Dr. Diba Mirza Name of person to your left Name of person to your right Please
More informationEE319K Fall 2013 Exam 1B Modified Page 1. Exam 1. Date: October 3, 2013
EE319K Fall 2013 Exam 1B Modified Page 1 Exam 1 Date: October 3, 2013 UT EID: Printed Name: Last, First Your signature is your promise that you have not cheated and will not cheat on this exam, nor will
More information(2) Part a) Registers (e.g., R0, R1, themselves). other Registers do not exists at any address in the memory map
(14) Question 1. For each of the following components, decide where to place it within the memory map of the microcontroller. Multiple choice select: RAM, ROM, or other. Select other if the component is
More informationExam 1. Date: February 23, 2018
Exam 1 Date: February 23, 2018 UT EID: Printed Name: Last, First Your signature is your promise that you have not cheated and will not cheat on this exam, nor will you help others to cheat on this exam:
More informationSystems Architecture The ARM Processor
Systems Architecture The ARM Processor The ARM Processor p. 1/14 The ARM Processor ARM: Advanced RISC Machine First developed in 1983 by Acorn Computers ARM Ltd was formed in 1988 to continue development
More informationChapters 3. ARM Assembly. Embedded Systems with ARM Cortext-M. Updated: Wednesday, February 7, 2018
Chapters 3 ARM Assembly Embedded Systems with ARM Cortext-M Updated: Wednesday, February 7, 2018 Programming languages - Categories Interpreted based on the machine Less complex, not as efficient Efficient,
More informationInstruction Set Architecture (ISA)
Instruction Set Architecture (ISA) Encoding of instructions raises some interesting choices Tradeoffs: performance, compactness, programmability Uniformity. Should different instructions Be the same size
More informationComparison InstruCtions
Status Flags Now it is time to discuss what status flags are available. These five status flags are kept in a special register called the Program Status Register (PSR). The PSR also contains other important
More informationGetting Started in C Programming with Keil MDK-ARM Version 5
Getting Started in C Programming with Keil MDK-ARM Version 5 Reason for Revision This document was revised for Keil MDK-ARM v5.14 on February 18, 2015. This document was revised for MSP432 LaunchPad on
More informationGetting Started in C Programming with Keil MDK-ARM Version 5
Getting Started in C Programming with Keil MDK-ARM Version 5 Reason for Revision This document was revised for Keil MDK-ARM v5.14 on February 18, 2015. This document was revised for MSP432 LaunchPad on
More informationParallel I/O and Keyboard Scanning
4 4.1 Objectives: Microprocessors can monitor the outside world using input ports. They can also control it using output ports. The TM4C123G (Tiva) performs I/O using 6 ports. Computer keyboards are typically
More informationGetting Started in C Programming with Keil MDK-ARM Version 5
Getting Started in C Programming with Keil MDK-ARM Version 5 Reason for Revision This document was revised for Keil MDK-ARM v5.14 on February 18, 2015. This document was revised for MSP432 LaunchPad on
More informationARM Instruction Set Architecture. Jin-Soo Kim Computer Systems Laboratory Sungkyunkwan University
ARM Instruction Set Architecture Jin-Soo Kim (jinsookim@skku.edu) Computer Systems Laboratory Sungkyunkwan University http://csl.skku.edu Condition Field (1) Most ARM instructions can be conditionally
More informationEE319K Spring 2016 Exam 1 Solution Page 1. Exam 1. Date: Feb 25, UT EID: Solution Professor (circle): Janapa Reddi, Tiwari, Valvano, Yerraballi
EE319K Spring 2016 Exam 1 Solution Page 1 Exam 1 Date: Feb 25, 2016 UT EID: Solution Professor (circle): Janapa Reddi, Tiwari, Valvano, Yerraballi Printed Name: Last, First Your signature is your promise
More informationPractical 1 Review. ECE Rick
Practical 1 Review ECE 362 https://engineering.purdue.edu/ee362/ Rick Lab TA Survey We do a midterm review of lab TAs. Survey link is at the bottom of the "Lab Experiments" page. Complements? Criticism?
More informationImplementing Secure Software Systems on ARMv8-M Microcontrollers
Implementing Secure Software Systems on ARMv8-M Microcontrollers Chris Shore, ARM TrustZone: A comprehensive security foundation Non-trusted Trusted Security separation with TrustZone Isolate trusted resources
More informationbutton.c The little button that wouldn t
Goals for today The little button that wouldn't :( the volatile keyword Pointer operations => ARM addressing modes Implementation of C function calls Management of runtime stack, register use button.c
More informationThe ARM Cortex-M0 Processor Architecture Part-2
The ARM Cortex-M0 Processor Architecture Part-2 1 Module Syllabus ARM Cortex-M0 Processor Instruction Set ARM and Thumb Instruction Set Cortex-M0 Instruction Set Data Accessing Instructions Arithmetic
More informationCMPSCI 201 Fall 2004 Midterm #2 Answers
CMPSCI 201 Fall 2004 Midterm #2 Answers Professor William T. Verts 15 Points You should be quite familiar by now with the single-precision floating point numeric format (one 32-bit word containing
More informationExam 1 Fun Times. EE319K Fall 2012 Exam 1A Modified Page 1. Date: October 5, Printed Name:
EE319K Fall 2012 Exam 1A Modified Page 1 Exam 1 Fun Times Date: October 5, 2012 Printed Name: Last, First Your signature is your promise that you have not cheated and will not cheat on this exam, nor will
More informationGetting Started in Assembly Programming with Keil uvision and MSP432
Getting Started in Assembly Programming with Keil uvision and MSP432 This tutorial is written on uvision v5.15 and Texas Instruments MSP432 LaunchPad. Assembly Programming with MSP432 MSP432 has an ARM
More informationARM Cortex M3 Instruction Set Architecture. Gary J. Minden March 29, 2016
ARM Cortex M3 Instruction Set Architecture Gary J. Minden March 29, 2016 1 Calculator Exercise Calculate: X = (45 * 32 + 7) / (65 2 * 18) G. J. Minden 2014 2 Instruction Set Architecture (ISA) ISAs define
More informationEECS 373 Winter 2017 Homework #3
EECS 373 Winter 2017 Homework #3 Due January 25 th on Gradescope. Late homework is not accepted. Name: unique name: You are to turn in this assignment filling in the blanks as needed. Assignments that
More informationExam 1. Date: Oct 4, 2018
Exam 1 Date: Oct 4, 2018 UT EID: Professor: Valvano Printed Name: Last, First Your signature is your promise that you have not cheated and will not cheat on this exam, nor will you help others to cheat
More informationARM Assembler Workbook. CS160 Computer Organization Version 1.1 October 27 th, 2002 Revised Fall 2005
ARM Assembler Workbook CS160 Computer Organization Version 1.1 October 27 th, 2002 Revised Fall 2005 ARM University Program Version 1.0 January 14th, 1997 Introduction Aim This workbook provides the student
More informationChapters 5. Load & Store. Embedded Systems with ARM Cortex-M. Updated: Thursday, March 1, 2018
Chapters 5 Load & Store Embedded Systems with ARM Cortex-M Updated: Thursday, March 1, 2018 Overview: Part I Machine Codes Branches and Offsets Subroutine Time Delay 2 32-Bit ARM Vs. 16/32-Bit THUMB2 Assembly
More informationCortex M3 Programming
Cortex M3 Programming EE8205: Embedded Computer Systems http://www.ee.ryerson.ca/~courses/ee8205/ Dr. Gul N. Khan http://www.ee.ryerson.ca/~gnkhan Electrical and Computer Engineering Ryerson University
More informationCprE 288 Translating C Control Statements and Function Calls, Loops, Interrupt Processing. Instructors: Dr. Phillip Jones Dr.
CprE 288 Translating C Control Statements and Function Calls, Loops, Interrupt Processing Instructors: Dr. Phillip Jones Dr. Zhao Zhang 1 Announcements Final Projects Projects: Mandatory Demos Deadweek
More informationModes and Levels. Registers. Registers. Cortex-M3 programming
Modes and Levels Cortex-M3 programming Texas Instruments, www.ti.com CortexM3InstructionSet.pdf STMicroelectronics, www.st.com CortexM3Programmer.pdf PM0056 Registers Registers R0-R3 parameters R4-R11
More informationARM Assembly Language. Programming
Outline: ARM Assembly Language the ARM instruction set writing simple programs examples Programming hands-on: writing simple ARM assembly programs 2005 PEVE IT Unit ARM System Design ARM assembly language
More informationAn Introduction to Assembly Programming with the ARM 32-bit Processor Family
An Introduction to Assembly Programming with the ARM 32-bit Processor Family G. Agosta Politecnico di Milano December 3, 2011 Contents 1 Introduction 1 1.1 Prerequisites............................. 2
More informationEMBEDDED SYSTEMS: Jonathan W. Valvano INTRODUCTION TO THE MSP432 MICROCONTROLLER. Volume 1 First Edition June 2015
EMBEDDED SYSTEMS: INTRODUCTION TO THE MSP432 MICROCONTROLLER Volume 1 First Edition June 2015 Jonathan W. Valvano ii Jonathan Valvano First edition 3 rd printing June 2015 The true engineering experience
More informationChapter 15. ARM Architecture, Programming and Development Tools
Chapter 15 ARM Architecture, Programming and Development Tools Lesson 4 ARM CPU 32 bit ARM Instruction set 2 Basic Programming Features- ARM code size small than other RISCs 32-bit un-segmented memory
More informationProgram SoC using C Language
Program SoC using C Language 1 Module Overview General understanding of C, program compilation, program image, data storage, data type, and how to access peripherals using C language; Program SoC using
More informationA Bit of History. Program Mem Data Memory. CPU (Central Processing Unit) I/O (Input/Output) Von Neumann Architecture. CPU (Central Processing Unit)
Memory COncepts Address Contents Memory is divided into addressable units, each with an address (like an array with indices) Addressable units are usually larger than a bit, typically 8, 16, 32, or 64
More informationAGH University of Science and Technology Cracow Department of Electronics
AGH University of Science and Technology Cracow Department of Electronics Microcontroller Lab Tutorial 1 Microcontrollers programming in C Author: Paweł Russek http://www.fpga.agh.edu.pl/ml ver. 3.10.16
More informationTimers and Pulse Accumulator
7 7.1 Objectives: Tiva is equipped with six General Purpose Timer Modules named TIMERn. Additionally, each TIMERn consists of two 16 bit timers (A and B). Most GPIO pins can be assigned a TIMERn as an
More informationLAB1. Get familiar with Tools and Environment
LAB1 Get familiar with Tools and Environment Outline Intro to ARMmite Pro development board Intro to LPC2103 microcontroller Cross development environment and tools Program the broad in C: light the LED
More informationENGN1640: Design of Computing Systems Topic 03: Instruction Set Architecture Design
ENGN1640: Design of Computing Systems Topic 03: Instruction Set Architecture Design Professor Sherief Reda http://scale.engin.brown.edu School of Engineering Brown University Spring 2016 1 ISA is the HW/SW
More informationARM Shift Operations. Shift Type 00 - logical left 01 - logical right 10 - arithmetic right 11 - rotate right. Shift Amount 0-31 bits
ARM Shift Operations A novel feature of ARM is that all data-processing instructions can include an optional shift, whereas most other architectures have separate shift instructions. This is actually very
More informationHands-On with STM32 MCU Francesco Conti
Hands-On with STM32 MCU Francesco Conti f.conti@unibo.it Calendar (Microcontroller Section) 07.04.2017: Power consumption; Low power States; Buses, Memory, GPIOs 20.04.2017 21.04.2017 Serial Interfaces
More informationEE251: Thursday September 20
EE251: Thursday September 20 Parallel I/O aka General Purpose I/O aka GPIO Common Devices: Switches, LEDs, Keypads Read Lab 4 carefully, and Chapter 14 in text Think about what you would like to review
More informationCMPSCI 201 Fall 2005 Midterm #2 Solution
CMPSCI 201 Fall 2005 Midterm #2 Solution Professor William T. Verts 10 Points Convert the decimal number -47.375 into (a) binary scientific notation (i.e., ±1.xxxx 2 Y ), and (b) the equivalent binary
More informationComputer Organization & Assembly Language Programming (CSE 2312)
Computer Organization & Assembly Language Programming (CSE 2312) Lecture 16: Processor Pipeline Introduction and Debugging with GDB Taylor Johnson Announcements and Outline Homework 5 due today Know how
More informationIntroduction to C. Write a main() function that swaps the contents of two integer variables x and y.
Introduction to C Write a main() function that swaps the contents of two integer variables x and y. void main(void){ int a = 10; int b = 20; a = b; b = a; } 1 Introduction to C Write a main() function
More informationThe Next Steps in the Evolution of ARM Cortex-M
The Next Steps in the Evolution of ARM Cortex-M Joseph Yiu Senior Embedded Technology Manager CPU Group ARM Tech Symposia China 2015 November 2015 Trust & Device Integrity from Sensor to Server 2 ARM 2015
More informationInterrupt-Driven Input/Output
Interrupt-Driven Input/Output Textbook: Chapter 11 (Interrupts) ARM Cortex-M4 User Guide (Interrupts, exceptions, NVIC) Sections 2.1.4, 2.3 Exceptions and interrupts Section 4.2 Nested Vectored Interrupt
More informationEE445M/EE380L.6 Quiz 2 Spring 2017 Solution Page 1 of 5
EE445M/EE380L.6 Quiz 2 Spring 2017 Solution Page 1 of 5 First Name: Last Name: April 21, 2017, 10:00 to 10:50am Open book, open notes, calculator (no laptops, phones, devices with screens larger than a
More informationEE251: Tuesday September 5
EE251: Tuesday September 5 Shift/Rotate Instructions Bitwise logic and Saturating Instructions A Few Math Programming Examples ARM Assembly Language and Assembler Assembly Process Assembly Structure Assembler
More informationECE251: Intro to Microprocessors Name: Solutions Mid Term Exam October 4, 2018
ECE251: Intro to Microprocessors Name: Solutions Mid Term Exam October 4, 2018 (PRINT) Instructions: No calculators, books, or cell phones; do not communicate with any other student. One side of a single
More informationECE251: Tuesday September 18
ECE251: Tuesday September 18 Subroutine Parameter Passing (Important) Allocating Memory in Subroutines (Important) Recursive Subroutines (Good to know) Debugging Hints Programming Hints Preview of I/O
More informationECGR 4101/5101, Fall 2016: Lab 1 First Embedded Systems Project Learning Objectives:
ECGR 4101/5101, Fall 2016: Lab 1 First Embedded Systems Project Learning Objectives: This lab will introduce basic embedded systems programming concepts by familiarizing the user with an embedded programming
More informationOutline. ARM Introduction & Instruction Set Architecture. ARM History. ARM s visible registers
Outline ARM Introduction & Instruction Set Architecture Aleksandar Milenkovic E-mail: Web: milenka@ece.uah.edu http://www.ece.uah.edu/~milenka ARM Architecture ARM Organization and Implementation ARM Instruction
More informationPrefetch Cache Module
PIC32 TM Prefetch Cache Module 2008 Microchip Technology Incorporated. All Rights Reserved. PIC32 Prefetch Cache Module Slide 1 Hello and welcome to the PIC32 Prefetch Cache Module webinar. I am Nilesh
More informationBasic ARM InstructionS
Basic ARM InstructionS Instructions include various fields that encode combinations of Opcodes and arguments special fields enable extended functions (more in a minute) several 4-bit OPERAND fields, for
More informationReturning from an Exception. ARM Exception(Interrupt) Processing. Exception Vector Table (Assembly code) Exception Handlers (and Vectors) in C code
ARM Exception(Interrupt) Processing Returning from an Exception main: instruction instruction instruction instruction Exception The ARM processor automatically: 1. Saves CPSR into banked SPSR 2. Saves
More informationCSE 410. Operating Systems
CSE 410 Operating Systems Handout: syllabus 1 Today s Lecture Course organization Computing environment Overview of course topics 2 Course Organization Course website http://www.cse.msu.edu/~cse410/ Syllabus
More informationGetting Started with Keil µvision 3 and C51
Getting Started with Keil µvision 3 and C51 1. Create a Project: Start uvision3. Go to Project->New µvision Project on the µvision3 window. Then enter the name of your project and select a location. Click
More informationEECS 373 Midterm Winter 2012
EECS 373 Midterm Winter 2012 Name: unique name: Sign the honor code: I have neither given nor received aid on this exam nor observed anyone else doing so. Nor did I discuss this exam with anyone after
More informationIoT and Security: ARM v8-m Architecture. Robert Boys Product Marketing DSG, ARM. Spring 2017: V 3.1
IoT and Security: ARM v8-m Architecture Robert Boys Product Marketing DSG, ARM Spring 2017: V 3.1 ARM v8-m Trustzone. Need to add security to Cortex -M processors. IoT Cortex-A has had TrustZone for a
More informationECE 498 Linux Assembly Language Lecture 5
ECE 498 Linux Assembly Language Lecture 5 Vince Weaver http://www.eece.maine.edu/ vweaver vincent.weaver@maine.edu 29 November 2012 Clarifications from Lecture 4 What is the Q saturate status bit? Some
More informationSTEVEN R. BAGLEY ARM: PROCESSING DATA
STEVEN R. BAGLEY ARM: PROCESSING DATA INTRODUCTION CPU gets instructions from the computer s memory Each instruction is encoded as a binary pattern (an opcode) Assembly language developed as a human readable
More informationEmbedded C. ECE Rick
Embedded C ECE 362 https://engineering.purdue.edu/ee362/ Rick Reading Assignment Reading assignment: Family Reference Manual, Chapter 17, "General purpose timers (TIM2 and TIM3)", pages 377 443. Textbook,
More informationECE 362 Lab Verification / Evaluation Form Experiment 3
ECE 362 Lab Verification / Evaluation Form Experiment 3 Evaluation: IMPORTANT! You must complete this experiment during your scheduled lab perior. All work for this experiment must be demonstrated and
More informationECE251: Thursday September 27
ECE251: Thursday September 27 Exceptions: Interrupts and Resets Chapter in text and Lab #6. READ ALL this material! This will NOT be on the mid-term exam. Lab Practical Exam #1 Homework # due today at
More informationEE319K (Gerstlauer), Spring 2013, Midterm 1 1. Midterm 1. Date: February 21, 2013
EE319K (Gerstlauer), Spring 2013, Midterm 1 1 Midterm 1 Date: February 21, 2013 UT EID: Printed Name: Last, First Your signature is your promise that you have not cheated and will not cheat on this exam,
More informationEmbedded and Ambient Systems Laboratory
Budapest University of Technology and Economics Faculty of Electrical Engineering and Informatics Department of Automation and Applied Informatics Embedded and control systems specialization Embedded and
More informationAN316 Determining the stack usage of applications
Determining the stack usage of applications AN 316, Summer 2018, V 1.0 feedback@keil.com Abstract Determining the required stack sizes for a software project is a crucial part of the development process.
More informationCMPSCI 201 Fall 2004 Midterm #1 Answers
CMPSCI 201 Fall 2004 Midterm #1 Answers 10 Points Short Essay Answer The 8088 is primarily a CISC processor design, and the ARM is primarily RISC. The 6502 is such an early design that it is difficult
More informationARM Memory Addressing and Function Calls
ARM Memory Addressing and Function Calls Tom Kelliher, CS 220 1 Administrivia Today s Objectives 1. Use indirect addressing to move data between registers and memory. 2. Manipulate numeric and character
More informationCOEN-4720 Embedded Systems Design Lecture 3 Intro to ARM Cortex-M3 (CM3) and LPC17xx MCU
COEN-4720 Embedded Systems Design Lecture 3 Intro to ARM Cortex-M3 (CM3) and LPC17xx MCU Cristinel Ababei Dept. of Electrical and Computer Engineering Marquette University Outline Overview of ARM Cortex-M3
More informationLast Time. Compiler requirements C preprocessor Volatile
Last Time Compiler requirements C preprocessor Volatile Today Coding and translation of interrupt handlers Coding inline assembly Compiler intrinsics Interrupts 30-second interrupt review: Interrupts are
More information