Angel. Debug Protocol. Open Access. Document number: ARM DUI 0052C Issued: Sept 1999 Copyright ARM Ltd. 1997-1999



Similar documents
Computer Networks. Chapter 5 Transport Protocols

Transport Layer Protocols

Computer Network. Interconnected collection of autonomous computers that are able to exchange information

ICOM : Computer Networks Chapter 6: The Transport Layer. By Dr Yi Qian Department of Electronic and Computer Engineering Fall 2006 UPRM

File Transfer And Access (FTP, TFTP, NFS) Chapter 25 By: Sang Oh Spencer Kam Atsuya Takagi

TCP Session Management (SesM) Protocol Specification

SUDT AccessPort TM Advanced Terminal / Monitor / Debugger Version 1.37 User Manual

Chapter 5. Transport layer protocols

Protocols and Architecture. Protocol Architecture.

Operating System Concepts. Operating System 資 訊 工 程 學 系 袁 賢 銘 老 師

Ethernet. Ethernet. Network Devices

Quectel Cellular Engine

Access Control: Firewalls (1)

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

Internet Packets. Forwarding Datagrams

Understanding TCP/IP. Introduction. What is an Architectural Model? APPENDIX

Solving complex performance problems in TCP/IP and SNA environments.

Modicon Modbus Protocol Reference Guide. PI MBUS 300 Rev. J

Guide to TCP/IP, Third Edition. Chapter 3: Data Link and Network Layer TCP/IP Protocols

Transport Layer. Chapter 3.4. Think about

Using over FleetBroadband

COMP 361 Computer Communications Networks. Fall Semester Midterm Examination

Kepware Technologies Optimizing KEPServerEX V5 Projects

Computer Networks. Data Link Layer

Data Link Layer Overview

Monitoring DoubleTake Availability

Objectives of Lecture. Network Architecture. Protocols. Contents

[Prof. Rupesh G Vaishnav] Page 1

Data Link Layer(1) Principal service: Transferring data from the network layer of the source machine to the one of the destination machine

Application Note 2. Using the TCPDIAL & TCPPERM Commands to Connect Two TransPort router Serial Interfaces Over TCP/IP.

CentreWare Internet Services Setup and User Guide. Version 2.0

Understanding IP Faxing (Fax over IP)

IP - The Internet Protocol

How To Design A Layered Network In A Computer Network

Application Protocols for TCP/IP Administration

Data Link Protocols. TCP/IP Suite and OSI Reference Model

Applied Data Communication Lecture 14

Software User Guide UG-461

Process Control and Automation using Modbus Protocol

Best practice for SwiftBroadband

Appendix B RCS11 Remote Communications

ACHILLES CERTIFICATION. SIS Module SLS 1508

SwiftBroadband and IP data connections

Agenda. Distributed System Structures. Why Distributed Systems? Motivation

TCP/IP Fundamentals. OSI Seven Layer Model & Seminar Outline

Internet Architecture and Philosophy

Overview. Securing TCP/IP. Introduction to TCP/IP (cont d) Introduction to TCP/IP

Module 15: Network Structures

Voice over IP. Demonstration 1: VoIP Protocols. Network Environment

Introduction To Computer Networking

Chapter 16: Distributed Operating Systems

ESSENTIALS. Understanding Ethernet Switches and Routers. April 2011 VOLUME 3 ISSUE 1 A TECHNICAL SUPPLEMENT TO CONTROL NETWORK

Networking Test 4 Study Guide

Modbus Protocol. PDF format version of the MODBUS Protocol. The original was found at:

Chapter 14: Distributed Operating Systems

Ring Local Area Network. Ring LANs

Security (II) ISO : Security Architecture of OSI Reference Model. Outline. Course Outline: Fundamental Topics. EE5723/EE4723 Spring 2012

Communications and Computer Networks

Chapter 2 - The TCP/IP and OSI Networking Models

ACCESS 9340 and 9360 Meter Ethernet Communications Card ETHER

Exam 1 Review Questions

How To Understand The Layered Architecture Of A Network

PART OF THE PICTURE: The TCP/IP Communications Architecture

