NADK Reflector Application Debug

Similar documents
ODP Reflector Application Debug

Building U-Boot in CodeWarrior ARMv8

Collecting Linux Trace without using CodeWarrior

Using an External GCC Toolchain with CodeWarrior for Power Architecture

AIOP Task Aware Debug

Processor Expert Software for i.mx Processors Version 1.0

Getting Started with Freescale MQX RTOS for Kinetis SDK and MDK-ARM Keil

DDR Validation Tool Getting Started Guide

FRDM-K64F Board Errata

TWR-LS1021A Getting Started

Configuring DDR in U-Boot using QCVS

MQX RTOS Release Notes for Kinetis SDK v1.2.0 for KL33Z64 for FRDM-KL43Z Freescale Freedom Development Platform

Getting Started with Freescale MQX RTOS for Kinetis SDK and Kinetis Design Studio IDE

MQX RTOS Release Notes for Kinetis SDK FRDM- KV10Z Freescale Freedom Development Platform

Getting Started with Freescale MQX RTOS for Kinetis SDK and ARM GCC

TWR-LS1021A Getting Started

Adding a run control interface into an existing CodeWarrior for MCU v10.x project

Collect Linux Hardware Trace for ARMv8 User Space and Kernel Space Applications

Kinetis SDK Freescale Freedom FRDM-KL03Z Platform User s Guide

How to setup pre-build steps in CodeWarrior for Microcontrollers v10.x

i.mx 6 Android JB 4.3_1.1.1 Patch Release Notes

CodeWarrior U-Boot Debugging

CodeWarrior Development Studio for StarCore DSP SC3900FP Architectures Quick Start for the Windows Edition

P1010RDB-PB Quick Start Guide

Freescale MQX USB Stack for TWR-K24F120M GA User s Guide

Working around ERR7026 according to application needs

CodeWarrior Development Studio for StarCore 3900FP DSP v SP3 Release Notes

CodeWarrior Development Studio for Power Architecture Processors Version 10.x Quick Start

Freedom FRDM-MC-LVBLDC Development Platform User s Guide

Load Position-Independent Code (PIC) on a Kinetis Platform Using the IAR EWARM Compiler

Kinetis SDK Release Notes for the TWR-K24F120M Tower System Module

for StarCore DSP Architectures Quick Start for the Windows Edition

CodeWarrior Development Studio Processor Expert RTOS Adapter User Guide

Getting Started with the MCU Flashloader

Installing Service Pack Updater Archive for CodeWarrior Tools (Windows and Linux) Quick Start

Getting Started with FreeRTOS BSP for i.mx 7Dual

CodeWarrior Development Studio for QorIQ LS series - ARM V8 ISA Hardware Board Getting Started Guide

Controller Continuum. for Microcontrollers V6.3. Quick Start

Configure QSPI Bus Width and Frequency in Pre-Boot Loader Stage on QorIQ LS Series Processors

TWR-KV10Z32 Sample Code Guide for CodeWarrior Board configuration, software, and development tools

i.mx 6 Yocto Project Patch Release Notes

for ColdFire Architectures V7.2 Quick Start

Component Development Environment Getting Started Guide

TWR-KV10Z32 Sample Code Guide for IAR Board configuration, software, and development tools

Kinetis SDK v Release Notes for KV5x Derivatives

Kinetis Bootloader v1.2.0 Release Notes

for Freescale MPC55xx/MPC56xx Microcontrollers V2.10 Quick Start

Freescale MKW40Z IEEE Software Quick Start Guide

i.mx 6Solo/6DualLite Product Lifetime Usage Estimates

Watt Saver Software Component (WSC)

Kinetis USB-KW41Z Wireless Protocol Sniffer Quick Start Guide

Intelligent Sensing Framework 2.1 for Kinetis Errata Sheet

CodeWarrior Development Studio for Advanced Packet Processing v10.3.1

General C Functions for the etpu Covers the MCF523x, MPC5500, MPC5600, MPC5700, MPX40 and all etpu-equipped Devices

Getting Started with MCUXpresso SDK CMSIS Packs

PMSM Field-Oriented Control Using MC56F84789 DSC With Encoders Demo Guide

PetaLinux SDK User Guide. Eclipse Plugin Guide

Getting Started with MQX RTOS for Kinetis SDK

MCUXpresso SDK USB Power Delivery

