Application Note AN1205: Using P&E Micro Kinetis GDB Server
Document Data COPYRIGHT NOTICE Copyright 2012 Atollic AB. All rights reserved. No part of this document may be reproduced or distributed without the prior written consent of Atollic AB. TRADEMARK Atollic, Atollic TrueSTUDIO, Atollic TrueINSPECTOR, Atollic TrueVERIFIER, Atollic TrueANALYZER and Atollic TrueSTORE and the Atollic logotype are trademarks or registered trademarks owned by Atollic. ECLIPSE is a registered trademark of the Eclipse foundation. MISRA and "MISRA C" is a registered trademark of MISRA Ltd, held on behalf of the MISRA Consortium. All other product names are trademarks or registered trademarks of their respective owners. DISCLAIMER The information in this document is subject to change without notice and does not represent a commitment of Atollic AB. The information contained in this document is assumed to be accurate, but Atollic assumes no responsibility for any errors or omissions. In no event shall Atollic AB, its employees, its contractors, or the authors of this document be liable for any type of damage, losses, costs, charges, claims, demands, claim for lost profits, fees, or expenses of any nature or kind. DOCUMENT IDENTIFICATION ASW-AN1205 November 2012 REVISION First version November 2012 Atollic AB Science Park Gjuterigatan 7 SE- 553 18 Jönköping Sweden +46 (0) 36 19 60 50 E-mail: sales @atollic.com Web: www.atollic.com Atollic Inc 115 Route 46 Building F, Suite 1000 Mountain Lakes, NJ 07046-1668 USA +1 (973) 784 0047 (Voice) +1 (877) 218 9117 (Toll Free) +1 (973) 794 0075 (Fax) E-mail: sales.usa@atollic.com Web: www.atollic.com ii P a g e
Table of Contents Contents Introduction... 4 Intended Readers... 4 Installation... 5 Licensing... 5 GDB Server Preferences... 5 Using the GDB Server... 6 Configuring the Debugger... 6 Configuring the GDB Server... 6 Debugging... 7 Freescale board configuration... 9 Enter OpenSDA Bootloader Mode... 9 Downlaod OpenSDA Firmware... 10 Update the MSD Flash Programmer Application... 10 Install the DEBUG APP... 11 GDB Server File examples... 12 File server.ini... 12 File project.ini... 12 iii P a g e
Introduction INTRODUCTION This Application Note provides information on how to use the P&E Kinetis GDB Server made by P&E Microcomputer Systems Inc. with Atollic TrueSTUDIO. Atollic TrueSTUDIO, from version 3.3 and later, can use this GDB Server to debug Freescale Kinetis processor targets. The GDB Server can be used with the following hardware interfaces: OpenSDA Embedded Debug USB Multilink USB Multilink FX Embedded OSJTAG INTENDED READERS This document is primarily intended for software developers using the Freescale Kinetis devices in Atollic TrueSTUDIO projects. 4 P a g e
INSTALLATION The P&E Kinetis GDB Server can be installed when installing Atollic TrueSTUDIO. The latest P&E Kinetis GDB Server version from P&E Microcomputer Systems Inc. is available here http://www.pemicro.com/downloads/download_file.cfm?download_id=382 LICENSING When a debug session using the P&E Kinetis GDB Server is started with Atollic TrueSTUDIO the debug session uses a challenge/response protocol to license the GDB Server. So there is no need to have any other license of the GDB Server to make it work with Atollic TrueSTUDIO. Note! If the GDB Server is started manually outside Atollic TrueSTUDIO without any other command line parameters it will start in License Activation mode and ask for an Installation Code. GDB SERVER PREFERENCES Atollic TrueSTUDIO settings for the P&E Kinetis GDB Server can be changed in the Preferences dialog. Select the menu command Windows, Preferences to open the Preferences dialog. In the panel for PE Micro the server settings can be configured. Please verify that the Server location is correct. Figure 1 PE Micro Preferences 5 P a g e
USING THE GDB SERVER This section contains information on how to use the GDB Server. CONFIGURING THE DEBUGGER First time a debug session is started there are some configuration needed. The following dialog is displayed when starting a debug session first time. Figure 2 Debug Configurations, Debugger Panel When using P&E Micro USB Multilink probes or OpenSDA or Embedded OSJTAG probes make sure that P&E Micro is selected in the Debugger tab. The actual type of probe is selected in the GDB Server. Info: The port number shall always be set to 7224 when connecting to current version of GDB Server. The Startup Debug tab contains the GDB script that will be used when starting a Debug session. CONFIGURING THE GDB SERVER The P&E Kinetis GDB Server settings are configured through initialization files. 6 P a g e
The GDB Server needs to be configured for the hardware before starting a debug session first time. Use the Open Configuration GUI (GDB Server) button in the Debugger tab in the Debug Configuration dialog to open the GDB Server. It is important to make the following selections: 1. Select Start server on Startup 2. Select the Interface to be used. E.g. Select OpenSDA Embedded Debug USB Port when using Freescale Freedom board. 3. Press the Refresh button to update port information according to connected hardware interface and select correct Port. 4. Select Device name Figure 3 - GDB Server User Interface - Unlicensed Close the GDB Server GUI when configuration is ready. Two initialization files are created by the GDB Server in the project. One pe_micro_serversettings.ini and one pe_micro_projectsettings.ini Use the Open Configuration GUI (GDB Server) button if any setting needs to be changed. DEBUGGING When the GDB Server has been configured for the hardware the debug session can be started. This is done by pressing the Debug button in the Debugger tab in the Debug Configurations dialog. When starting the debugger the GDB Server will be started by TrueSTUDIO. 7 P a g e
Figure 4 - GDB Server User Interface - Licensed The default TrueSTUDIO GDB script for PE Micro GDB Server will load the program, set a breakpoint at main(), and make a continue. So if everything works fine the program shall startup and run startup code until execution stops at the first executable program line inside main(). The GDB Server also provides some log information. Investigate this if there are some problems. The GDB script can be changed by updating the information in the Startup Debug tab in the Debug Configuration dialog Figure 5 Debug Configurations, Starup Debug Panel 8 P a g e
FREESCALE BOARD CONFIGURATION This section provides information about how to configure the Freescale Freedom board so that it can be used with the P&E Kinetis GDB Server. There are some preparations needed on the board to make it work with the debugger. The Freescale Quick Start Guide for FRDM-KL25Z and the Freescale FRDM-KL25Z User s Manual are also good to read to get information about the Freedom board. ENTER OPENSDA BOOTLOADER MODE First the OpenSDA Bootloader Mode shall be started. This is done by: 1. Unplug the USB cable if attached 2. Press and hold the Reset button (SW1). 3. Plug in a USB cable (not included) between a USB host and the OpenSDA USB connector (labeled SDA ). 4. Release the Reset button. A removable drive should now be visible in the host file system with a volume label of BOOTLOADER. You are now in OpenSDA Bootloader mode. Figure 6 Freedom BOOTLOADER files While in OpenSDA Bootloader mode, double-click SDA_INFO.HTML in the BOOTLOADER drive. A web browser will open the OpenSDA homepage containing the name and version of the installed Application. This information can also be read as text directly from SDA_INFO.HTML. 9 P a g e
Figure 7 P&E Micro OpenSDA Web page DOWNLAOD OPENSDA FIRMWARE Download latest OpenSDA Firmware (MSD & Debug) from the P&E Micro webpage: http://www.pemicro.com/opensda/index.cfm 1. Start to download the firmware, (Firmware Apps.zip file) 2. Wait until the file, Pemicro_OpenSDA_Debug_MSD_Apps_2012_11_09.zip, is downloaded. 3. Unzip the files to a folder The zip-file contains a number of SDA files that can be downloaded to the Freedom board. Next sections contain information about how to update the Flash Programmer Application and how to download the DEBUG_APP. It is necessary to install the DEBUG_APP to the board when the PE Micro GDB Server shall be used. UPDATE THE MSD FLASH PROGRAMMER APPLICATION It is good to update the Flash Programmer Application to the latest version available. 1. Open the directory where the PEMicro OpenSDA Firmware has been unzipped. 2. Copy & paste or drag & drop the MSD Flash Programmer Application, MSD-FRDM- KL25Z_Pemicro_vXYZ.SDA, to the BOOTLOADER drive. 3. Unplug the USB cable and plug it in again. The new OpenSDA Application should now be running and a FRDM-KL25Z drive should be visible in the host file system. 10 P a g e
INSTALL THE DEBUG APP It is necessary to install the DEBUG_APP to the board when the PE Micro GDB Server shall be used. 1. Start the OpenSDA Bootloader Mode. Unplug the USB cable, Press reset button (SW1), plug in the USB cable and release reset button. 2. Open the directory where the PEMicro OpenSDA Firmware has been unzipped. 3. Copy & paste or drag & drop the DEBUG_APP, DEBUG_APP_Pemicro_vXYZ.SDA, to the BOOTLOADER drive. 4. Unplug the USB cable and plug it in again. The new OpenSDA Application should now be running and a FRDM-KL25Z drive should be visible in the host file system. 11 P a g e
GDB SERVER FILE EXAMPLES The following are examples of server.ini and project.ini files for PEMicro GDB Server when using a Freescale Freedom board, FRDM-KL25Z. The on-board OpenSDA Embedded Debug-USB Port and KL25Z128M4 device are used. FILE SERVER.INI The following is an example of the server.ini file used with PEMicro GDB Server [STARTUP] AUTO_START=1 LOCALHOST=1 FILE PROJECT.INI [STARTUP] AUTOCONNECT=0 INTERFACE_SELECTION=7 PORT=181 FREQ_FX=4 FREQ_OSJTAG=0 FREQ_NORMAL=0 FREQ_CYCLONE=3 FREQ_TRACELINK=3 FREQ_OPENSDA=0 RESET_DELAY=0 USE_CYCLONEPRO_RELAYS=1 CYCLONEPRO_POWEROFFONEXIT=1 SPECIFY_IP_ENABLED=0 MULTILINK_POWERUPDELAY=1000 MULTILINK_POWERDOWNDELAY=250 SPECIFY_IP=127.0.0.1 SPECIFY_NETWORKCARD_ENABLED=0 SPECIFY_NETWORKCARD=127.0.0.1 FORCE_MASS_ERASE=0 USE_SWD=1 TRACELINK_MAXBUFFERSIZE=1 ECLIPSE_SHOW_CONNECTION_ASSISTANT=1 CPUTARGETTYPENAME= CYCLONEPRO_CURRENTVOLTAGE=255 CYCLONEPRO_POWERDOWNDELAY=250 CYCLONEPRO_POWERUPDELAY=250 12 P a g e
IO_DELAY_CNT=0 FREQ_LIGHTNING=1 SHOWDIALOG=1 [PEDEBUG] CURRENTDEVICE=KL25Z128M4 ENABLE_FLASH_PROGRAMMING_DIALOG=1 [PORT] IP= [DEVICE] CHIPMODE=KL25Z128M4 [STARTUP12] SHOW_HSTEP_ASSEMBLY_DETAILS=0 13 P a g e