Technical Support Bulletin Nr.18 Modbus Tips

ARM Thumb Microcontrollers. Application Note. Software ISO 7816 I/O Line Implementation. Features. Introduction

Improved Digital Media Delivery with Telestream HyperLaunch

Slide 1 Introduction cnds@napier 1 Lecture 6 (Network Layer)

Network Working Group Request for Comments: 840 April Official Protocols

MBP_MSTR: Modbus Plus Master 12

Dr Markus Hagenbuchner CSCI319. Distributed Systems

B-2 Analyzing TCP/IP Networks with Wireshark. Ray Tompkins Founder of Gearbit

Unix System Administration

ROM Monitor. Entering the ROM Monitor APPENDIX

Socket Programming in the Data Communications Laboratory

How do I get to

A Transport Protocol for Multimedia Wireless Sensor Networks

The Answer to the 14 Most Frequently Asked Modbus Questions

Computer Networks UDP and TCP

EMG Ethernet Modbus Gateway User Manual

Advanced Computer Networks Project 2: File Transfer Application

CA Data Protection. Content Provider Development Guide. Release 15.0

Understanding IP Faxing (Fax over IP)

TruePort Windows 2000/Server 2003/XP User Guide Chapter

Application Note: AN00121 Using XMOS TCP/IP Library for UDP-based Networking

1.Eastron SDM220Modbus Smart Meter Modbus Protocol Implementation V1.0

Lecture 15. IP address space managed by Internet Assigned Numbers Authority (IANA)

Remote Serial over IP Introduction on serial connections via IP/Ethernet

TOP Server DNP 3.0 Suite. Background & Best Practices

Debugging Network Communications. 1 Check the Network Cabling

Application Note. Windows 2000/XP TCP Tuning for High Bandwidth Networks. mguard smart mguard PCI mguard blade

DNP Master Ethernet Driver Help Kepware Technologies

Layered Architectures and Applications

The OSI model has seven layers. The principles that were applied to arrive at the seven layers can be briefly summarized as follows:

GlobalSCAPE DMZ Gateway, v1. User Guide

White Paper Abstract Disclaimer

enetworks TM IP Quality of Service B.1 Overview of IP Prioritization

CPS221 Lecture: Layered Network Architecture

Module 1. Introduction. Version 2 CSE IIT, Kharagpur

Host Fingerprinting and Firewalking With hping

A DNP3 Protocol Primer

Transcription:

Angel Debug Protocol Document number: ARM DUI 0052C Issued: Sept 1999 Copyright ARM Ltd. 1997-1999

Proprietary Notice Copyright 1997, 1998, 1999 ARM Ltd. ARM and the ARM Powered logo are trademarks of ARM Ltd. Neither the whole nor any part of the information cont ained in, or the product described in, this document ma y be adapted or reproduced in any material form except with the prior written permission of the copyright holder. The product described in this document is subject to continu ous developments and improvements. All particulars of t he product and its use contained in this document are given by ARM in good faith. However, all warranties implie d or expressed, including but not limited to implied warranties or mer chantability, or fitness for purpose, are excluded. This document is intended only to assist the reader i n the use of the product. ARM Ltd shall not be liable fo r any loss or damage arising from the use of any information in this document, or any error or omission in such informatio n, or any incorrect use of the product. This document may not be supplied to any third party, in any form electronic or otherwise, without prior per mission of ARM Ltd. Document Status The document's status is displayed in a banner at the bo ttom of each page. This describes the document's confident iality and its information status. Confidentiality status is: ARM Confidential Named Partner Confidential Partner Confidential Distributable to ARM staff and NDA signatories only Distributable to the above and to the staff of named partner companies only Distributable within ARM and to staff of all partner companies No restriction on distribution Change Log Issue Date By Change A March 1998 KTB/RI-C First release B May 1988 RI-C Amendments following initial review. C Sept 1999 RI-C Updated for ADP v1.1, clarified structure and content. Key Code and other program texts are set in a monospaced font. ii ARM DUI 0052C