CodeWarrior Development Studio for etpu v10.x Quick Start SYSTEM REQUIREMENTS

Three-Phase Power Meter Hardware Design Reference Manual

Offline Flash Programmer for Kinetis K- and L-series MCUs

QCVS Hardware Device Tree Editor User Guide

Emulating Dual SPI Using FlexIO

CodeWarrior Development Studio for Freescale 68HC12/HCS12/HCS12X/XGATE Microcontrollers Quick Start SYSTEM REQUIREMENTS Hardware Operating System 200

Single Chip Module (SCM) Package-on- Package (PoP) Assembly Guide

HVP-KV10Z32 User s Guide

i.mx 7 Dual/Solo Product Lifetime Usage

Freescale Kinetis Software Development Kit Release Notes

CodeWarrior Development Studio

Kinetis Updater User's Guide

Component Development Environment Installation Guide

HVP-KV31F120M User s Guide

Kinetis SDK v Release Notes for the MK21DA5 and MKW24D5 Devices

OpenSDA on TWR-KW2x. User s Guide Rev 1.1

i.mxrt1050 Product Lifetime Usage Estimates

WPR1500-LDO MP Receiver V2.1 Reference Design User s Guide

i.mx 6ULL Product Usage Lifetime Estimates

Kinetis Bootloader to Update Multiple Devices in a Field Bus Network

Quick Start Guide for FRDM-KL05Z

QCVS Frame Distributor Wizard User Guide

AN5016. Trigonometry approximations. Document information

CodeWarrior Development Tools mwclearcase Plug-in User s Guide

PICO-i.MX6UL Development Platform for Android Things Quick Start Guide

i.mx 6UltraLite Product Usage Lifetime Estimates

Quick Start Guide for FRDM-FXS-MULTI-B

FX RFID READER SERIES Embedded SDK Sample Application

HVP-MC56F82748 User s Guide

Using DMA for Pulse Counting on S32K

How to use FlexMemory as D-Flash and EEPROM in KE1xF

Smart Plug Software Design Reference Manual

PCIe Certification Guide for i.mx 6Dual/6Quad and i.mx 6Solo/6DualLite

Kinetis Flash Tool User's Guide

Contents 2. Contents

Freescale MQX RTOS TWR-K64F120M Release Notes

Figure 1. Power Barrel Connector Requirements

CodeWarrior Kernel-Aware Debug API

Kinetis KE1xF512 MCUs

NOVPEK NetLeap User Guide

Model-Based Design Toolbox

Transcription:

Freescale Semiconductor Document Number: AN4940 Application Note Rev. 11.2, 01/2016 NADK Reflector Application Debug 1 Introduction The most popular user space application for SDK/NADK usage is the packet reflector reference application. For details about reflector, documentation starting point, and the working setup, see LS2085 SDK Quick Start Guide. Before starting the CodeWarrior software or debugging, make sure that the necessary networking and reflector setup is done. This document explains: How you can build a real hardware setup for running the reflector How you can import, download, run, and debug the reflector application from the CodeWarrior software How you can attach to a running reflector application and debug it using the CodeWarrior software Contents 1 Introduction...1 2 Get the NADK reflector source files... 2 3 Hardware setup...2 4 CodeWarrior Setup......4 2015 2016 Freescale Semiconductor, Inc.

Get the NADK reflector source files 2 Get the NADK reflector source files To get the NADK reflector source files, perform these steps: 1. Install the SDK.iso image on a 64-bit machine. a. mount -o loop <image>.iso dir_to_mount b. cd <dir_to_mount> c../install d. cd <install_dir> e../poky/scripts/host-prepare.sh f. source./poky/fsl-setup-poky -m <target>, where target can be ls2085ardb or ls2085a-simu (depends if you want to run on the real hw or simulator) 2. Build the NADK reflector with debug symbols (the reflector makefile should have ggdb in CFLAGS set). a. bitbake -c cleansstate nadk-static b. bitbake -c patch nadk-static c. Go to the directory build_ls2085ardb_release/tmp/work/ls2085ardb-fsl-linux/nadk-static/git-r0/git/usr and -g parameter to CFLAGS in Makefile.inc Figure 1. Enable debug symbols generation d. bitbake -c build -f nadk-static 3. Build the rest of images needed by the NADK reflector. a. bitbake fsl-image-kernelitb b. bitbake dpl-examples 3 Hardware setup The reflector application reflects back a packet received on same interface where the packets are originally received, and the source and destination MAC and IP addresses of the received packet are swapped. 3.1 Hardware setup using only one board In order to demonstrate the traffic reflected, you can use only single board with two ports connected back-to-back, as shown in the figure below. In this example figure, the copper ports 5 and 7 are connected. 2 Freescale Semiconductor, Inc.

