Keil Debugger Tutorial



Similar documents
Overview of the Cortex-M3

Microprocessor & Assembly Language

Keil C51 Cross Compiler

ASSEMBLY PROGRAMMING ON A VIRTUAL COMPUTER

Cortex -M0 Devices. Generic User Guide. Copyright 2009 ARM Limited. All rights reserved. ARM DUI 0497A (ID112109)

DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING Question Bank Subject Name: EC Microprocessor & Microcontroller Year/Sem : II/IV

DsPIC HOW-TO GUIDE Creating & Debugging a Project in MPLAB

Cortex -M3 Devices. Generic User Guide. Copyright 2010 ARM. All rights reserved. ARM DUI 0552A (ID121610)

Quick Start Tutorial. Using the TASKING* Software Development Tools with the Intel 8x930 Family Evaluation Board

TRACE32 Debugger Getting Started... ICD Tutorial About the Tutorial... 2

Embedded Software development Process and Tools:

Using the CoreSight ITM for debug and testing in RTX applications

Software based Finite State Machine (FSM) with general purpose processors

Preparing the Windows version of the software for use

isppac-powr1220at8 I 2 C Hardware Verification Utility User s Guide

PM0056 Programming manual

Training Simulator and Demo Software

S7 for Windows S7-300/400

CHAPTER 7: The CPU and Memory

EE8205: Embedded Computer System Electrical and Computer Engineering, Ryerson University. Introduction to Keil uvision and ARM Cortex M3

AVR Butterfly Training. Atmel Norway, AVR Applications Group

National CR16C Family On-Chip Emulation. Contents. Technical Notes V

Figure 1: Graphical example of a mergesort 1.

Lab Creating a Logical Network Diagram

IAR C-SPY Hardware Debugger Systems User Guide. for Renesas PC7501 Emulator and ROM-monitor

Exception and Interrupt Handling in ARM

FRONT FLYLEAF PAGE. This page has been intentionally left blank

1 Intel Smart Connect Technology Installation Guide:

This section provides a 'Quickstart' guide to using TestDriven.NET any version of Microsoft Visual Studio.NET

Ride7 for ARM. RAISONANCE Tools for the STRx and STM32 families. Overview and Getting Started

Microcontroller Basics A microcontroller is a small, low-cost computer-on-a-chip which usually includes:

Building an Embedded Processor System on a Xilinx Zync FPGA (Profiling): A Tutorial

USBSPYDER08 Discovery Kit for Freescale MC9RS08KA, MC9S08QD and MC9S08QG Microcontrollers User s Manual

Memory Management Simulation Interactive Lab

Versa Ware JTAG Software User Guide Rev 2.0

CodeWarrior Development Studio for Freescale S12(X) Microcontrollers Quick Start

MICROPROCESSOR AND MICROCOMPUTER BASICS

Using Process Monitor

RTOS Debugger for ecos

Soft processors for microcontroller programming education

Getting Started with CodeXL

Project Manager Editor & Debugger

1) The Keil Blinky example: 6

SKP16C62P Tutorial 1 Software Development Process using HEW. Renesas Technology America Inc.

Application Note 195. ARM11 performance monitor unit. Document number: ARM DAI 195B Issued: 15th February, 2008 Copyright ARM Limited 2007

CSC 2405: Computer Systems II

Freescale Semiconductor, I

How to test and debug an ASP.NET application

Exceptions in MIPS. know the exception mechanism in MIPS be able to write a simple exception handler for a MIPS machine

How do I Check if My Computer is Compatible with Windows 7

3. Programming the STM32F4-Discovery

Interrupt handling. Andrew N. Sloss

UM1680 User manual. Getting started with STM32F429 Discovery software development tools. Introduction

The Answer to the 14 Most Frequently Asked Modbus Questions

Debugging Network Communications. 1 Check the Network Cabling

PART B QUESTIONS AND ANSWERS UNIT I