Contents 1. Introduction 1-1 2. The Protocol Suite 2-1 2.1 Data Provider Level 2-1 2.2 Channel Level 2-9 2.3 Device Level 2-16 3. Protocol State Machines 3-1 3.1 Channel Level Protocol 3-7 3.2 Serial Data Link Level Protocol 3-10 4. Glossary 4-1 ARM DUI 0052C iii

Contents iv ARM DUI 0052C

1. Introduction 1 The, (ADP) was designed to provide a rbeliable connection between a debug target and a host debugger during a debbugging session. The protocol had to provide sufficient and flexible access to bthe target from the host, and be resilient. In addition, two constraints were placed onb the target end of the connection; the target could not be assumed to have a tibmer, and the software resident on the target was of limited size. Finally, it was bbeneficial if the high level operations which the protocol implemented were similar bto those of the previous RDP protocol, to facilitate the transition. The protocol does not address issues of routing, as theb data link layer is assumed to be implemented as a point-to-point link. ADP implements the basic operations in typical client sberver fashion, using a request response style typical of remote procedure call systemsb. Both sides can act as client or server, different data streams (channels) being used to bdistinguish these roles. The underlying layers implement packetization of requests ontbo identified channels, recovery from simple packet loss and a simple data link probtocol suitable for use over serial and parallel links. A data link layer suitable for use ovber TCP/IP networks is supported, using the UDP protocol and connection addrebsses. ARM DUI 0052C 1-1

Introduction 1-2 ARM DUI 0052C

2. The Protocol Suite 2 The basic unit of communication in Angel is a packet. Withbin each packet received or transmitted by Angel, there are at least three levels of pbrotocol. These are: Data Provider (higher level), Channel Layer and Device Layer (lower lbevel) The data provider protocol is an application-layer protocolb; the channel layer is the transport protocol and the device level is the data link lbayer. The protocol is deliberately assymetric; Figure 1, below, shows the host ebnd view, while Figure 2 shows the target view. ARM DUI 0052C 2-1

The Protocol Suite Host Debugger RDI v1 Interpreter (in Remote_A) Semihosting Support External Software Multiple Service Types Boot Protocol Angel Debug Protocol C Library Support Protocol Other Protocols (E.g. ARM 7T DCC) CI_TBOOT, CI_HBOOT CI_HADP, CI_TADP CI_CLIB CI_HTDCC, CI_TTDCC Multiple Logical Channels Channels Layer Protocol Multiplexed onto... Multiple Devices Device Layer Protocol(s) Figure 1: Overall protocol layering (host end) 2-2 ARM DUI 0052C

The Protocol Suite Debug Agent Implementation Standard C Library Implementation Multiple Service Types Boot Protocol Angel Debug Protocol C Library Support Protocol Other Protocols (E.g. ARM 7T DCC) CI_TBOOT, CI_HBOOT CI_HADP, CI_TADP CI_CLIB CI_HTDCC, CI_TTDCC Multiple Logical Channels Channels Layer Protocol Multiplexed onto... Device Layer Protocol(s) Multiple Devices Users Agents Host Debugger 3 rd Party Debugger User Software Figure 2: Overall protocol layering (target end) ARM DUI 0052A 2-3

The Protocol Suite 2.1 Data Provider Level The data provider level protocols are used by two differentb services, using different request and response formats conforming to a common baseb specification. Angel Debug Agents using ADP. Angel C semihosting support code using the C Library Support protocol. The differentiation of which protocol is being used depebnds upon the channel number, in the same way that an FTP and a Telnet connection can be sbet up simultaneously over a TCP/IP link. It is important to note that other agebnts, including for example other debug agents, may use different data provider protobcols over the same channel layer link. For both ADP and the C Library support protocol, the pacbket formats are based on the same structure with slight differences in the reason cobde. This structure is: reason code information describing host debug world; private to host target OS information to identify process/thread world, etc. (target defined) data in a format defined by the message reason code. Figures 3 and 4 below show these structures in detail: "/+732,8/7 /,91,8/7 #203,8/7 #203,8/7 /77+1/.+8+ 2,8/7 88/2.+2 Direction: 0 = HtoT 1 = TtoH Multi thread control Reserved, must be zero Channel ID Protocol Request Code Figure 3: ADP protocol packet definition 2-4 ARM DUI 0052C