Hardware setup Figure 2. 1 board with 2 ports connected back-to-back The port 7 plays the role of the Linux container and the port 5 plays the role of the NADK container. For using only one board setup, we need to have a custom dpl file and link the dpni.8 (NADK Container) to dpmac.5 (copper port), because all the copper ports are by default associated with DPMACS from Linux container. The default dpl-eth-aiop-nadk.0x2a_0x41.dts file needs to be updated as below and a new dtb file needs to be generated using the dtc file from SDK. //update the connection@3 and remove the connection@5 /* new connection for AIOP reflector*/ connection@3{ endpoint1 = "dpni@8"; endpoint2 = "dpmac@5"; }; /*connection@5{ endpoint1 = "dpni@1"; endpoint2 = "dpmac@5"; };*/ connection@6{ endpoint1 = "dpni@1"; endpoint2 = "dpmac@7"; }; //generate the new dtb file <sdk_path>/build_ls2085ardb_release/tmp/work/ls2085ardb-fsl-linux/linux-ls2-sdk/3.16-r0/git/ scripts/dtc/dtc -I dts -O dtb -o dpl_nadk_dpni.8_to_dpmac.5.dtb dpl-eth-aiop-nadk. 0x2A_0x41.dts Freescale Semiconductor, Inc. 3

After you obtain the U-Boot prompt on the board, need to make next commands. Bring up the board via tftp from U-Boot, or you can write the images to the flash using the flash programmer from CodeWarrior for ARMv8. You can use vbank0 (0x580000000) or vbank4 (0x584000000) depending on how the boards are configured and if you want to alter the actual bank or not. The commands below are given from vbank0 and to boot up the new images from vbank4. setenv filesize; setenv myaddr 0x584100000; tftp 0x80000000 <path to u-boot>; protect off $myaddr +$filesize; erase $myaddr +$filesize; cp.b 0x80000000 $myaddr $filesize; protect on $myaddr +$filesize setenv filesize; setenv myaddr 0x584000000; tftp 0x80000000 <path to pbl; protect off $myaddr +$filesize; erase $myaddr +$filesize; cp.b 0x80000000 $myaddr $filesize; protect on $myaddr +$filesize setenv filesize; setenv myaddr 0x584300000; tftp 0x80000000 <path to mc>; protect off $myaddr +$filesize; erase $myaddr +$filesize; cp.b 0x80000000 $myaddr $filesize; protect on $myaddr +$filesize setenv filesize; setenv myaddr 0x584700000; tftp 0x80000000 <path to dpl dtb>; protect off $myaddr +$filesize; erase $myaddr +$filesize; cp.b 0x80000000 $myaddr $filesize; protect on $myaddr +$filesize setenv filesize; setenv myaddr 0x584800000; tftp 0x80000000 <path to dpc dtb>; protect off $myaddr +$filesize; erase $myaddr +$filesize; cp.b 0x80000000 $myaddr $filesize; protect on $myaddr +$filesize qixis_reset altbank tftp a0000000 <path to kernel itb> bootm a0000000 Configure the interfaces and arp entries: root@ls2085ardb:~# ifconfig ni1 8.8.8.1 root@ls2085ardb:~# arp -s 8.8.8.10 000000000008 Configure the eth2 interface: root@ls2085ardb:~# ifconfig eth2 192.168.1.169 Start the reflector: root@ls2085ardb:~# cd /usr/nadk/nadk-static/bin/ root@ls2085ardb:~#./bind_dprc.sh root@ls2085ardb:~#./reflector g dprc.4 d 10 Issue a ping command, that stops after sending 10 ECHO_REQUEST packets: root@ls2085ardb:~# ping 8.8.8.10 -c 10 4 CodeWarrior Setup This topic explains: Import and start reflector application from CodeWarrior software Attach to a running reflector application and debug it using CodeWarrior software Debug capabilities 4 Freescale Semiconductor, Inc.

