Introduction to Micro-controller Software. Gary J. Minden September 3, 2013

Similar documents
EECS 388 Embedded Systems Example Program Structure. Gary J. Minden August 24, 2016

ARM Cortex M3 Instruction Set Architecture. Gary J. Minden March 29, 2016

FreeRTOS. Gary J. Minden October 19, 2017

EE 5340/7340 Motorola 68HC11 Microcontroler Lecture 1. Carlos E. Davila, Electrical Engineering Dept. Southern Methodist University

Stack Frames. September 2, Indiana University. Geoffrey Brown, Bryce Himebaugh 2015 September 2, / 15

ARM Cortex A9. ARM Cortex A9

ARM Architecture and Assembly Programming Intro

Chapter 12. Microcontroller Application Development Tools

ARM Cortex-M4 Programming Model

Final Exam. Date: May 12, 2017

MICROPROCESSOR BASED SYSTEM DESIGN

8051 Microcontrollers

EE 308: Microcontrollers

Program SoC using C Language

Running C programs bare metal on ARM using the GNU toolchain

ECE254 Lab3 Tutorial. Introduction to MCB1700 Hardware Programming. Irene Huang

University of Texas at Austin Electrical and Computer Engineering Department. EE319K, Embedded Systems, Spring 2013 Final Exam

ECE254 Lab3 Tutorial. Introduction to Keil LPC1768 Hardware and Programmers Model. Irene Huang

HC11 Instruction Set Architecture

HC11 Instruction Set Architecture

Chapter 3. Z80 Instructions & Assembly Language. Von Neumann Architecture. Memory. instructions. program. data


Modes and Levels. Registers. Registers. Cortex-M3 programming

The Next Steps in the Evolution of ARM Cortex-M

Mark II Aiken Relay Calculator

E85 Lab 8: Assembly Language

M2351 TrustZone Program Development

Exam 1. Date: February 23, 2016

Using Code Composer Studio IDE with MSP432

ELEG3924 Microprocessor

VARDHAMAN COLLEGE OF ENGINEERING (AUTONOMOUS) Shamshabad, Hyderabad

ELEG3923 Microprocessor Ch.2 Assembly Language Programming

Interrupts (Exceptions) Gary J. Minden September 11, 2014

CHAPTER ASSEMBLY LANGUAGE PROGRAMMING

CODE TIME TECHNOLOGIES. Abassi RTOS. Porting Document. ARM Cortex-M3 CCS

Interrupts (Exceptions) (From LM3S1968) Gary J. Minden August 29, 2016

button.c The little button that wouldn t

IoT and Security: ARM v8-m Architecture. Robert Boys Product Marketing DSG, ARM. Spring 2017: V 3.1

CC411: Introduction To Microprocessors

Implementing Secure Software Systems on ARMv8-M Microcontrollers

ELC4438: Embedded System Design ARM Cortex-M Architecture II

Description of the Simulator

ARM Cortex-A9 ARM v7-a. A programmer s perspective Part1

Raspberry Pi / ARM Assembly. OrgArch / Fall 2018

Chapter 1. Microprocessor architecture ECE Dr. Mohamed Mahmoud.

Optimizing C For Microcontrollers

ARM Interrupts. EE383: Introduction to Embedded Systems University of Kentucky. James E. Lumpp

CSE 410. Operating Systems

COSC345 Software Engineering. Basic Computer Architecture and The Stack

The 8051 Microcontroller and Embedded Systems

E3940 Microprocessor Systems Laboratory. Introduction to the Z80

ECE251: Thursday September 27

Advanced Operating Systems Embedded from Scratch: System boot and hardware access. Federico Terraneo

Copyright The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Review Topics

EE 308: Microcontrollers

ECE251: Intro to Microprocessors Name: Solutions Mid Term Exam October 4, 2018

8086 Interrupts and Interrupt Responses:

CHAPTER 2: AVR ARCHITECTURE & ASSEMBLY LANGUAGE PROGRAMMING

Hands-On with STM32 MCU Francesco Conti

Application Note 112 version 1.1 Installing a User program in EPROM on the Intel 8x930 4 Port USB Evaluation Board

Exam I Review February 2017

Virtual Memory Worksheet

esi-risc Development Suite Getting Started Guide

ARM Assembly Programming

EE319K Fall 2013 Exam 1B Modified Page 1. Exam 1. Date: October 3, 2013

Getting the O in I/O to work on a typical microcontroller

Exam 1. EE319K Spring 2013 Exam 1 (Practice 1) Page 1. Date: February 21, 2013; 9:30-10:45am. Printed Name:

1. Introduction to Assembly Language

Assembly Language Programming