The Protocol Suite "/+732,8/7 /,91,8/7 #203,8/7 #203,8/7 /77+1/.+8+ 2,8/7 88/2.+2 Direction: 0 = HtoT 1 = TtoH Reserved, must be zero Protocol Request Code Figure 4: C support library protocol packet definitioon 2.1.1 Reason code Note The reason code defines the operation being requested bof the recipient, usually the target, and allows responses to be checked against requestbs; the response code in the reply to a message will differ from the request only ibn that the Direction bit will be flipped. Bits 16-27 of this word contain the channel number of the bchannel over which this packet is travelling. This also applies to the subreason codes used in, eg. ADP_Inafo, and the ADP_Stopped reasons. The multi-thread bits are interpreted according to the bfollowing table: Bit # Name Description 30 DisableFIQ Disable FIQ whilst processing message. 29 DisableIRQ Disable IRQ whilst processing message. 28 DisablePreemption Disable O/S pre-emption whilst processing message. ARM DUI 0052A 2-5

The Protocol Suite These bits are used to control how the target system ebxecutes whilst processing messages. This allows for O/S specific host-based debug progbrams to interrogate system structures whilst ensuring that the access is batomic within the constraints imposed by the target O/S. They must be set to zero in bmessages sent from the target to the host. 2.1.2 Debug ID The debug ID is a field provided for the use of the hostb software; the target guarantees that for a given host request, the response to that requebst will have the same debug ID value as the request. For systems which have no need of this (for example, singleb threaded debuggers) it must be set to 0xFFFFFFFF. Messages originated by the targetb (eg. the boot message) also set this field to 0xFFFFFFFF. 2.1.3 OSInfo 1, OSInfo 2 These fields can be used by multi-threaded target operating systems, etc, to identify the thread or context information in which the call is bbeing made. Host originated messages, and target originated messages on singly-threadbed targets should set both of these values to 0xFFFFFFFF. 2.1.4 Flow control Each service has been allocated a request channel and a respbonse channel. A response packet must be received on the response channbel for every request sent on the request channel. Thus flow control is implemented by program control, rathber than explicit action of the channel layer below. 2.1.5 Byte ordering In both ADP and C Library Support Protocol, data is transmbitted little-endian. The byte format of other application data is defined by those applibcations. The transport protocol must deliver the data to the recbeiver in the order presented by the transmitter. 2.1.6 Startup and shutdown Startup of the link is defined by the boot protocol, whibch is outlined in the Boot Agent section. 2-6 ARM DUI 0052C

The Protocol Suite Targets should protect against receiving a new startup rebquest before a previous link has been closed down, unless the target specifically servibces multiple sessions for example, when debugging a multi-threaded target. 2.1.7 Reliability and error detection The high level protocols assume that, as a result of the acbtions of the channels protocol, the channel is error free. They make little allowanbce for recovery if this is not in fact the case. About the only instance of such allowanceb is the ADP_LinkCheck packet which is sent in response to parameter negotiatibon. 2.1.8 Predefined channel numbers The following channels have been predefined for the Angel dbebug agent. Each service has a full duplex channel assigned to it. There are two debubg channels because each end acts sometimes as an RPC server (carries out requestsb) and sometimes as client (makes requests). Name Channel # Description CI_HADP 1 ADP (debugger), host originated CI_TADP 2 ADP (debugger), target originated CI_HBOOT 3 Boot, host originated CI_TBOOT 4 Boot, target originated CI_TLOG 1 10 Target debug/logging Angel debugging channels 1 The TLOG channel is only used if the Angel ROM debugging method is set to logadp which tells Angel to send ROM debugging messages over ADP to the host; normal builds of Angel use panicblk, in which these messages are stored in a sm all area of host memory. ARM DUI 0052A 2-7