4.1 Import and start reflector application from CodeWarrior software After compiling the reflector application with debug information, you need to use the elf file containing the debug symbols in the CodeWarrior Software. This will generate the correct elf/dwarf symbolic needed for the CodeWarrior parser to make data to symbols and symbols to data. 1. Select File > Import > C/C++ > CodeWarrior Executable Importer. 2. Click Next. Select reflector elf from the NADK build location: <yocto_install_path>/build_ls2085ardb_release/tmp/work/ls2085ardb-fsl-linux/nadk-static/ git-r0/git/apps/reflector/reflector The CodeWarrior software automatically detects the elf type and configures the settings for a Linux Application debug flow. 3. Set the remote absolute path to reflector and the commands before to execute it. CodeWarrior Setup Figure 3. Set remote absolute path and commands 4. If required, you can set up directly the remote path of the reflector without downloading it. Select Skip download to target path. In this case, check to have the reflector from target obtained from the same yocto/rootfs build with the one imported in the CodeWarrior software. Freescale Semiconductor, Inc. 5

Figure 4. Skip download to target path 5. Set the gdbserver port used by ssh tunnel by selecting Debugger tab > Gdbserver Settings. Figure 5. Gdbserver Settings 6. The reflector also needs some specific arguments in order to start correctly. The arguments can be set up using the Arguments tab in the Debug Configurations dialog. You can see the LS2085 SDK_Quick_Start_Guide for information about the legal arguments for reflector application. 6 Freescale Semiconductor, Inc.

Figure 6. Arguments tab 7. Edit the host/ip name of the NADK board: a. Close the Debug Configurations dialog. b. Open Window > Show view > Other > Remote Systems. c. Right-click the ScpConnection, select Properties. d. In the Properties dialog, select Host. Enter the IP or host name of the target board in the Host name text box. Figure 7. ScpConnection Figure 8. ScpConnection Properties 8. To run the reflector, select Run > Debug Configurations > C/C++ Remote Application. Freescale Semiconductor, Inc. 7

9. Click the Debug button. A pop-up login window appears with user ID for Linux target simulator as root and blank password. 10. Click OK for logging in. Note that reflector can now run only as root and also the CodeWarrior software will warn you, if necessary, about the changed RSA key mapping for the root and the remote target Linux. For example, when you restart the simulator and the remote Linux generates a different RSA key. 11. The connection between the gdb and gdbserver will be established, the gdbserver will start the reflector and the bind script will run. You can view this in the remote shell console. Figure 9. Console view 12. Now you are in debug with the reflector and have full debug capabilities. See Attach to a running reflector application and debug it using CodeWarrior software. By default, the reflector will stop at the main() function, as per the Debugger tab settings: Figure 10. Debug view 13. Here are the key functions to debug: a. nadk_receive b. nadk_eth_recv Set up breakpoints in all these functions from the gdb command line to see how the new threads are spawned and what is executed by these function during a ping, as shown in the following figure. 8 Freescale Semiconductor, Inc.

Figure 11. Debugging of key functions 4.2 Attach to a running reflector application and debug it using CodeWarrior software 1. Import the reflector elf file as explained in Import and start reflector application from CodeWarrior software, but select from C/C++ Attach to Application in the Debug Configurations dialog. 2. Click the Debugger tab and select gdbserver from the Debugger drop-down list. 3. Click the Connection sub tab in the Debugger tab, set Type as TCP, specify the host IP of the Linux target and a port number for the gdbserver as below. 4. Start the gdbserver and the reflector application standalone on the Linux target as shown below and then just attach with the CodeWarrior software to the gdbserver and select any desired application (i.e.: reflector). Note that you must run the bind script manually. gdbserver --multi :1234 cd /usr/nadk/nadk-static/bin/./bind_dprc.sh./reflector -g dprc.4 5. Click Debug. The gdb client connects to the gdbserver, and can now attach to any application from Linux target, including the reflector, using the green button below. Freescale Semiconductor, Inc. 9

6. Click OK and you ll attach to the running reflector. At this moment, all debug capabilities will be enabled. The stack after attach are shown in the figure below: 7. For setting up breakpoints in global symbols (for example, main), you should load the reflector debug symbols using the file <path_to_reflector> command. 10 Freescale Semiconductor, Inc.