UNIT 4 Software Development Flow

INGENIEURBÜRO FÜR TECHNOLOGIE TRANSFER DIPL.-ING. B. P. SCHULZ-HEISE. Getting Started with. S7 for Windows. Version 6.x

Debugging A MotoHawk Application using the Application Monitor

Using the HCS12 Serial Monitor on Wytec Dragon-12 boards. Using Motorola s HCS12 Serial Monitor on Wytec s Dragon-12 boards

MICROPROCESSOR. Exclusive for IACE Students iacehyd.blogspot.in Ph: /422 Page 1

The BSN Hardware and Software Platform: Enabling Easy Development of Body Sensor Network Applications

Programmazione Microcontrollori

ADVANCED PROCESSOR ARCHITECTURES AND MEMORY ORGANISATION Lesson-17: Memory organisation, and types of memory

Infineon XMC4000: Cortex -M4 Lab

Interrupts and the Timer Overflow Interrupts Huang Sections What Happens When You Reset the HCS12?

Lesson-16: Real time clock DEVICES AND COMMUNICATION BUSES FOR DEVICES NETWORK

LatticeECP2/M S-Series Configuration Encryption Usage Guide

VMWare Workstation 11 Installation MICROSOFT WINDOWS SERVER 2008 R2 STANDARD ENTERPRISE ED.

STMicroelectronics: Cortex -M4 Training STM32F429 Discovery evaluation board using ARM Keil MDK toolkit

ARM Cortex-M3 Introduction. ARM University Relations

PCSpim Tutorial. Nathan Goulding-Hotta v0.1

Table 1 below is a complete list of MPTH commands with descriptions. Table 1 : MPTH Commands. Command Name Code Setting Value Description

KIP AutoCAD Installation and User Guide. KIP AutoCAD Installation and User Guide

Aspen ONE V8 Installation Instructions

CooCox CoIDE UserGuide Version: page 1. Free ARM Cortex M3 and Cortex M0 IDE: CooCox CoIDE UserGuide

TN0072 Technical note

DRV8312-C2-KIT How to Run Guide

Nuvoton Nu-Link Debug Adapter User Manual

For Introduction to Java Programming, 5E By Y. Daniel Liang

ROM Monitor. Entering the ROM Monitor APPENDIX

Central Processing Unit Simulation Version v2.5 (July 2005) Charles André University Nice-Sophia Antipolis

Use of Simulator in Teaching Introductory Computer Engineering*

DS-5 ARM. Using the Debugger. Version Copyright ARM. All rights reserved. ARM DUI 0446M (ID120712)

VisionView Maintenance Utility Release Notes

V 6.1 Core Training Training Plan

Technical Note. Micron NAND Flash Controller via Xilinx Spartan -3 FPGA. Overview. TN-29-06: NAND Flash Controller on Spartan-3 Overview

11.1. Performance Monitoring

ebus Player Quick Start Guide

EE8205: Embedded Computer System Electrical and Computer Engineering, Ryerson University. Multitasking ARM-Applications with uvision and RTX

EMCO Network Inventory 5.x

Using Virtual PC 7.0 for Mac with GalleryPro

DS-5 ARM. Using the Debugger. Version 5.7. Copyright 2010, 2011 ARM. All rights reserved. ARM DUI 0446G (ID092311)

An Introduction to the ARM 7 Architecture

S4000TH HART. HART Communication Manual

LADDER LOGIC/ FLOWCHART PROGRAMMING DIFFERENCES AND EXAMPLES

Integration for X-Tools and X32

Control III Programming in C (small PLC)

DS-5 ARM. Using the Debugger. Version Copyright ARM. All rights reserved. ARM DUI0446P

Ethernet/IP Explicit Messaging Using Unity Software

Transcription:

Keil Debugger Tutorial Yifeng Zhu December 17, 2014 Software vs Hardware Debug There are two methods to debug your program: software debug and hardware debug. By using the software debug, you do not have to have the hardware board to debug a software program. However, the hardware debug requires you to connect the board to the computer. Selecting software debug Selecting hardware debug Debug Control You can program the STM32 flash by clicking the LOAD button. Click the debug button to start the debug and click it again to exit the debug. You can use the breakpoint button to set a break point in either disassembly or source windows. STM32 allows up to six breakpoints during hardware debugging. When a program stops at a breakpoint, the corresponding instruction has not been executed yet. If the disassembly window is in focus, the debugger executes assembly instructions step by step. If the source window is focused, the debugger then steps through the source lines instead. The following table summarizes commonly used debug control buttons. Start Debug Set a Breakpoint Run Stop Debug Step In Step Over Step Out Run: Continues the execution from the current position until you click Stop or the program is paused by a breakpoint. Step In: Execute one step and enter the function if the current step calls a function. 1

Step Over: Execute one step and run the function all at once if the current step calls a function. Step Out: Execute until the current function returns. Memory Window The memory window is used to view the memory content in real time. By default, the address of data memory (RAM) starts at 0x2000_0000. This is specified in the scatter-loading file (*.sct). The following assembly program defines and allocates an array of four words. Each word consists of four bytes. When we type the memory address 0x20000000, we can see the content of this array. AREA mydata, DATA, READWRITE ALIGN array DCD 1, 2, 3, 4 The memory content is displayed in bytes by default. By right click, we can select different display format. For example, we can show the content as unsigned integers. 2

Save Memory Content to a File In the debug environment, run the following command in the Command Window: SAVE <filename> <start address>, <end address> This allows you to perform data analysis in other software tools, such as Microsoft Excel and Matlab. The output is saved in Intel HEX format. For example, SAVE memory.dat 0x20000000, 0x20000888 3

Processor Registers Core Registers: Program counter (PC) r15 holds the memory address (location in memory) of the next instruction to be fetched from the instruction memory. Stack point (SP) r13 holds a memory address that points to the top of the stack. SP is a shadow of either MSP or PSP. xpsr (Special-purpose program status registers) is a combination of the following three processor status registers: Application PSR Interrupt PSR Execution PSR N Negative or less than flag (1 = result negative) Z Zero flag (1 = result 0) C Carry or borrow flag (1 = Carry true or borrow false) V Overflow flag (1 = overflow) Q Q Sticky saturation flag T Thumb state bit IT If-Then bits ISR ISR Number ( 6 bits ) System: Base priority mask register (BASEPRI) defines the minimum priority for exception processing. Priority mask register (PRIMASK) is used to disable all interrupts excluding hard faults and non-maskable interrupts (NMI). If an interrupt is masked, this interrupt is ignored (i.e. disabled) by the processor. Control register (CONTROL) sets the choice of main stack or process stack, and the choice of privileged or unprivileged mode. Fault mask register (FAULTMASK) is used to disable all interrupts excluding non-maskable interrupts (NMI). 4

Peripheral Registers From the menu: Peripherals System Viewer, we can view and update the control and data registers of all available peripherals. The following figures show all registers for GPIO Port A, such as mode register (MODER), output type register (OTYPER), Output Speed Register (OSPEEDER), Input Data Register (IDR) and Output Data Register (ODR). This provides great conveniences for debugging. 5

Logic Analyzer The Logic Analyzer can display the history values (trace) of static or global variables over runtime. Local variables cannot be displayed. The value stored in a register cannot be analyzed. In the following program, we use logic analyzer to monitor a variable output defined in the data area. EXPORT output AREA mydata, DATA ALIGN output DCD 0x000 In the Logic Analyzer, you can click Setup and add a variable (signed int)output to observe. Make sure to adjust the data display range to show the curve. Logic analyzer can only monitor global variable. Thus you need to add "EXPORT output" to make the output as a global variable. The following is an example output of a sine wave function. 6