The Protocol Suite In addition, there are a number of other channels, shown bin the following table: Name Channel # Description CI_PRIVATE 0 Channel protocol control messages CI_CLIB 5 Semihosting C library support CI_HUDBG 6 User debug support, host originated CI_TUDBG 7 User debug support, target originated CI_HTDCC 8 Thumb debug comms channel, host originated CI_TTDCC 9 Thumb debug comms channel, target originated Predefined angel channels 2.1.9 Operations The operation (reason) codes are defined by the relevant cbomponent protocol (ADP, Boot, Clib). There is no danger of a valid C Library Support bpacket being mistaken for an ADP packet as they are sent down different channels. The bchannel identifiers are specified in the channels protocol. The top bit of the reason code is used to indicate whebther the message is a host to target message or a target to host message. Note that theb same basic reason code is used for each direction, but depending on the directibon, the packets may have differing data formats. Details of the requests, responses and error numbers canb be found in a separate document Messages (ARM DUI0053). 2-8 ARM DUI 0052C

The Protocol Suite 2.2 Channel Layer The channel level protocol is responsible for delivering bpackets from one end of the communications medium to the other along numbered chabnnels. Channels are conceptually equivalent to ports in the world of TCP/IP, although in the current implementation the mapping of port numbers to servicesb is statically defined. An ADP Channel is bidirectional. The interface above this layer is packet based; calls to theb layer present a data packet for transmission, with the guarantee that it will be delivebred, if at all, in the order presented and intact. Note that the channel layer only guarantees that packets arrive if it has specifically been asked to give this guarantee whenb the packet was passed to it. The interface below this layer is to a communications medbium, such as a serial line, which is capable of delivering packets to the destination bwithout additional addressing information; the channel layer considers that all communicbations are point-to-point. The medium is also expected to deliver packet contents ibn the order transmitted, and although the protocol is capable of packet reordering it bis very inefficient at doing so; the protocol basically expects packets to arrive in the obrder sent. 2.2.1 Data formats The channel level protocol is used to distinguish which bchannel a packet is destined for. It was also envisaged as the protocol which contained bthe information for packet sequencing. The current protocol header is 4 bytes longb. The bytes (in transmission order) are: Channel ID Host packet sequence number Target packet acknowledge number Flags byte ARM DUI 0052A 2-9

The Protocol Suite +22/,8/ 378#/5,8/ 443#/5,8/ +17,8/ +-/8.+8+ 2,8/7 Is Heartbeat Is Reliable Is Resend Figure 4: Channel packet data format 2.2.1.1 Channel ID 2.2.1.2 Sequence numbers The Channel ID is checked for validity very early on in rebceipt of the packet. It must be less than a predefined limit (the sender and receiver mubst agree on a specific subset of channel ID numbers and their meanings). The host and acknowledge sequence numbers are used to debtermine the relative state of progress between sender and receiver (eg. To debtermine whether the sender is ahead of the receiver, which would imply the receiver bneeds to request a resend). Sequence numbers are global (that is, they are not affectedb by the channel number) and not limited by the protocol window size. Both host and target sequence numbers start at zero on ibnitial boot or application initialise and are incremented by one until the byte tbhey are held in wraps around to zero again. At various times in the protocol the values arbe reset to zero. When viewed on a per-channel basis, however, the protocol isb a simple Stop-and- Wait protocol. That is, for any particular channel there can bonly be one outstanding packet. 2-10 ARM DUI 0052C

The Protocol Suite The sequence numbers are used as follows: When a packet is to be sent: 1 It is marked with the current values of the transmit and acknowledge sequence numbers. 2 If and only if the packet is a reliable data packet, the transmit packet sequence number is incremented by one and a reference bto the packet itself stored in the resend packet list. 3 The packet is written to the output device. When a packet is received: If the packet was considered bad by the device layer, a resend packet may be sent, requesting retransmission of the packet the rebceiver was expecting next (current Angels do not request a resend). The packet is thrown away and no further action is taken. A packet is bad if it has been incompletely received, if tbhe packet length is too short, if it fails the CRC, or if a packet framing errobr occurred. If the packet s flags indicate this is a resend request packet, the packet s acknowledge sequence number is taken to be the last packetb correctly received, and all stored packets after this are resent. If the packet s flags indicate this is a heartbeat packet, the packet sequence number from the packet is checked against the receiver s bidea of this value: - If the packet s value is lower (mod 255) than expected, then the packet s transmitter lost the last packet sent to it for that chanbnel. An acknowledge heartbeat is returned. - If the packet s value is higher than expected then the receiver has missed a packet on that channel and it should request a rebsend of the missing packet. The current packet is thrown away. - If the packet s value matches the expected value, a further check must be made: - If a data packet has already been received with this sequence number, an acknowledge heartbeat is returned; otherwise, a bresend message is sent for the expected sequence number the hbost sent a packet which has been lost. The current packet is thrown away and no further action isb taken. ARM DUI 0052A 2-11