file <yocto_install_path>/build_ls2085ardb_release/tmp/work/ls2085ardb-fsl-linux/nadkstatic/git-r0/git/apps/reflector/reflector NOTE You can start manually the reflector via gdbserver on the Linux target as below and then just attach with the CodeWarrior software to the gdbserver/reflector. Note that you must run the bind script manually. This is basically the same solution presented in the first chapter where all steps are made by CodeWarrior (see Import and start reflector application from CodeWarrior software). cd /usr/nadk/nadk-static/bin./bind_dprc.sh gdbserver --multi :1234./reflector -g dprc.4 8. Click Debug. The CodeWarrior software attaches to reflector The debug halts at the entry_point. CodeWarrior Setup 9. For setting up breakpoints to global symbols (For example, main), you should load the reflector debug symbols using the file <path_to_reflector> command. file <yocto_install_path>/build_ls2085ardb_release/tmp/work/ls2085ardb-fsl-linux/nadkstatic/git-r0/git/apps/reflector/reflector Now you can put breakpoints from the gdb console (i.e.: b main). After the hitting the breakpoint from the main function the stack will look as below: 4.3 Debug capabilities Freescale Semiconductor, Inc. 11

GDB console Source path mapping resolved automatically Access to registers, memory both from GDB and CW views Run control per process, per thread OS Resources Breakpoints Full Remote Shell console Dynamic printf 4.3.1 GDB console GDB console (selected from right side). Here you can type any gdb command you want. In the gdb traces console you can see full trace details about what gdb client commands are runned on the host Linux. In the Remote Shell console you can see the remote commands (and outputs) which are executed by CW on the remote Linux target. In the gdb console you can type gdb command you want. 4.3.2 Source path mapping resolved automatically Source path mapping resolved automatically by the CodeWarrior software if you are running the CodeWarrior software on the same machine where the reflector was built. 12 Freescale Semiconductor, Inc.

not, the CW will ask you where the reflector source files are located. If 4.3.3 Access to registers, memory both from GDB and CW views Access to registers, memory both from GDB and CW views Freescale Semiconductor, Inc. 13

4.3.4 Run control per process, per thread Run control per process, per thread By default, the run-control is enabled per process, but you can enable it per thread if you want, using scheduler-locking option from gdb console. For example, you can put a breakpoint to the line 537 in reflector.c and run till there (some threads will be created) and after you can try the scheduler-locking to be set on. Using <info threads> and <thread id> you can switch between different threads to make run-control operations (stepi, step, next) operations per thread. 4.3.5 OS Resources 14 Freescale Semiconductor, Inc.

OS Resources: processes (PID), Threads (TID), Sockets, Shared-memory regions and so on. This can be enable from Window > Show view > Other > OS Resources 4.3.6 Breakpoints Breakpoints read/write from IDE or gdb console 4.3.7 Full Remote Shell console Freescale Semiconductor, Inc. 15

Full Remote Shell console. Enabled it from Window > Show view > Other Remote Shell 4.3.8 Dynamic printf Dynamic printf right click on the left panel side of a source code to see the menu below. A dynamic printf works like a breakpoint and when this will get hit will print a custom message very useful for debug. 16 Freescale Semiconductor, Inc.

Freescale Semiconductor, Inc. 17

How to Reach Us: Home Page: freescale.com Web Support: freescale.com/support Information in this document is provided solely to enable system and software implementers to use Freescale products. There are no express or implied copyright licenses granted hereunder to design or fabricate any integrated circuits based on the information in this document. Freescale reserves the right to make changes without further notice to any products herein. Freescale makes no warranty, representation, or guarantee regarding the suitability of its products for any particular purpose, nor does Freescale assume any liability arising out of the application or use of any product or circuit, and specifically disclaims any and all liability, including without limitation consequential or incidental damages. Typical parameters that may be provided in Freescale data sheets and/or specifications can and do vary in different applications, and actual performance may vary over time. All operating parameters, including typicals, must be validated for each customer application by customer's technical experts. Freescale does not convey any license under its patent rights nor the rights of others. Freescale sells products pursuant to standard terms and conditions of sale, which can be found at the following address: freescale.com/salestermsandconditions. Freescale, the Freescale logo, CodeWarrior, and QorIQ are trademarks of Freescale Semiconductor, Inc., Reg. U.S. Pat. & Tm. Off. ARM, Cortex, Cortex-A53, Cortex-A57, and TrustZone are registered trademarks of ARM Limited (or its subsidiaries) in the EU and/or elsewhere. All rights reserved. 2015-2016, Freescale Semiconductor, Inc. Document Number AN4940 Revision 11.2, 01/2016