ECE2049 Homework #2 The MSP430 Architecture & Basic Digital IO (DUE Friday 9/8/17 at 4 pm in class)

(Embedded) Systems Programming Overview

Intel x86 instruction set architecture

ARM Assembly Programming

Design and Implementation Interrupt Mechanism

COSC 243. Instruction Sets And Addressing Modes. Lecture 7&8 Instruction Sets and Addressing Modes. COSC 243 (Computer Architecture)

ST7 MICROCONTROLLER TRAINING

538 Lecture Notes Week 1

9/25/ Software & Hardware Architecture

ECE251: Tuesday September 18

Lesson 2 Prototyping Embedded Software on Arduino on Arduino boards. Chapter-9 L02: "Internet of Things ", Raj Kamal, Publs.: McGraw-Hill Education

CodeWarrior. Microcomputer Architecture and Interfacing Colorado School of Mines Professor William Hoff

EECS 388 Laboratory Exercise #9 Assembly Language Gary J. Minden Laboratory week of: April 24, 2017

ME4447/6405. Microprocessor Control of Manufacturing Systems and Introduction to Mechatronics. Instructor: Professor Charles Ume LECTURE 7

Application Note 606 Configuring Keil PK51 Tools to Support 24-Bit Contiguous Addressing Mode

CHETTINAD COLLEGE OF ENGINEERING AND TECHNOLOGY COMMUNICATION ENGINEERING REG 2008 TWO MARKS QUESTION AND ANSWERS

ECE 362 Lab Verification / Evaluation Form Experiment 3

Instruction Set Architectures

Systems Architecture The Stack and Subroutines

MIDTERM#1. 2-(3pts) What is the difference between Von Neumann & Harvard processor architectures?

OUTLINE. STM32F0 Architecture Overview STM32F0 Core Motivation for RISC and Pipelining Cortex-M0 Programming Model Toolchain and Project Structure

Last Time. Low-level parts of the toolchain for embedded systems. Any weak link in the toolchain will hinder development

Embedded Systems Laboratory Manual ARM 9 TDMI

Accumulator and memory instructions 1. Loads, stores, and transfers 2. Arithmetic operations 3. Multiply and divide 4. Logical operations 5. Data test

EECS 373 Design of Microprocessor-Based Systems

Special Topics for Embedded Programming

Data in Memory. variables have multiple attributes. variable

gpio timer uart printf malloc keyboard fb gl console shell

EE445M/EE380L.6 Quiz 2 Spring 2017 Solution Page 1 of 5

6 GPIO 84. Date: 29/09/2016 Name: ID: This laboratory session discusses about writing program to interact with GPIO of Reapberry Pi.

Computer Organization & Assembly Language Programming (CSE 2312)

Transcription:

Introduction to Micro-controller Software Gary J. Minden September 3, 2013 1

Microcontroller Software How developed Language (C) Tools Organization/Structure How deployed Organization in memory How executed 2

Tools -- Code Composer 3

Tools -- Behind Code Composer Your Program cpp cc A *.c *.c (Expanded) *.s *.asm (Assembler Code) *.h Definitions of Code you use (reference) 4

Tools -- Behind Code Composer A as ld B *.o (Object) *.bin *.out (Complete Program) *.lst *.o *.a Other programs Libraries *.map 5

Debugger 6

Debugging B Debug PC Putty Serial Communications LM3S1968 Eval Board 7

Typical C File static unsigned long Task0NextExecute = 0; static unsigned long Task0DeltaExecute = 50; // 50 SysTicks void Task0_Init() { // // Enable the GPIO Port G. // SysCtlPeripheralEnable( SYSCTL_PERIPH_GPIOG ); // // Configure GPIO_G to drive the Status LED. // GPIOPinTypeGPIOOutput( GPIO_PORTG_BASE, GPIO_PIN_2 ); 8