The Protocol Suite If the packet s flags indicate this is not a reliable packet, then the packet is delivered and no further action is taken. The packet sequence number from the packet is recorded (for heartbeat checks, 2.11a only) and checked against the receiver s idea bof this value: - If the packet s value is lower than expected, then this packet is a duplicate of the last received packet on the same channel. bthe current packet is thrown away. - If the packet s value is higher than expected then the receiver has missed a packet and it requests a resend of the missing bpacket. The current packet is thrown away. - If the packet s value matches the expected value, the next expected sequence number is incremented, all stored packets with bsequence numbers lower (mod255) than the current packet s acknowledgbe sequence number are removed from the resend buffer, and tbhe packet is delivered to the appropriate service. Note It is suggested that a list of currently-unacknowledgaed packets is maintained, rather than one per channel. 2.2.1.3 Flags values The Flags byte is used to distinguish various packet typbes from each other. The three flag bits used are mutually exclusive; a resend request packebt cannot be reliable, and neither can a heartbeat. Thus there are four packet types bavailable: Resend Heartbeat Reliable data Unreliable data ( Datagram ). See the later descriptions of packet types for more infobrmation about these packets. 2.2.1.4 Flow control Flow control is not implemented in this layer. 2.2.1.5 Byte ordering Data is transmitted in little-endian format, although this bis effectively irrelevant as the only fields are single bytes. 2-12 ARM DUI 0052C

The Protocol Suite 2.2.1.6 Startup and shutdown Note On startup, code at each end of the link initializes the valbues used for the host sequence numbers to zero, and the expected frame number bto one (the sequence number is incremented before sending). The device drivebr is initialized and the state (of the target) set to BootAvailable. It should be noted that Angel sends a boot message aon startup, which is usually not received by the host. This means that during the boaot phase, a host cannot tell if the first packet it receives will be numbered one or two. aother problems, notably when restarting sessions, mean that a host should not starictly police packet sequence numbers on the ADP Boot channel, as there are occasiaons when packets must be accepted with sequence numbers which would normally be aconsidered invalid. 2.2.1.7 Reliability and error detection The channels protocol attempts to deliver packets with thbe reliable flag set in a reliable way. That is, it attempts to ensure that once theb packet is presented to the channel layer it does actually reach the destination withobut error. There are two mechanisms which are used to implement this: checking of the packet length (packets must be long enough to contain the 4 byte protocol header) checking packet sequence numbers against the expected range If the reliable flag is not set, the channel layer simply delivers packetsb to the data link layer for transfer; the application is responsible forb any error recovery actions. When the reliable flag is set, the transmitter must keep a copy of every pbacket sent with the flag sent (including it s sequence number); such bpackets may be freed when a packet is received from the opposite end of the link witbh an acknowledge sequence number which is higher (mod 255) than the saved packet nubmber. Resend requests use the packet store to resend lost packets. 2.2.1.8 Packet length Packets are formed in buffers which are either standard sizeb (256 byte) or long (often 7KB, but variable) length. For any particular request, the packetb sent is the length of the data in it, not the length of the buffer. Packets are nbever padded. Note When performing block data transfers (for example, the aadp_write request), larger buffers are used to reduce the overheads incurred ian packet transfer and subsequent processing. Note that use of large buffers is restraicted (by convention) in ADP 1.0 to the ADP_Write operation. ARM DUI 0052A 2-13

