Some Basic Concepts EL6483. Spring EL6483 Some Basic Concepts Spring / 22
|
|
- Roland Powell
- 5 years ago
- Views:
Transcription
1 Some Basic Concepts EL6483 Spring 2016 EL6483 Some Basic Concepts Spring / 22
2 Embedded systems Embedded systems are rather ubiquitous these days (and increasing rapidly). By some estimates, there are currently over a hundred embedded devices per person. Many types of embedded systems... printers, routers, watches, phones, robots and autonomous vehicles, etc. Many devices have multiple embedded systems (e.g., a car with several embedded devices for various functionalities, a laptop computer with several embedded devices for functionalities such as hard drive control, fan control, etc.). One definition of an embedded device is a device that includes a programmable processor, but is not itself a general-purpose computer. EL6483 Some Basic Concepts Spring / 22
3 Some common characteristics of embedded systems Event-driven behavior definition: The system behavior is defined in terms of desired responses to events (e.g., inputs from external devices). For example, an automatic garage door opener is supposed to command a motor (that opens the garage door) as a response to the event of a remote button press. An event can also be a time-related event, e.g., an embedded device that is supposed to perform some task every some number of milliseconds. Specific and well-defined behavior: the system task is well-defined. However, there is usually inherent randomness in the external events (e.g., the time at which the user might press a button is essentially random). The system should be designed to gracefully handle this randomness in the external inputs and have a robust well-defined behavior in response to the inputs. EL6483 Some Basic Concepts Spring / 22
4 Some common characteristics of embedded systems Real-time requirements: In its response to events, an embedded system is often required to satisfy some timing constraints. Note that real-time does not necessarily mean very fast. Instead, it means fast enough in the sense that the latency between an event and its response can be quantitatively specified. Latency is the delay between an event and the corresponding response. Jitter is the variation/deviation of the timing. Hard real-time (absolute guarantee), soft real-time (best effort). If a hard real-time requirement is not met, that is interpreted as a system failure; if a soft real-time requirement is not met, it simply means that system performance is somewhat reduced. EL6483 Some Basic Concepts Spring / 22
5 Some common characteristics of embedded systems Limited resources: Memory, processing power, etc. Embedded systems are often resource-constrained due to considerations of cost, size, power, etc. Hence, efficiency is often a key requirement. Sensors and actuators: Embedded systems often read data from the external environment using sensors (e.g., voltage sensors, microphones, cameras, temperature sensors, accelerometers, etc.) and send outputs to somehow influence/change the environment using actuators (e.g., voltage outputs, audio speakers, etc.). Combination of hardware and software components: The hardware and software parts of the system are often designed together (co-design) to achieve the specified system behavior. Parallelism: An embedded system might need to respond to multiple sources of events (e.g., a device connected to three user buttons with event-driven behavior specifications for the system response to button presses). Reliability: Reliability (and the related requirements of safety and security) is often part of the basic system requirements definition (e.g., an embedded device in an unmanned vehicle or in a medical robotic system, etc.). EL6483 Some Basic Concepts Spring / 22
6 Binary and hexadecimal Binary : 0 s and 1 s (bits) Hexadecimal (base 16): 0,..., 9, A, B, C, D, E, F ; each hexadecimal (hex) digit is often called a nibble (4 bits). A byte is usually 8 bits (2 hex digits). On a 32-bit processor, a word is usually 32 bits (4 bytes). Hexadecimal is usually written with prefix 0x Examples: 0xE = 14 in decimal = 1110 in binary 0x64 = 100 in decimal = in binary Octal (base 8): A number written starting from 0 refers to an octal (base 8), e.g., 010 = 0x8 = 8 in decimal EL6483 Some Basic Concepts Spring / 22
7 Program compilation model An embedded system program might include, in general, multiple C/C++ files, multiple Assembly files, and precompiled library files. File type Commonly used filename extensions C, C++.c,.cpp Assembly.s or.asm Binary precompiled libraries.lib These multiple files need to be compiled and linked together to create an executable. In a bare-metal system, the resulting executable is the complete binary program that will run on the microprocessor. In a system with an operating system (e.g., embedded Linux), the program can utilize OS (operating system) functionalities (e.g., system calls) or other dynamically linked libraries at run-time (via a loader provided by the OS). EL6483 Some Basic Concepts Spring / 22
8 C/C++ program compilation model Conceptual sequence of steps in converting a set of.c/.cpp files into an executable each.c/.cpp file is processed separately as a translation unit (or compilation unit) preprocessor step : text substitutions (e.g., #define, #include), conditional compilation (e.g., #ifdef) preprocessor takes a.c/.cpp file and generates a modified C/C++ code based on the preprocessor directives within the.c/.cpp file (and included.h files) compilation step : compiler converts C/C++ code to assembly language code assembly step : assembler converts assembly language code to the machine language (binary) code as an object file (.o or.obj) the separate object files are then linked together to generate the executable EL6483 Some Basic Concepts Spring / 22
9 C/C++ program compilation model While preprocessing, compiling, assembling are conceptually separate steps, some C/C++ compilers combine multiple of these steps into one (e.g., they might not explicitly create an assembly language file during the compilation procedure). As part of linking, the inter-file dependencies (e.g., functions that are defined in one.c/.cpp file and called from another.c/.cpp file) are resolved (symbol resolution) symbol clash/conflict if the same symbol is defined in multiple translation units if we need to define different functions with the same name in more than one.c/.cpp files, then we can declare these functions as static to make them visible only at file scope and prevent symbol conflicts If we also have some assembly language source files (.s/.asm), then they are converted to object code and linked with the object codes from the other translation units in the complete program. EL6483 Some Basic Concepts Spring / 22
10 C/C++ program compilation model Compile-time errors vs. link-time errors vs. run-time errors Each C/C++ file is compiled separately. Examples of compile-time errors include syntax errors, type definition errors, etc. Symbols (i.e., function/variable names) are resolved during linking. If a file refers to a symbol not defined in it, the linker will try to find the symbol in another file. Examples of link-time errors include: multiple definitions of the same symbol name. For example, two files having definitions of functions with the same name unresolved definitions, i.e., the definition of a name not being found. For example, if a file refers to a function f, but no file providing a definition of this function is available. Run-time errors include logic errors, etc. EL6483 Some Basic Concepts Spring / 22
11 C/C++ program compilation model To refer to a function defined in another file, we just need to specify the function prototype (also called function signature), i.e., the types of arguments and return value of the function. Examples: void f(void);, float g(int,int); To refer to a variable defined in another file, we can use the keyword extern. Examples: extern float a;, extern int b;. If a variable is referred to as extern, but is not defined in any other file, that will result in a link-time error. Note that C++ compilers modify symbol names to support function overloading, etc. For example, a function void f(int) might be assigned the name f_int in the object file and a function void f(float) might be assigned the name f_float in the object file. This is called name mangling. Hence, to call between C and C++ functions, we need to tell the C++ compiler to not mangle names. This is done by using the keyword extern C. Example: extern "C" void g(int); A library (.lib) file is simply a collection of object files in a binary archive. If a C/C++/Assembly file refers to a function defined in an object file within the library archive, the linker will pull in the appropriate function definition during the linking stage. EL6483 Some Basic Concepts Spring / 22
12 Assembly language An assembler converts an assembly language code into binary object code. Assembly language is essentially machine language written using mnemonics. Assembly language has almost one-to-one correspondence to the processor s machine code instructions. Assembly language instruction sets for different processors are generally very different. C/C++ code is much more portable between different processors. Assembly language is specific to a particular processor. Also, much easier to write C/C++ code than assembly code. Cross compiler Since the machine instruction set is different for different processors, a cross compiler is needed to compile code on one processor architecture for a different processor architecture (e.g., using a laptop to compile code that eventually has to run on an ARM processor). EL6483 Some Basic Concepts Spring / 22
13 Assembly language Typically, most of the code (even in an embedded system) is written in a high-level language such as C/C++, with assembly utilized only for specific tasks such as in start-up routines and for small specialized functions that particularly need to be very optimized (especially functions that need to be executed a large number of times) or functions that utilize low-level hardware-specific functionalities of the processor that are easier to access from assembly. However, note that C/C++ compilers are very good at optimization these days and can often out-perform hand-written assembly codes, especially for larger more complicated functions. A knowledge of assembly language is also very useful in debugging (including debugging of C/C++ code since the resulting assembly code can help during debugging, especially if only the compiled binary executable of a program is available and not the original source code). EL6483 Some Basic Concepts Spring / 22
14 Flash and RAM An embedded device typically has two types of memory: Flash: Non-volatile memory typically utilized for storing the program binary. Non-volatile means that the contents of this memory survive a power cycle (power-off and power-on). This memory is typically written to by using a hardware debugging interface (such as ST Link for ARM microcontrollers from ST Microelectronics). In addition (but less frequently), the non-volatile memory might be used by code to store parameters, etc. RAM (Random Access Memory): Volatile memory used during program execution (e.g., for run-time variables). Volatile means that the contents of this memory are lost when the device is powered off. The variables in a program (e.g., int a;) are typically stored in RAM. RAM is much faster to read from and write to than Flash. In addition, some embedded devices might have other types of memory storage such as SD card, USB-connected data storage, etc. The microcontroller on the STM32F4 Discovery board has 192 kb of RAM and 1 MB of Flash. EL6483 Some Basic Concepts Spring / 22
15 Basic microprocessor/microcontroller concepts Microprocessor is the computational core (Arithmetic Logic Unit, Control Unit, Registers). Microcontroller is microprocessor + peripherals (input/output ports, memory, etc.). The microcontroller on the STM32F4 Discovery board is the STM32F407VGT6 which includes the 32-bit ARM Cortex-M4F core. The registers in an ARM microprocessor include general-purpose registers (used to hold values during program execution) and special registers including: Program Counter : keeps track of the location in the program that is currently being executed (i.e., memory address of the line of machine code currently being executed) Link Register : stores a bookmark (address) to the current location in the program when a different function is called so that when that function returns, the code execution returns to the correct spot Stack Pointer : points to the top of the stack EL6483 Some Basic Concepts Spring / 22
16 Stack and Heap The available memory in RAM can be thought of as a sequence of 1-byte memory locations. Each 1-byte memory location has an address. For a 32-bit processor, a memory address is typically 32 bits (4 bytes). In the available memory, two specific parts are usually defined: stack and heap. Local variables (also called automatic variables) in a C/C++ function (e.g., int a;) are stored in stack. Heap is used for dynamically allocated memory space (e.g., int *a = (int *)malloc(sizeof(int));). The specifications of how much memory space is allocated for stack and heap (as a memory address range for stack and a memory address range for heap) are specified to the linker as part of a linker script (usually a file with filename extension.ld). EL6483 Some Basic Concepts Spring / 22
17 Stack Variables are pushed onto the stack and popped off the stack. Last-in-first-out (LIFO) data storage. The last item pushed onto the stack is the first popped off the stack by a pop operation. Local variables defined in a function (automatic variables) are usually automatically allocated on the stack (e.g., int a;). When a function returns, its variables are automatically popped off the stack. Stack pointer (SP) holds the address of the current top of the stack. When items are pushed onto the stack (e.g., by defining a local variable), then the stack pointer value is updated (e.g., changed by 4 if a 32-bit int is pushed onto the stack). The direction in which the stack grows (i.e., whether stack pointer numerically increments or decrements when additional items are pushed onto the stack) is dependent on the processor architecture; on ARM architecture, the direction of stack growth can be chosen to be either incrementing or decrementing. Stack is also used on some processor architectures to store a bookmark when calling a function (so that the processor knows where to return to when the function returns); stack can also be used to pass arguments to functions. Stack has a finite size (defined when linking the binary executable); if we push too much onto the stack, we get a stack overflow. If we have a recursive function and too many nested function calls, then also a stack overflow can result. EL6483 Some Basic Concepts Spring / 22
18 Heap Heap is utilized for dynamic memory allocation (malloc and free in C, new and delete in C++). Examples of dynamic memory allocation in C (malloc and free): int *a = (int *)malloc(sizeof(int)); // a points to 1 int int *a = (int *)malloc(5*sizeof(int)); // a points to an array of 5 ints free(a); Examples of dynamic memory allocation in C++ (new and delete): int *a = new int; // a points to 1 int int *a = new int[5]; // a points to an array of 5 ints delete a; A variable that is dynamically allocated (e.g., using malloc) must be explicitly deallocated (e.g., using free) when no longer needed. Forgetting to deallocate can result in a memory leak. Do not mix C-style and C++-style dynamic memory allocation. If you used malloc to allocate memory, use free to free it. If you used new, use delete. EL6483 Some Basic Concepts Spring / 22
19 Heap Over time, as memory chunks of different sizes are allocated and deallocated, heap fragmentation can happen, wherein the free memory is in small gaps between allocated memory and the system cannot find contiguous memory chunks for allocation even though there is still some free memory. Variables on the heap are accessed via pointers. Allocating variables on the stack is typically much faster than on the heap. If the size of an array is not known at compile-time (i.e., variable length arrays), then typically dynamic memory allocation must be used (only a small number of rather new C compilers support variable length arrays on stack): int *a = (int *)malloc(n*sizeof(int)); EL6483 Some Basic Concepts Spring / 22
20 Endianness Memory in a computer is addressed in bytes, i.e., each byte of memory has its own address. When storing a variable of a data type that is larger than 1 byte, there are two possibilities: storing the least significant byte first (in the lowest memory address) or storing the most significant byte first. Endianness refers to the order in which the bytes of a variable that is larger than 1 byte is stored. Little-endian: least significant byte is stored first (i.e., at the lowest memory address) Big-endian: most significant byte is stored first (i.e., at the lowest memory address) For example, if a 32-bit integer has bytes B3, B2, B1, and B0 with B3 being the most significant byte and B0 being the least significant byte, a little-endian processor would store the bytes in the sequence B0 B1 B2 B3 in memory and a big-endian processor would store the bytes in the sequence B3 B2 B1 B0 in memory. EL6483 Some Basic Concepts Spring / 22
21 Bitwise operations Bitwise operation Symbol (in C) AND & OR XOR ^ NOT ~ Left shift << Right shift >> Bitwise operations are commonly used to set various flags in an embedded system. For example, consider a variable L that represents a control register for a voltage sensor. If it is defined that bit 0 (i.e., the right-most bit) specifies whether the voltage range of the voltage sensor with bit 0 being 0 corresponding to 0-10V and bit 0 being 1 corresponding to ± 10 V, then to select the ± 10 V option without changing any of the other bits in L, we could write (in C): L = L 0x1; EL6483 Some Basic Concepts Spring / 22
22 Bitwise operations Some examples of bitwise operations: 0x05 & 0x01 = 0x01 0x05 0x02 = 0x07 0x05 ^ 0x01 = 0x04 0x05 «2 = 0x14 0x05» 1 = 0x02 Example: If we have an integer variable named L and we want to set bit 1 (with bit 0 being the right-most bit) to 0 without changing the other bits, we can write (in C): or equivalently: L &= ( 0x02); L = L & ( 0x02); EL6483 Some Basic Concepts Spring / 22
EL6483: Brief Overview of C Programming Language
EL6483: Brief Overview of C Programming Language EL6483 Spring 2016 EL6483 EL6483: Brief Overview of C Programming Language Spring 2016 1 / 30 Preprocessor macros, Syntax for comments Macro definitions
More informationCS201 - Introduction to Programming Glossary By
CS201 - Introduction to Programming Glossary By #include : The #include directive instructs the preprocessor to read and include a file into a source code file. The file name is typically enclosed with
More informationShort Notes of CS201
#includes: Short Notes of CS201 The #include directive instructs the preprocessor to read and include a file into a source code file. The file name is typically enclosed with < and > if the file is a system
More informationC Programming. Course Outline. C Programming. Code: MBD101. Duration: 10 Hours. Prerequisites:
C Programming Code: MBD101 Duration: 10 Hours Prerequisites: You are a computer science Professional/ graduate student You can execute Linux/UNIX commands You know how to use a text-editing tool You should
More informationJump Tables A jump table is essentially a list of places in the code to jump to. This can be thought of in C as an array of function pointers. In Asse
: Some very useful data structures commonly used in embedded systems programming (Jump tables, Circular buffers, Linked lists, Stacks and queues, Memory pools) Spring 2016 : Some very useful data structures
More informationCHAPTER ASSEMBLY LANGUAGE PROGRAMMING
CHAPTER 2 8051 ASSEMBLY LANGUAGE PROGRAMMING Registers Register are used to store information temporarily: A byte of data to be processed An address pointing to the data to be fetched The vast majority
More informationArduino Uno. Power & Interface. Arduino Part 1. Introductory Medical Device Prototyping. Digital I/O Pins. Reset Button. USB Interface.
Introductory Medical Device Prototyping Arduino Part 1, http://saliterman.umn.edu/ Department of Biomedical Engineering, University of Minnesota Arduino Uno Power & Interface Reset Button USB Interface
More informationCS401 - Computer Architecture and Assembly Language Programming Glossary By
CS401 - Computer Architecture and Assembly Language Programming Glossary By absolute address : A virtual (not physical) address within the process address space that is computed as an absolute number.
More informationEE4144: Basic Concepts of Real-Time Operating Systems
EE4144: Basic Concepts of Real-Time Operating Systems EE4144 Fall 2014 EE4144 EE4144: Basic Concepts of Real-Time Operating Systems Fall 2014 1 / 10 Real-Time Operating System (RTOS) A Real-Time Operating
More informationChapter 1 Microprocessor architecture ECE 3120 Dr. Mohamed Mahmoud http://iweb.tntech.edu/mmahmoud/ mmahmoud@tntech.edu Outline 1.1 Computer hardware organization 1.1.1 Number System 1.1.2 Computer hardware
More informationL2 - C language for Embedded MCUs
Formation C language for Embedded MCUs: Learning how to program a Microcontroller (especially the Cortex-M based ones) - Programmation: Langages L2 - C language for Embedded MCUs Learning how to program
More informationCSC 1600 Memory Layout for Unix Processes"
CSC 16 Memory Layout for Unix Processes" 1 Lecture Goals" Behind the scenes of running a program" Code, executable, and process" Memory layout for UNIX processes, and relationship to C" : code and constant
More information538 Lecture Notes Week 1
538 Clowes Lecture Notes Week 1 (Sept. 6, 2017) 1/10 538 Lecture Notes Week 1 Announcements No labs this week. Labs begin the week of September 11, 2017. My email: kclowes@ryerson.ca Counselling hours:
More informationECE 250 / CS 250 Computer Architecture. C to Binary: Memory & Data Representations. Benjamin Lee
ECE 250 / CS 250 Computer Architecture C to Binary: Memory & Data Representations Benjamin Lee Slides based on those from Alvin Lebeck, Daniel Sorin, Andrew Hilton, Amir Roth, Gershon Kedem Administrivia
More informationIntroduction to C. Why C? Difference between Python and C C compiler stages Basic syntax in C
Final Review CS304 Introduction to C Why C? Difference between Python and C C compiler stages Basic syntax in C Pointers What is a pointer? declaration, &, dereference... Pointer & dynamic memory allocation
More informationCS 61C: Great Ideas in Computer Architecture. (Brief) Review Lecture
CS 61C: Great Ideas in Computer Architecture (Brief) Review Lecture Instructor: Justin Hsia 7/16/2013 Summer 2013 Lecture #13 1 Topic List So Far (1/2) Number Representation Signed/unsigned, Floating Point
More informationPractical Malware Analysis
Practical Malware Analysis Ch 4: A Crash Course in x86 Disassembly Revised 1-16-7 Basic Techniques Basic static analysis Looks at malware from the outside Basic dynamic analysis Only shows you how the
More informationELEG3924 Microprocessor
Department of Electrical Engineering University of Arkansas ELEG3924 Microprocessor Ch.2 Assembly Language Programming Dr. Jing Yang jingyang@uark.edu 1 OUTLINE Inside 8051 Introduction to assembly programming
More informationCS356: Discussion #6 Assembly Procedures and Arrays. Marco Paolieri
CS356: Discussion #6 Assembly Procedures and Arrays Marco Paolieri (paolieri@usc.edu) Procedures Functions are a key abstraction in software They break down a problem into subproblems. Reusable functionality:
More informationCMPE-013/L. Introduction to C Programming
CMPE-013/L Introduction to C Programming Bryant Wenborg Mairs Spring 2014 What we will cover in 13/L Embedded C on a microcontroller Specific issues with microcontrollers Peripheral usage Reading documentation
More informationELEG3923 Microprocessor Ch.2 Assembly Language Programming
Department of Electrical Engineering University of Arkansas ELEG3923 Microprocessor Ch.2 Assembly Language Programming Dr. Jingxian Wu wuj@uark.edu OUTLINE 2 Inside 8051 Introduction to assembly programming
More information8051 Microcontrollers
8051 Microcontrollers Richa Upadhyay Prabhu NMIMS s MPSTME richa.upadhyay@nmims.edu March 8, 2016 Controller vs Processor Controller vs Processor Introduction to 8051 Micro-controller In 1981,Intel corporation
More informationProgramming in C. main. Level 2. Level 2 Level 2. Level 3 Level 3
Programming in C main Level 2 Level 2 Level 2 Level 3 Level 3 1 Programmer-Defined Functions Modularize with building blocks of programs Divide and Conquer Construct a program from smaller pieces or components
More informationARM Cortex-M4 Programming Model
ARM Cortex-M4 Programming Model ARM = Advanced RISC Machines, Ltd. ARM licenses IP to other companies (ARM does not fabricate chips) 2005: ARM had 75% of embedded RISC market, with 2.5 billion processors
More informationRun-time Environments
Run-time Environments Status We have so far covered the front-end phases Lexical analysis Parsing Semantic analysis Next come the back-end phases Code generation Optimization Register allocation Instruction
More informationRun-time Environments
Run-time Environments Status We have so far covered the front-end phases Lexical analysis Parsing Semantic analysis Next come the back-end phases Code generation Optimization Register allocation Instruction
More informationIn Java we have the keyword null, which is the value of an uninitialized reference type
+ More on Pointers + Null pointers In Java we have the keyword null, which is the value of an uninitialized reference type In C we sometimes use NULL, but its just a macro for the integer 0 Pointers are
More informationSpecial Topics for Embedded Programming
1 Special Topics for Embedded Programming ETH Zurich Fall 2018 Reference: The C Programming Language by Kernighan & Ritchie 1 2 Overview of Topics Microprocessor architecture Peripherals Registers Memory
More informationCome and join us at WebLyceum
Come and join us at WebLyceum For Past Papers, Quiz, Assignments, GDBs, Video Lectures etc Go to http://www.weblyceum.com and click Register In Case of any Problem Contact Administrators Rana Muhammad
More informationCS Programming In C
CS 24000 - Programming In C Week Two: Basic C Program Organization and Data Types Zhiyuan Li Department of Computer Science Purdue University, USA 2 int main() { } return 0; The Simplest C Program C programs
More informationCSCI 171 Chapter Outlines
Contents CSCI 171 Chapter 1 Overview... 2 CSCI 171 Chapter 2 Programming Components... 3 CSCI 171 Chapter 3 (Sections 1 4) Selection Structures... 5 CSCI 171 Chapter 3 (Sections 5 & 6) Iteration Structures
More informationIMPORTANT QUESTIONS IN C FOR THE INTERVIEW
IMPORTANT QUESTIONS IN C FOR THE INTERVIEW 1. What is a header file? Header file is a simple text file which contains prototypes of all in-built functions, predefined variables and symbolic constants.
More informationAdvanced Operating Systems Embedded from Scratch: System boot and hardware access. Federico Terraneo
Embedded from Scratch: System boot and hardware access federico.terraneo@polimi.it Outline 2/28 Bare metal programming HW architecture overview Linker script Boot process High level programming languages
More informationC Review. MaxMSP Developers Workshop Summer 2009 CNMAT
C Review MaxMSP Developers Workshop Summer 2009 CNMAT C Syntax Program control (loops, branches): Function calls Math: +, -, *, /, ++, -- Variables, types, structures, assignment Pointers and memory (***
More informationMicrocontrollers. Microcontroller
Microcontrollers Microcontroller A microprocessor on a single integrated circuit intended to operate as an embedded system. As well as a CPU, a microcontroller typically includes small amounts of RAM and
More informationLast week. Data on the stack is allocated automatically when we do a function call, and removed when we return
Last week Data can be allocated on the stack or on the heap (aka dynamic memory) Data on the stack is allocated automatically when we do a function call, and removed when we return f() {... int table[len];...
More informationECE 471 Embedded Systems Lecture 5
ECE 471 Embedded Systems Lecture 5 Vince Weaver http://web.eece.maine.edu/~vweaver vincent.weaver@maine.edu 13 September 2016 HW#2 is due Thursday It is going OK? Announcements 1 Homework #1 Review Characteristics
More informationPart 7. Stacks. Stack. Stack. Examples of Stacks. Stack Operation: Push. Piles of Data. The Stack
Part 7 Stacks The Stack Piles of Data Stack Stack A stack is an abstract data structure that stores objects Based on the concept of a stack of items like a stack of dishes Data can only be added to or
More informationCSIS1120A. 10. Instruction Set & Addressing Mode. CSIS1120A 10. Instruction Set & Addressing Mode 1
CSIS1120A 10. Instruction Set & Addressing Mode CSIS1120A 10. Instruction Set & Addressing Mode 1 Elements of a Machine Instruction Operation Code specifies the operation to be performed, e.g. ADD, SUB
More informationCS61C : Machine Structures
inst.eecs.berkeley.edu/~cs61c/su06 CS61C : Machine Structures Lecture #6: Memory Management CS 61C L06 Memory Management (1) 2006-07-05 Andy Carle Memory Management (1/2) Variable declaration allocates
More informationChapter 1. Microprocessor architecture ECE Dr. Mohamed Mahmoud.
Chapter 1 Microprocessor architecture ECE 3130 Dr. Mohamed Mahmoud The slides are copyright protected. It is not permissible to use them without a permission from Dr Mahmoud http://www.cae.tntech.edu/~mmahmoud/
More informationObjectives. ICT106 Fundamentals of Computer Systems Topic 8. Procedures, Calling and Exit conventions, Run-time Stack Ref: Irvine, Ch 5 & 8
Objectives ICT106 Fundamentals of Computer Systems Topic 8 Procedures, Calling and Exit conventions, Run-time Stack Ref: Irvine, Ch 5 & 8 To understand how HLL procedures/functions are actually implemented
More informationTopics. Hardware and Software. Introduction. Main Memory. The CPU 9/21/2014. Introduction to Computers and Programming
Topics C H A P T E R 1 Introduction to Computers and Programming Introduction Hardware and Software How Computers Store Data Using Python Introduction Computers can be programmed Designed to do any job
More informationC Programming SYLLABUS COVERAGE SYLLABUS IN DETAILS
C Programming C SYLLABUS COVERAGE Introduction to Programming Fundamentals in C Operators and Expressions Data types Input-Output Library Functions Control statements Function Storage class Pointer Pointer
More informationCPE 323 MSP430 INSTRUCTION SET ARCHITECTURE (ISA)
CPE 323 MSP430 INSTRUCTION SET ARCHITECTURE (ISA) Aleksandar Milenković Email: milenka@uah.edu Web: http://www.ece.uah.edu/~milenka Objective Introduce MSP430 Instruction Set Architecture (Class of ISA,
More informationChapter 3 Machine Instructions & Programs. Jin-Fu Li Department of Electrical Engineering National Central University Jungli, Taiwan
Chapter 3 Machine Instructions & Programs Jin-Fu Li Department of Electrical Engineering National Central University Jungli, Taiwan Outline Numbers, Arithmetic Operations, and Characters Memory Locations
More informationCS 330 Lecture 18. Symbol table. C scope rules. Declarations. Chapter 5 Louden Outline
CS 0 Lecture 8 Chapter 5 Louden Outline The symbol table Static scoping vs dynamic scoping Symbol table Dictionary associates names to attributes In general: hash tables, tree and lists (assignment ) can
More information17. Instruction Sets: Characteristics and Functions
17. Instruction Sets: Characteristics and Functions Chapter 12 Spring 2016 CS430 - Computer Architecture 1 Introduction Section 12.1, 12.2, and 12.3 pp. 406-418 Computer Designer: Machine instruction set
More informationComputer Systems Lecture 9
Computer Systems Lecture 9 CPU Registers in x86 CPU status flags EFLAG: The Flag register holds the CPU status flags The status flags are separate bits in EFLAG where information on important conditions
More informationMemory Allocation. Static Allocation. Dynamic Allocation. Dynamic Storage Allocation. CS 414: Operating Systems Spring 2008
Dynamic Storage Allocation CS 44: Operating Systems Spring 2 Memory Allocation Static Allocation (fixed in size) Sometimes we create data structures that are fixed and don t need to grow or shrink. Dynamic
More informationOlder geometric based addressing is called CHS for cylinder-head-sector. This triple value uniquely identifies every sector.
Review: On Disk Structures At the most basic level, a HDD is a collection of individually addressable sectors or blocks that are physically distributed across the surface of the platters. Older geometric
More informationName, Scope, and Binding. Outline [1]
Name, Scope, and Binding In Text: Chapter 3 Outline [1] Variable Binding Storage bindings and lifetime Type bindings Type Checking Scope Lifetime vs. Scope Referencing Environments N. Meng, S. Arthur 2
More informationQUIZ. What are 3 differences between C and C++ const variables?
QUIZ What are 3 differences between C and C++ const variables? Solution QUIZ Source: http://stackoverflow.com/questions/17349387/scope-of-macros-in-c Solution The C/C++ preprocessor substitutes mechanically,
More informationData Storage. August 9, Indiana University. Geoffrey Brown, Bryce Himebaugh 2015 August 9, / 19
Data Storage Geoffrey Brown Bryce Himebaugh Indiana University August 9, 2016 Geoffrey Brown, Bryce Himebaugh 2015 August 9, 2016 1 / 19 Outline Bits, Bytes, Words Word Size Byte Addressable Memory Byte
More informationThe CPU and Memory. How does a computer work? How does a computer interact with data? How are instructions performed? Recall schematic diagram:
The CPU and Memory How does a computer work? How does a computer interact with data? How are instructions performed? Recall schematic diagram: 1 Registers A register is a permanent storage location within
More informationCS201 Some Important Definitions
CS201 Some Important Definitions For Viva Preparation 1. What is a program? A program is a precise sequence of steps to solve a particular problem. 2. What is a class? We write a C++ program using data
More informationMachine Language Instructions Introduction. Instructions Words of a language understood by machine. Instruction set Vocabulary of the machine
Machine Language Instructions Introduction Instructions Words of a language understood by machine Instruction set Vocabulary of the machine Current goal: to relate a high level language to instruction
More informationContents. Preface. Introduction. Introduction to C Programming
c11fptoc.fm Page vii Saturday, March 23, 2013 4:15 PM Preface xv 1 Introduction 1 1.1 1.2 1.3 1.4 1.5 Introduction The C Programming Language C Standard Library C++ and Other C-Based Languages Typical
More informationECE 498 Linux Assembly Language Lecture 1
ECE 498 Linux Assembly Language Lecture 1 Vince Weaver http://www.eece.maine.edu/ vweaver vincent.weaver@maine.edu 13 November 2012 Assembly Language: What s it good for? Understanding at a low-level what
More informationCHAPTER 1 Introduction to Computers and Programming CHAPTER 2 Introduction to C++ ( Hexadecimal 0xF4 and Octal literals 031) cout Object
CHAPTER 1 Introduction to Computers and Programming 1 1.1 Why Program? 1 1.2 Computer Systems: Hardware and Software 2 1.3 Programs and Programming Languages 8 1.4 What is a Program Made of? 14 1.5 Input,
More informationData Transfer Instructions
Data Transfer Instructions (Credit: Hui Wu/COMP2121 Lecture Notes) Load Direct (ld): ld Rd, v Rd {r0, r1,..., r31} and v {x, x+, -x, y, y+, -y, z, z+, -z} (remember the X, Y, Z pointers) Load Program Memory
More informationMemory Architectures. Hongwei Zhang. Chapter 9
Chapter 9 Memory Architectures Hongwei Zhang http://www.cs.wayne.edu/~hzhang/ Ack.: this lecture is prepared in part based on slides of Lee, Sangiovanni-Vincentelli, and Seshia. Role of Memory in Embedded
More informationIntroduction to the MIPS. Lecture for CPSC 5155 Edward Bosworth, Ph.D. Computer Science Department Columbus State University
Introduction to the MIPS Lecture for CPSC 5155 Edward Bosworth, Ph.D. Computer Science Department Columbus State University Introduction to the MIPS The Microprocessor without Interlocked Pipeline Stages
More informationFundamental Data Types. CSE 130: Introduction to Programming in C Stony Brook University
Fundamental Data Types CSE 130: Introduction to Programming in C Stony Brook University Program Organization in C The C System C consists of several parts: The C language The preprocessor The compiler
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 informationCS240: Programming in C
CS240: Programming in C Lecture 6: Recursive Functions. C Pre-processor. Cristina Nita-Rotaru Lecture 6/ Fall 2013 1 Functions: extern and static Functions can be used before they are declared static for
More informationChapter 2A Instructions: Language of the Computer
Chapter 2A Instructions: Language of the Computer Copyright 2009 Elsevier, Inc. All rights reserved. Instruction Set The repertoire of instructions of a computer Different computers have different instruction
More informationNumber Systems for Computers. Outline of Introduction. Binary, Octal and Hexadecimal numbers. Issues for Binary Representation of Numbers
Outline of Introduction Administrivia What is computer architecture? What do computers do? Representing high level things in binary Data objects: integers, decimals, characters, etc. Memory locations (We
More informationCPSC213/2014W1 Midterm EXTRA Practice
CPSC213/2014W1 Midterm EXTRA Practice DEC/HEX/BIN NUMERACY 1. Convert into decimal: 1a. 0x33 1b. 0x57 1c. 0xaf 1d. 0x7a 1e. 0x1234 1f. 0x69bd 1g. 0x1a64 1h. 0xdead 2. Convert into hex numbers of the specified
More informationCIT Week13 Lecture
CIT 3136 - Week13 Lecture Runtime Environments During execution, allocation must be maintained by the generated code that is compatible with the scope and lifetime rules of the language. Typically there
More informationFinal Exam. 11 May 2018, 120 minutes, 26 questions, 100 points
Name: CS520 Final Exam 11 May 2018, 120 minutes, 26 questions, 100 points The exam is closed book and notes. Please keep all electronic devices turned off and out of reach. Note that a question may require
More informationWork relative to other classes
Work relative to other classes 1 Hours/week on projects 2 C BOOTCAMP DAY 1 CS3600, Northeastern University Slides adapted from Anandha Gopalan s CS132 course at Univ. of Pittsburgh Overview C: A language
More informationECE 471 Embedded Systems Lecture 6
ECE 471 Embedded Systems Lecture 6 Vince Weaver http://web.eece.maine.edu/~vweaver vincent.weaver@maine.edu 17 September 2018 Announcements HW#2 was posted, it is due Friday 1 Homework #1 Review Characteristics
More informationo Code, executable, and process o Main memory vs. virtual memory
Goals for Today s Lecture Memory Allocation Prof. David August COS 217 Behind the scenes of running a program o Code, executable, and process o Main memory vs. virtual memory Memory layout for UNIX processes,
More informationReview of the C Programming Language for Principles of Operating Systems
Review of the C Programming Language for Principles of Operating Systems Prof. James L. Frankel Harvard University Version of 7:26 PM 4-Sep-2018 Copyright 2018, 2016, 2015 James L. Frankel. All rights
More informationChapter 1 INTRODUCTION
Chapter 1 INTRODUCTION A digital computer system consists of hardware and software: The hardware consists of the physical components of the system. The software is the collection of programs that a computer
More informationFor Teacher's Use Only Q No Total Q No Q No
Student Info Student ID: Center: Exam Date: FINALTERM EXAMINATION Spring 2010 CS201- Introduction to Programming Time: 90 min Marks: 58 For Teacher's Use Only Q No. 1 2 3 4 5 6 7 8 Total Marks Q No. 9
More informationFaculty of Electrical Engineering, Mathematics, and Computer Science Delft University of Technology
Faculty of Electrical Engineering, Mathematics, and Computer Science Delft University of Technology exam Compiler Construction in4303 April 9, 2010 14.00-15.30 This exam (6 pages) consists of 52 True/False
More informationEmbedded Systems - FS 2018
Institut für Technische Informatik und Kommunikationsnetze Prof. L. Thiele Embedded Systems - FS 2018 Lab 0 Date : 28.2.2018 Prelab Filling the gaps Goals of this Lab You are expected to be already familiar
More informationThe Design of C: A Rational Reconstruction
The Design of C: A Rational Reconstruction 1 Goals of this Lecture Help you learn about: The decisions that were available to the designers of C The decisions that were made by the designers of C and thereby
More informationDo-While Example. In C++ In assembly language. do { z--; while (a == b); z = b; loop: addi $s2, $s2, -1 beq $s0, $s1, loop or $s2, $s1, $zero
Do-While Example In C++ do { z--; while (a == b); z = b; In assembly language loop: addi $s2, $s2, -1 beq $s0, $s1, loop or $s2, $s1, $zero 25 Comparisons Set on less than (slt) compares its source registers
More informationReliable C++ development - session 1: From C to C++ (and some C++ features)
Reliable C++ development - session 1: From C to C++ (and some C++ features) Thibault CHOLEZ - thibault.cholez@loria.fr TELECOM Nancy - Université de Lorraine LORIA - INRIA Nancy Grand-Est From Nicolas
More informationThe Design of C: A Rational Reconstruction"
The Design of C: A Rational Reconstruction 1 Goals of this Lecture Help you learn about: The decisions that were available to the designers of C The decisions that were made by the designers of C and thereby
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 informationEmbedded Systems - FS 2018
Institut für Technische Informatik und Kommunikationsnetze Prof. L. Thiele Embedded Systems - FS 2018 Embedded System Companion Introduction As its name indicates, the Embedded System Companion has been
More informationFundamentals of Programming
Fundamentals of Programming Pointers Giuseppe Lipari http://retis.sssup.it/~lipari Scuola Superiore Sant Anna Pisa February 29, 2012 G. Lipari (Scuola Superiore Sant Anna) Pointers February 29, 2012 1
More informationTechnical Questions. Q 1) What are the key features in C programming language?
Technical Questions Q 1) What are the key features in C programming language? Portability Platform independent language. Modularity Possibility to break down large programs into small modules. Flexibility
More informationQuiz Start Time: 09:34 PM Time Left 82 sec(s)
Quiz Start Time: 09:34 PM Time Left 82 sec(s) Question # 1 of 10 ( Start time: 09:34:54 PM ) Total Marks: 1 While developing a program; should we think about the user interface? //handouts main reusability
More informationReview of the C Programming Language
Review of the C Programming Language Prof. James L. Frankel Harvard University Version of 11:55 AM 22-Apr-2018 Copyright 2018, 2016, 2015 James L. Frankel. All rights reserved. Reference Manual for the
More informationIntroduction to Java Programming
Introduction to Java Programming Lecture 1 CGS 3416 Spring 2017 1/9/2017 Main Components of a computer CPU - Central Processing Unit: The brain of the computer ISA - Instruction Set Architecture: the specific
More informationWhy Pointers. Pointers. Pointer Declaration. Two Pointer Operators. What Are Pointers? Memory address POINTERVariable Contents ...
Why Pointers Pointers They provide the means by which functions can modify arguments in the calling function. They support dynamic memory allocation. They provide support for dynamic data structures, such
More informationCMU MSP 36601: Computer Hardware and Data Representation
CMU MSP 36601: Computer Hardware and Data Representation H. Seltman, September 6, 2017 1. Warm-up in R a. > 0.1+0.1+0.1 == 0.3 [1] FALSE b. > 1e15+1e32 == 1e32 [1] TRUE c. > 1e-324 == 0 [1] TRUE d. > 1e-324
More informationCENG 447/547 Embedded and Real-Time Systems. Review of C coding and Soft Eng Concepts
CENG 447/547 Embedded and Real-Time Systems Review of C coding and Soft Eng Concepts Recall (C-style coding syntax) ; - Indicate the end of an expression {} - Used to delineate when a sequence of elements
More informationAdvanced Programming & C++ Language
Advanced Programming & C++ Language ~6~ Introduction to Memory Management Ariel University 2018 Dr. Miri (Kopel) Ben-Nissan Stack & Heap 2 The memory a program uses is typically divided into four different
More informationCS201 Latest Solved MCQs
Quiz Start Time: 09:34 PM Time Left 82 sec(s) Question # 1 of 10 ( Start time: 09:34:54 PM ) Total Marks: 1 While developing a program; should we think about the user interface? //handouts main reusability
More informationLecture 03 Bits, Bytes and Data Types
Lecture 03 Bits, Bytes and Data Types Computer Languages A computer language is a language that is used to communicate with a machine. Like all languages, computer languages have syntax (form) and semantics
More informationC H A P T E R 1. Introduction to Computers and Programming
C H A P T E R 1 Introduction to Computers and Programming Topics Introduction Hardware and Software How Computers Store Data How a Program Works Using Python Computer Uses What do students use computers
More informationA S H O R T I S H O V E R V I E W O F T H E A N S I C P R O G R A M M I N G L A N G U A G E
A S H O R T I S H O V E R V I E W O F T H E A N S I C P R O G R A M M I N G L A N G U A G E IDENTIFIERS Identifiers are names of variables, functions, defined types, structures and unions, enumeration
More informationA.Arpaci-Dusseau. Mapping from logical address space to physical address space. CS 537:Operating Systems lecture12.fm.2
UNIVERSITY of WISCONSIN-MADISON Computer Sciences Department CS 537 A. Arpaci-Dusseau Intro to Operating Systems Spring 2000 Dynamic Memory Allocation Questions answered in these notes When is a stack
More informationLABORATORIO DI ARCHITETTURE E PROGRAMMAZIONE DEI SISTEMI ELETTRONICI INDUSTRIALI
LABORATORIO DI ARCHITETTURE E PROGRAMMAZIONE DEI SISTEMI ELETTRONICI INDUSTRIALI Laboratory Lesson 1: - Introduction to System Workbench for STM32 - Programming and debugging Prof. Luca Benini
More information