ECE_212_LAB_1

pdf

School

University of Alberta *

*We aren’t endorsed by this school

Course

212

Subject

Electrical Engineering

Date

Feb 20, 2024

Type

pdf

Pages

5

Uploaded by MasterMorning13240

Report
ECE 212 - Introduction to Microprocessors L AB 1: Introduction to ARM Assembly language Winter 2023 DATES section dates H11 06 February 2023 H21 07 February 2023 H25 07 February 2023 H31 08 February 2023 H41 09 February 2023 H51 10 February 2023 INTRODUCTION In the first lab, students will be introduced to some of the basic ISA (Instruction Set Architecture) used in ARM assembly language programming. There are two different instruction sets(ARM and THUMB) that are supported by the ARM microprocessor. The labs will only support the THUMB2 instruction set. LEARNING OBJECTIVES 1. To gain experience developing code in THUMB2 assembly language. 2. To gain experience working with the NUCLEO board(NUCLEO-L432KC) manufactured by STMicroelectronics. 3. To gain experience working with STM32CubeIDE software. PRE-LAB Read the lab prior to attending your online lab help section Do the online prelab Quiz individually and submit it before the deadline Provide flow chart(s)/pseudocode for each part of the lab(Part A and Part B) Department of Electrical and Computer Engineering 11-203 Donadeo Innovation Centre for Engineering, 9211-116 Street NW, University of Alberta, Edmonton, Alberta, Canada T6G 1H9 1 / 5
ECE 212 - Introduction to Microprocessors L AB 1: Introduction to ARM Assembly language Winter 2023 INSTRUCTIONS 1. Download the template files: main.c retarget.c retarget.h DataStorage.s SetZeros.s Lab1a.s (For part A) Lab1b.s (For part B) 2. Create an empty project and import the above files into it. For a quick refresher, consult the tutorial on how to do this. If you are working on Lab1a.s, exclude Lab1b.s from the project and vice versa. Compiling both files at once will cause an error. 3. Download the marking sheet. If you recall from the tutorial, the ‘main.c’ is the standard project template that is used to initialize and call standard functions/subroutines including our ‘AssemblyProgram’. This will always be provided and you don’t need not worry too much about it. Do not modify any of the parameters in this file. ‘SetZeros.s’ and ’DataStorage’ are also provided to initialize the memory contents. Do not modify any of the parameters in either file. ‘Lab1a.s’ and ‘Lab1b.s’ are the two files provided for you to write your assembly language program. There are no passed parameters and your solution is expected to reside entirely in these two files. A more detailed description is provided below. PART A Use the Lab1a.s template for your coding You are asked to write a program that will convert an ASCII character(stored as an ASCII code in memory) to its hex/dec equivalent. Valid ASCII characters are from 0 to 9, A-F and a-f. For example, the ASCII character ‘A’ when stored in memory will be represented by the hex value 0x41 or one byte(8bits) of data. Each memory location on the development board contains one byte of information. In other words, one memory location can store one ASCII character. However, for our lab, we are going to use 4 memory locations to store one ASCII character by padding it with a bunch of zeros. A diagram below will give you a visual interpretation of how Department of Electrical and Computer Engineering 11-203 Donadeo Innovation Centre for Engineering, 9211-116 Street NW, University of Alberta, Edmonton, Alberta, Canada T6G 1H9 2 / 5
ECE 212 - Introduction to Microprocessors L AB 1: Introduction to ARM Assembly language Winter 2023 the data is stored. You are asked to convert this value to its hex/dec equivalent(hex value = 0xA)(decimal value = 10) and store it at some other memory location made up of 4 memory blocks. Invalid ASCII characters(ie,+,*) should be rejected with an error code stored in the memory location. The error code has been chosen to be the numerical value ‘-1’. This error code is 4 bytes(word)(32bit) long. If the memory location contains the ASCII ‘Enter’ code, your program should exit signaling the end and that no more conversions are required. 1. 0x20001000 - Start Address of where the data is stored. 2. 0x20002000 - Start Address of where the converted values are to be stored. NOTE: Once you have completed part A, make sure you backup your lab1a.s by saving a copy of it somewhere. The best way is to back it up on your Google Drive or USB memory stick. If you proceed to part b without doing so, you may accidently delete your lab1a.s file and lose your solution. Department of Electrical and Computer Engineering 11-203 Donadeo Innovation Centre for Engineering, 9211-116 Street NW, University of Alberta, Edmonton, Alberta, Canada T6G 1H9 3 / 5
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
ECE 212 - Introduction to Microprocessors L AB 1: Introduction to ARM Assembly language Winter 2023 PART B Replace the Lab1a.s template with Lab1b.s for your coding. You can also exclude Lab1a.s from the project and work on Lab1b.s You are asked to write a program that will convert an ASCII letter to its upper or lower case equivalent. Valid characters are all upper or lower case letters. For example, the ASCII character ‘A’ when stored in memory will be represented by the hex value 0x41. You are asked to convert this value to its lower case equivalent ‘a’ which will be represented by the hex value 0x61. This value is stored at another designated memory location. Invalid ASCII characters should be rejected with an error code in the memory location. The error code has been chosen to be the ASCII character “*” If the memory location contains the ASCII ’Enter’ code, your program should exit signaling the end and that no more conversions are required. 1. 0x20001000 - Start Address of where the data is stored 2. 0x20003000 - Start Address of where the converted values are to be stored Department of Electrical and Computer Engineering 11-203 Donadeo Innovation Centre for Engineering, 9211-116 Street NW, University of Alberta, Edmonton, Alberta, Canada T6G 1H9 4 / 5
ECE 212 - Introduction to Microprocessors L AB 1: Introduction to ARM Assembly language Winter 2023 QUESTIONS 1. What happens when there is no exit code ‘0x0D’ provided in the initialization process? Would it cause a problem? Why or Why not? 2. Can the data be stored in halfword(16 bits) or byte(8bits) instead of word(32 bits) format. This question is only in reference to the ARM microprocessor. 3. How can your code be modified to provide a variable address range? For example, what if I only wanted to convert the first 10 data entries? You do not need to make these changes to your code. Just a detailed description is sufficient. MARKING SCHEME Lab 1 is worth 20 % of the final lab mark. Please view the Marking Sheet for this lab to ensure that you have completed all of the requirements of the lab. The Marking Sheet also provides a limited test suite in the demo section for you to think about. Make use of it! When writing the report, please follow the Report Writing Guidelines document uploaded to Eclass. REPORT REQUIREMENTS The report and demo due dates are given on the ECE212 Laboratories page on Eclass. There are late submission penalties for the Demo(-10%) and Report(-10%) per day after the scheduled due date Department of Electrical and Computer Engineering 11-203 Donadeo Innovation Centre for Engineering, 9211-116 Street NW, University of Alberta, Edmonton, Alberta, Canada T6G 1H9 5 / 5