The Protocol Suite Note ADP1.1: ADP_Read, ADP_ReadExt, ADP_WriteExt, CL_Write and CL_Read may also use long packets. Maximum long packet lengths must be agreed between the sbender and receiver, so the target boot message contains both the standard and blong buffer sizes the host is assumed to be able to cope with anything the target can.b When using ADP and the C library, many requests or respobnses are in fact significantly less than 256 bytes; the most common lengtbh is around 32 bytes, inclusive of the packet headers. 2.2.1.9 Packet types: resend requests 2.2.1.10 Heartbeats A resend request packet contains no data; the acknowledge sbequence number received in a resend packet defines the start of the resbend sequence (as the last packet successfully received), and the end is defined as tbhe current packet. All packets within this range will be resent in order, from ebarliest to latest. The receiving system interprets the packets as normal and sends back acbknowledge packets as appropriate. A resend request is completed when the lastb packet has been sent. A resend request is initiated as described in sectionb 2.2.1.2. New packet sequence numbers are only allocated to packets whbich can be resent; the current sequence number is included in other packet tbypes, but only in order that receipt of these packet types can cause a resend requestb (of a previous, resendable packet). A resend request packet must not cause a resend requestb. The behavior of the system is currently undefined if a rbesend request is received which cannot be satisfied because the packet is not availabble. Care should be taken in the implementation of the packet store and the generatiobn of resend requests to ensure this does not happen. The suggested action is tbo detect the attempt and ignore the resend request. A heartbeat packet contains nothing, other than the sequebnce numbers, which is required by the protocol; its mere existence is what isb needed. Its purpose is to ensure that the target end of the link is still alive, even if no bother data transfer is occurring. Heartbeats are initiated by the host system, and merely breflected by the target (including a copy of the time stamp, see below). Heartbeats do not count inb the normal sequencing of packets (ie. the sending of a heartbeat packetb, while it does include host and opposite sequence numbers, does not imply thbe incrementing of those numbers). 2-14 ARM DUI 0052C

The Protocol Suite A time stamp, measured in centiseconds, is stored in lbittle-endian format in the Packet Data (see section 2.2.1) of the packet, which allows theb host to determine the current round trip delay. The absolute value of the timestamp is not useful, and targebts should not assume any interpretation of it other than it is a monotonically ibncreasing value. 2.2.1.11 Reliable data 2.2.1.12 Unreliable data A reliable data packet is remembered until acknowledged by bthe receipt of a reliable data packet from the opposite end of the link which has thbe next higher sequence number in its acknowledge sequence number field. Packets sent in this manner are recorded on the resendb list. A resend request examines the resend list to identify the packets which cban be resent, and resends them in order. Packets are removed from the resend list bwhen a packet is received from the target in response (ie. it has a sequence numbebr one (or more) higher). Note An unreliable data packet is a traditional datagram; it is upb to the application to determine whether the packet has been lost or corruptebd, and what to do if it has been. Few higher level services use this level of service. bthe channel layer still checks packets have not been corrupted in transit and delivers bthis information with what it got of the packet. While a bad packet indication may be received if a paacket is corrupted, there are occasions when this will not happen, even if a partiaal packet is received. No not rely on bad packet receipts. ARM DUI 0052A 2-15

