Debugging Linux Applications

To debug a Linux application in the SDSoC environment:

  1. Create a project, for example lab6_linux, targeted to thePlatformZC702and theSystem ConfigurationLinux. From the list of application templates, selectMatrix Multiplication and Addition.
    For details, see Creating a New Project.
  2. Observe that the functionsmmultandmaddare marked for hardware implementation in theHW functionstable of theSDx Project Settings.
  3. Build a project and generate executable, bitstream, and SD card boot image. For the Active build configuration, useDebug.
    For details, see Building a Design with Hardware Accelerators.
    Important:Building the executable can take 30 to 60 minutes depending on your machine. Instead of building the project you can save time and instead use the pre-built project. (To minimize disk usage in the SDSoC installation, the imported project might contain fewer files than a project you build, but it includes the files required to complete the tutorial.) To import a pre-built project: select File>Importand then select General>Existing Projects into Workspaceand click Next. Click Select archive fileand browse to find the lab6_linux.zipfile provided in the project files folder ( /SDx/2017.1/docs/labs/lab6_linux.zip). Click Open. Click Finish.
    Note:If the project is imported, its binary ELF file does not have the correct paths for source debugging. You would need to rebuild the ELF but you do not want to rebuild the programmable logic bitstream. In the Project Explorerexpand the lab6_linuxproject and double-click project.sdxto display the SDx Project Settings. In the Optionspanel, uncheck the Generate bitstreambox and leave the Generate SD card imagebox checked. Clean the project (right click on lab6_linuxand select Clean Project) and rebuild it (right click on lab6_linuxand select Build Project).
  4. Here we are using the SDSoC environment Terminal view invoked fromWindow>Show View>Otherand selectingTerminal>Terminal. Click theTerminaltab near the bottom of the Debug window and confirm the settings (Connection Type: Serial,Port: COM,Baud Rate: 115200 baud).
    For the COM port settings to be visible,the board must be powered up:
    • Power up the board without an SD card plugged in.
    • Click on the Terminal Settings icon, set the configuration and clickOK.
    • The terminal indicates it is connected. Click the red disconnect iconto disconnect the terminal from the board, and power off the board.
  5. Copy the contents of the generatedsd_carddirectory to an SD card, and plug the SD card into the ZC702 board.
  6. Ensure that the board is connected to your computer via an Ethernet cable. Power on the board. Click on the Terminal tab and click the green connection icon to connect the terminal to the board. The Linux boot log is displayed on the terminal. When you see the terminal prompt, set the IP address by enteringifconfig eth0 192.168.0.1. Your computer must be configured so the Ethernet adapter is on the same subnetwork as the ZC702 board. On a Windows host system, openControl Panel\Network and Internet\Network Connections, and double-click to open theLocal Connectionfor the Ethernet Adapter. In theNetworkingtab, selectInternet Protocol Version 4 (TCP/IPv4), and click on thePropertiesbutton. On theGeneraltab, selectUse the Following IP Addressand enter192.168.0.11. ClickOK.
    If your subnetwork already has a device at 192.168.0.11, you can choose another address, as long as it begins with 192.168.0.x.
  7. Back in the SDSoC environment in theTarget Connectionspanel, expandLinux TCF Agentand right-click onLinux Agent (default), then selectEdit.
  8. In the Target Connection Details dialog set up the IP address and port (1534).

    Setting up the Linux Agent (default)
  9. ClickOK.
  10. In the Project Explorer click on the ELF file to select it and click on theDebugicon in the toolbar (or use theDebugicon pull-down menu to selectDebug As>Launch on Hardware (SDSoC Debugger)) to go to the Debug perspective, and run or step through your code.
    Note:Your application output displays in the Console view instead of the Terminal view.