Typical Assembly Language ;--------------------------------------------------------------- ; 73 int W, X, Y, Z; ;---------------------------------------------------------------- LDR V1, [SP, #16] ; 72 ;---------------------------------------------------------------- ; 75 W = A + B + C; ;---------------------------------------------------------------- ADDS A1, A2, A1 ; 75 ADDS V2, A3, A1 ; 75 ;---------------------------------------------------------------- ; 76 X = B + C + D; ;---------------------------------------------------------------- ADDS A1, A3, A2 ; 76 ADDS A2, A4, A1 ; 76 ;---------------------------------------------------------------- ; 77 Y = C + D + E; ;---------------------------------------------------------------- ADDS A1, A4, A3 ; 77 ADDS A3, V1, A1 ; 77 ;---------------------------------------------------------------- 9

Typical Listing File 360 00000000 Task0_Init: 361 ;* ----------------------------------------------------------------------* 362.dwcfi cfa_offset, 0 363 00000000 B510 PUSH {V1, LR} ; [DPU_3_PIPE] ; [ORIG 16-BIT INS] 364.dwcfi cfa_offset, 4 365.dwcfi save_reg_to_mem, 14, -4 366.dwcfi cfa_offset, 8 367.dwcfi save_reg_to_mem, 4, -8 368.dwcfi cfa_offset, 8 369.dwpsn file "../Task_Blinky.c",line 90,column 5,is_stmt,isa 1 370 00000002 480B LDR A1, $C$CON1 ; [DPU_3_PIPE] 90 ; [ORIG 16-BIT INS] 371 $C$DW$52.dwtag DW_TAG_TI_branch 372.dwattr $C$DW$52, DW_AT_low_pc(0x00) 373.dwattr $C$DW$52, DW_AT_name("SysCtlPeripheralEnable") 374.dwattr $C$DW$52, DW_AT_TI_call 375 00000004 FFFEF7FF! BL SysCtlPeripheralEnable ; [DPU_3_PIPE] 90 ; [KEEP 32-BIT INS] 376 ; CALL OCCURS {SysCtlPeripheralEnable } ; [] 90 377.dwpsn file "../Task_Blinky.c",line 96,column 5,is_stmt,isa 1 378 00000008 4C0A LDR V1, $C$CON2 ; [DPU_3_PIPE] 96 ; [ORIG 16-BIT INS] Relative Memory Address 10

Typical Listing File 360 00000000 Task0_Init: 361 ;* ----------------------------------------------------------------------* 362.dwcfi cfa_offset, 0 363 00000000 B510 PUSH {V1, LR} ; [DPU_3_PIPE] ; [ORIG 16-BIT INS] 364.dwcfi cfa_offset, 4 365.dwcfi save_reg_to_mem, 14, -4 366.dwcfi cfa_offset, 8 367.dwcfi save_reg_to_mem, 4, -8 368.dwcfi cfa_offset, 8 369.dwpsn file "../Task_Blinky.c",line 90,column 5,is_stmt,isa 1 370 00000002 480B LDR A1, $C$CON1 ; [DPU_3_PIPE] 90 ; [ORIG 16-BIT INS] 371 $C$DW$52.dwtag DW_TAG_TI_branch 372.dwattr $C$DW$52, DW_AT_low_pc(0x00) 373.dwattr $C$DW$52, DW_AT_name("SysCtlPeripheralEnable") 374.dwattr $C$DW$52, DW_AT_TI_call 375 00000004 FFFEF7FF! BL SysCtlPeripheralEnable ; [DPU_3_PIPE] 90 ; [KEEP 32-BIT INS] 376 ; CALL OCCURS {SysCtlPeripheralEnable } ; [] 90 377.dwpsn file "../Task_Blinky.c",line 96,column 5,is_stmt,isa 1 378 00000008 4C0A LDR V1, $C$CON2 ; [DPU_3_PIPE] 96 ; [ORIG 16-BIT INS] Instruction Mnemonic 11

Typical Listing File 360 00000000 Task0_Init: 361 ;* ----------------------------------------------------------------------* 362.dwcfi cfa_offset, 0 363 00000000 B510 PUSH {V1, LR} ; [DPU_3_PIPE] ; [ORIG 16-BIT INS] 364.dwcfi cfa_offset, 4 365.dwcfi save_reg_to_mem, 14, -4 366.dwcfi cfa_offset, 8 367.dwcfi save_reg_to_mem, 4, -8 368.dwcfi cfa_offset, 8 369.dwpsn file "../Task_Blinky.c",line 90,column 5,is_stmt,isa 1 370 00000002 480B LDR A1, $C$CON1 ; [DPU_3_PIPE] 90 ; [ORIG 16-BIT INS] 371 $C$DW$52.dwtag DW_TAG_TI_branch 372.dwattr $C$DW$52, DW_AT_low_pc(0x00) 373.dwattr $C$DW$52, DW_AT_name("SysCtlPeripheralEnable") 374.dwattr $C$DW$52, DW_AT_TI_call 375 00000004 FFFEF7FF! BL SysCtlPeripheralEnable ; [DPU_3_PIPE] 90 ; [KEEP 32-BIT INS] 376 ; CALL OCCURS {SysCtlPeripheralEnable } ; [] 90 377.dwpsn file "../Task_Blinky.c",line 96,column 5,is_stmt,isa 1 378 00000008 4C0A LDR V1, $C$CON2 ; [DPU_3_PIPE] 96 ; [ORIG 16-BIT INS] Instruction Operands 12

Typical Listing File 360 00000000 Task0_Init: 361 ;* ----------------------------------------------------------------------* 362.dwcfi cfa_offset, 0 363 00000000 B510 PUSH {V1, LR} ; [DPU_3_PIPE] ; [ORIG 16-BIT INS] 364.dwcfi cfa_offset, 4 365.dwcfi save_reg_to_mem, 14, -4 366.dwcfi cfa_offset, 8 367.dwcfi save_reg_to_mem, 4, -8 368.dwcfi cfa_offset, 8 369.dwpsn file "../Task_Blinky.c",line 90,column 5,is_stmt,isa 1 370 00000002 480B LDR A1, $C$CON1 ; [DPU_3_PIPE] 90 ; [ORIG 16-BIT INS] 371 $C$DW$52.dwtag DW_TAG_TI_branch 372.dwattr $C$DW$52, DW_AT_low_pc(0x00) 373.dwattr $C$DW$52, DW_AT_name("SysCtlPeripheralEnable") 374.dwattr $C$DW$52, DW_AT_TI_call 375 00000004 FFFEF7FF! BL SysCtlPeripheralEnable ; [DPU_3_PIPE] 90 ; [KEEP 32-BIT INS] 376 ; CALL OCCURS {SysCtlPeripheralEnable } ; [] 90 377.dwpsn file "../Task_Blinky.c",line 96,column 5,is_stmt,isa 1 378 00000008 4C0A LDR V1, $C$CON2 ; [DPU_3_PIPE] 96 ; [ORIG 16-BIT INS] Hardware Instruction 13

Typical Listing File 360 00000000 Task0_Init: 361 ;* ----------------------------------------------------------------------* 362.dwcfi cfa_offset, 0 363 00000000 B510 PUSH {V1, LR} ; [DPU_3_PIPE] ; [ORIG 16-BIT INS] 364.dwcfi cfa_offset, 4 365.dwcfi save_reg_to_mem, 14, -4 366.dwcfi cfa_offset, 8 367.dwcfi save_reg_to_mem, 4, -8 368.dwcfi cfa_offset, 8 369.dwpsn file "../Task_Blinky.c",line 90,column 5,is_stmt,isa 1 370 00000002 480B LDR A1, $C$CON1 ; [DPU_3_PIPE] 90 ; [ORIG 16-BIT INS] 371 $C$DW$52.dwtag DW_TAG_TI_branch 372.dwattr $C$DW$52, DW_AT_low_pc(0x00) 373.dwattr $C$DW$52, DW_AT_name("SysCtlPeripheralEnable") 374.dwattr $C$DW$52, DW_AT_TI_call 375 00000004 FFFEF7FF! BL SysCtlPeripheralEnable ; [DPU_3_PIPE] 90 ; [KEEP 32-BIT INS] 376 ; CALL OCCURS {SysCtlPeripheralEnable } ; [] 90 377.dwpsn file "../Task_Blinky.c",line 96,column 5,is_stmt,isa 1 378 00000008 4C0A LDR V1, $C$CON2 ; [DPU_3_PIPE] 96 ; [ORIG 16-BIT INS] Comments 14

Tools -- Behind Code Composer A as ld B *.o (Object) *.bin *.out (Complete Program) *.lst *.o *.a Other programs Libraries *.map 15

Typical Map File SEGMENT ALLOCATION MAP run origin load origin length init length attrs members ---------- ----------- ---------- ----------- ----- ------- 00000000 00000000 000004a8 000004a8 r-x 00000000 00000000 0000011c 0000011c r--.intvecs 0000011c 0000011c 0000036c 0000036c r-x.text 00000488 00000488 00000020 00000020 r--.cinit 20000000 20000000 00000800 00000000 rw- 20000000 20000000 00000800 00000000 rw-.stack 20000800 20000800 00000018 00000018 rw- 20000800 20000800 00000018 00000018 rw-.data Segment Memory Start Address Segment Memory Size (Bytes) Segment Init. Size (Bytes) Segment Attributes Segment Name Segment == Section Values in Hex 16

CPU/Memory Structure Data Path Memory Addresses Data Memory Instruction Processing CPU 17

Memory Structure Address Array of data bytes Grouped 4-bytes to a Word, 32-bit words CPU provides address CPU reads (copies) data from memory to CPU OR CPU writes new data to Memory To/From Memory & I/O Bus 18

LM3S1968 Memory Map Peripherals 0x400F EFFF 0x4000 0000 Variables Stack SRAM 0x2000 FFFF 0x2000 0000 64 KB Programs Constants Interrupt Vectors Flash 0x0003 FFFF 0x0000 0000 256 KB 19