The Protocol Suite 2.3 Boot agent Note The boot agent uses the channel layer reliable packet strebam, and must establish communication between the host and the target. This invoblves determining the device used for data transport, getting the host and target intbo sync and agreeing on the parameters (such as maximum message size) which will be usedb for the session. At the end of the session, the boot agent must returnb the system to a state where another session can be initiated. The boot agent only supports a few messages. All Angel sysbtems with host communications must provide the boot agent, even if theby do not have support for semihosting or debug agents. If at any point during the bootup sequence ADP messagesb are sent down the CI_HADP channel then they should be responded to with tbhe error status RDI_NotInitialised. An ADP_Booted or ADP_Reboot message should be accepted at any point, since it is possible for a catastrophe to occur (such as disconnebcting the host and target during a debug message) which requires that one or othebr end be reset. If a incompatible parameters from the defaults have baeen negotiated for a session, subsequent messages will not be received correctly. Tahis issue has not yet been resolved. 2.3.1 Target board powered up before the host After switching on the target and initialization is compbleted the target will send an ADP_Booted message. The debugger has not been started yet so thbis message will not be received. In a serial world this makes it importantb that any buffers on the host side are flushed during initialization of the debugger, anbd in an Ethernet world it makes it important that the target can cope with the mesbsage not being received. Eventually the debugger will be started up and will send an badp_reboot or ADP_Reset request 1. The target will respond to this with an ADP_Reboot or ADP_Reset acknowledge and will then reboot, finally sending an ADP_Reboot when it has done all it needs to do (very little in the case bof ADP_Reset, but completely rebooting in the case of ADP_Reboot). 1 Currently, Remote_A always sends ADP_Reset. Do not re ly on this behaviour. 2-16 ARM DUI 0052C

The Protocol Suite 2.3.2 The target board powered up after the host The debugger will send an ADP_Reboot or ADP_Reset request, but will receive no reply until the target is powered up. When the target ibs powered up then it will send an ADP_Booted message to the debugger. The debugger should accept bthis message even though it has received no ADP_Reboot or ADP_Reset acknowledge message from the target. ARM host debuggers will then proceed tbo reset the target (with ADP_Reset), prompting another ADP_Booted message prior to initiating the debug session. 2.3.3 Packet sequences: Session Startup Note For serial links, the initial baud rate must be set to 960b0, although it may be renegotiated to a higher (or lower) value by an initial ADP_ParameterNegotiate request. These packets are shaded gray in the startup sequbences 1 to 5, below. It is assumed in the protocol that the parameters being negobtiated are in response to user request, and are thus initiated by the host. It is not bcurrently possible for the target to initiate renegotiation of parameters. Some targets need a short pause (in the region of 1msa) between the host issuing the boot acknowledge packet and issuing the first packet oaf the debug session, to allow the target time to complete it s operations. Host Direction Target Channel < Boot message BOOT (wait) Parameter negotiate > BOOT < Parameter negotiate acknowledge BOOT Link check > BOOT < Link check acknowledge BOOT Reset > BOOT < Reset acknowledge BOOT < Boot message BOOT Boot acknowledge. > BOOT (Debug session) > DEBUG Sequence 1: Serial or serial/parallel startup sequenceo when target boots first ARM DUI 0052A 2-17

The Protocol Suite Host Direction Target Channel Parameter negotiate > BOOT < Parameter negotiate acknowledge BOOT Link check > BOOT < Link check acknowledge BOOT Reset > BOOT < Boot message BOOT Boot acknowledge > BOOT (Debug session) > DEBUG Sequence 2: Serial or serial/parallel startup sequenceo when host boots first Host Direction Target Channel Reset > BOOT < Boot message BOOT Boot acknowledge > BOOT (Debug session) > DEBUG Sequence 3: Ethernet startup sequence when host boots foirst 2.3.4 Packet sequences: Session Shutdown The session is terminated with an End request, which resublts in the session moving back to the can connect state, as shown below. Following theb End request, if the link parameters were changed, the link must be returned to thbe default state by sending another ADP_ParameterNegotiate request. Host Direction Target Channel End > DEBUG < End DEBUG 2-18 ARM DUI 0052C

The Protocol Suite Host Direction Target Channel Parameter negotiate > BOOT < Parameter negotiate acknowledge BOOT Link check > BOOT < Link check acknowledge BOOT Sequence 4: Shutdown sequence with Renegotiation Host Direction Target Channel End > DEBUG < End acknowledge DEBUG Sequence 5: Shutdown sequence without Renegotiation 2.3.5 Sequence Number Resetting There are a number of points in the sequences when packetb sequence and acknowledgement numbers must be reset and outstanding sbtored packets freed. This must happen: On initially booting, and before the target boot message, if any, has been sent. As part of the ADP_Reset action, after the acknowledge to the reset has been sent. As part of the ADP_LinkCheck action, after the ADP_LinkCheck acknowledge has been sent. ARM DUI 0052A 2-19