Giter VIP home page Giter VIP logo

pulp-debug-bridge's Introduction

Pulp debug bridge

This is a tool which can be used to interact with a pulp target, like doing read and write or loading a binary. It also provide an RSP server so that it can be used to interface GDB with pulp targets.

Getting the sources

You can get the sources with this command:

$ git clone https://github.com/pulp-platform/pulp-debug-bridge.git

Prerequisites

In case the FTDI cables are needed, the libftdi must be installed. Here is the command on Ubuntu to install it:

$ sudo apt-get install libftdi1-dev

Once the FTDI lib is installed, USB access rights must be updated. Most of the time a rule like the following must be added under /etc/udev/rules.d/, for example in /etc/udev/rules.d/10-ftdi.rules:

    ATTR{idVendor}=="15ba", ATTR{idProduct}=="002b", MODE="0666", GROUP="dialout"

The following command can be used to restart udev after the rule has been added:

    sudo udevadm control --reload-rules && sudo udevadm trigger

The user should also need to be in the dialout group.

The following python package is also needed:

$ sudo pip3 install pyelftools

Installation

To build this tool, you have to clone the following repository:

$ git clone [email protected]:pulp-platform/pulp-builder.git --recursive

Then go inside pulp-builder and execute the following command:

$ ./scripts/build-debug-bridge

This will checkout all sources inluding other modules needed by the bridge, build everything and install that under the install directory.

All what is needed to use the tool is then inside the directory install. You can define the following paths in order to use it:

export PATH=$PWD/install/ws/bin:$PATH
export PYTHONPATH=$PWD/install/ws/python:$PYTHONPATH
export LD_LIBRARY_PATH=$PWD/install/ws/lib:$LD_LIBRARY_PATH
export PULP_CONFIGS_PATH=$PWD/install/ws/configs

Usage

You can execute the following to display the help:

$ plpbridge --help

You need at least to configure the cable and the target with these options:

# plpbridge --chip=pulpissimo --cable=ftdi

You can for example read from the target with this command:

# plpbridge --chip=pulpissimo --cable=ftdi read --addr=0x1c000000 --size=32

Or write:

# plpbridge --chip=pulpissimo --cable=ftdi write --addr=0x1c000000 --size=32 --value=0x12345678

A binary can also be loaded with this command:

# plpbridge --chip=pulpissimo --cable=ftdi load --binary=<binary path>

The RSP server for the GDB connection can be started with this command:

# plpbridge --chip=pulpissimo --cable=ftdi gdb wait --rsp-port=1234

Supported cables

2 FTDI cables are supported: --cable=ftdi@olimex and --cable=ftdi@digilent. However the bridge may need few modifications depending on the ftdi chip which is used.

It is also possible to connect the bridge to a remote server, like an RTL platform (using a DPI model): --cable=jtag-proxy. More information for this cable will be provided soon.

Supported targets

Only pulp and pulpissimo are supported for now.

Customizing existing targets

The bridge is getting architecture information about the selected chip using a JSON description of the architecture. Such descriptions can be found under install/configs/systems (once the bridge is built). For example if the selected chip is pulpissimo, the bridge will get the description from install/configs/systems/pulpissimo.json. These configs comes from the pulp-configs module which is downloaded as a dependency and are found by the bridge using the environment variable PULP_CONFIGS_PATH.

The configs contains a lot of hardware details and are generated from high-level descriptions that can be found under install/configs/templates/chips. The idea is that this high-level config describes the most important architecture properties, which are then used by generator scripts to generate the final detailed description.

If the targetted architecture is slightly different from an existing one, it is possible to take one of these templates and customize it to reflect the differences, and then use the generated configuration to configure the bridge.

For that first copy and modify an existing template:

$ cp install/configs/templates/chips/pulpissimo.json my_template.json

The memory map can for example be modified and will be taken into account by the generators. Then generate the configuration from your template:

$  pulp_config_gen --template=$PWD/my_template.json --output=my_config.json

Then instead of specifying a chip, you can specify your configuration on the bridge command-line like this:

$ plpbridge --config=my_config.json --cable=ftdi load --binary=<binary path>

pulp-debug-bridge's People

Contributors

haugoug avatar micprog avatar noebrun avatar yaooooo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

pulp-debug-bridge's Issues

GDB failed with gdb

I have build a fpga project for pulpissimo with altera fpga a10. Now i can access the inter memory of pulpissimo with pulp debug bridge successfully. But when i connected gdb(riscv32-unknown-elf-gdb), i got the following error message. What should i do? Thank you.

Found ftdi device i:0x403:0x6010:0
Connecting to ftdi device i:0x403:0x6010:0
RSP server opened on port 1234
RSP: Client connected!
RSP: Error receiving
RSP: Error receiving

Undefined symbols when ran

After compiling (make all) and running (install/bin directory) the latest version (fresh clone), I get a stack trace:

$ PATH=/home/lstrz/Desktop/pulp-debug-bridge/install/bin:$PATH PYTHONPATH=/home/lstrz/Desktop/pulp-debug-bridge/install/python:$PYTHONPATH LD_LIBRARY_PATH=/home/lstrz/Desktop/pulp-debug-bridge/install/lib:$LD_LIBRARY_PATH ./plpbridge --chip=pulpissimo --cable=ftdi read --addr=0x1c000000 --size=32
Traceback (most recent call last):
File "./plpbridge", line 268, in
bridge = db.get_bridge(config=config, verbose=args.verbose, binaries=args.binaries)
File "/home/lstrz/Desktop/pulp-debug-bridge/install/python/bridge/debug_bridge.py", line 37, in get_bridge
return bridge_class(config=config, binaries=binaries, verbose=verbose)
File "/home/lstrz/Desktop/pulp-debug-bridge/install/python/bridge/default_debug_bridge.py", line 114, in init
self.module = ctypes.CDLL(lib_path)
File "/usr/lib/python3.5/ctypes/init.py", line 347, in init
self._handle = _dlopen(self._name, mode)
OSError: /home/luka/Desktop/pulp-debug-bridge/install/lib/libpulpdebugbridge.so: undefined symbol: _ZN2js25import_config_from_stringENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE

Am I doing something wrong?

Adaptable to PULPino?

Hi,

I'm currently working with a PULPino core on an FPGA board and I'm trying to connect to the core with JTAG. Unfortunately I can't seem to find a way to do it with OpenOCD and the PULPino repo only provides an SPI loader.
Do you think I could adapt the pulp-debug-bridge for PULPino? The memory map seems quite different but the debug interface looks similar.
If not, do you have a suggestion on how I could connect to the PULPino core with JTAG?

Thank you

How to use the debug-bridge based on dpi-models?

According to the Section:supported-cables(https://github.com/pulp-platform/pulp-debug-bridge#supported-cables), can connect the bridge to the RTL platform (using a DPI model): --cable=jtag-proxy. I have compiled the dpi-models(https://github.com/pulp-platform/dpi-models), get the some libraries:jtag_proxy.so libjson.a libpulpdebugbridge.so libpulpdpi.so libpulpperiph.so spim_tb.so uart.so in the pulp-sdk installation directory, and then set the sdkLib variable as set sdkLib -sv_lib $::env(PULP_SDK_HOME)/install/ws/lib/libpulpdpi $::env(PULP_SDK_HOME)/install/ws/lib/libpulpperiph in vsim.tcl file under the <pulpissimo project>/sim/tcl_files/config directory to load the libraries. I got the following error when run the hello world app by the command make clean all run

# //  Questa Sim-64
# //  Version 10.4c linux_x86_64 Jul 19 2015
# //
# //  Copyright 1991-2015 Mentor Graphics Corporation
# //  All Rights Reserved.
# //
# //  THIS WORK CONTAINS TRADE SECRET AND PROPRIETARY INFORMATION
# //  WHICH IS THE PROPERTY OF MENTOR GRAPHICS CORPORATION OR ITS
# //  LICENSORS AND IS SUBJECT TO LICENSE TERMS.
# //  THIS DOCUMENT CONTAINS TRADE SECRETS AND COMMERCIAL OR FINANCIAL
# //  INFORMATION THAT ARE PRIVILEGED, CONFIDENTIAL, AND EXEMPT FROM
# //  DISCLOSURE UNDER THE FREEDOM OF INFORMATION ACT, 5 U.S.C. SECTION 552.
# //  FURTHERMORE, THIS INFORMATION IS PROHIBITED FROM DISCLOSURE UNDER
# //  THE TRADE SECRETS ACT, 18 U.S.C. SECTION 1905.
# //
# source /home/chenx/build/pulpissimo/sim/tcl_files/config/run_and_exit.tcl
# source /home/chenx/build/pulpissimo/sim/tcl_files/run.tcl
# vsim -c -quiet vopt_tb -L models_lib -L vip_lib -t ps "+nowarnTRAN" "+nowarnTSCALE" "+nowarnTFMPC" "+TB_PATH=/home/chenx/build/pulpissimo/sim" "+UVM_NO_RELNOTES" -permit_unmatched_virtual_intf -sv_lib /home/chenx/build/pulpissimo/pulp-sdk/pkg/sdk/dev/install/ws/lib/libpulpdpi /home/chenx/build/pulpissimo/pulp-sdk/pkg/sdk/dev/install/ws/lib/libpulpperiph "+VSIM_PATH=/home/chenx/build/pulpissimo/sim" -voptargs="+acc=mnprv -assertdebug -bitscalars -fsmdebug -linedebug" -gUSE_SDVT_SPI=0 -gUSE_SDVT_CPI=0 -gENABLE_DEV_DPI=0 -gLOAD_L2=JTAG -gUSE_SDVT_I2S=0 
# Start time: 14:45:05 on Nov 28,2018
# ** Error: (vsim-3170) Could not find '/home/chenx/build/pulpissimo/sim/modelsim_libs/tb_lib./home/chenx/build/pulpissimo/pulp-sdk/pkg/sdk/dev/install/ws/lib/libpulpperiph'.
# Error loading design
# End time: 14:45:05 on Nov 28,2018, Elapsed time: 0:00:00
# Errors: 1, Warnings: 0
# Coverage command may be used in loaded simulation and in viewcov mode only.
# 

Have any document about how to use dpi models to connect the RTL platform through jtag-proxy cable? @fabianschuiki

Trouble using FTDI debug adapter with the debug bridge

Hi,

I am trying to connect to a Pulpissimo target using the pulp debug bridge and Olimex ARM-USB-OCD-HL and I am getting segfaults. I am attaching sreenshots with gdb backtraces (my system in Ubuntu 20.04.04). Can you please help?
Screenshot from 2022-08-16 15-40-14
Screenshot from 2022-08-16 15-41-01
Screenshot from 2022-08-16 15-41-09

hal_bridge_req_t undeclared

make all gives a bunch of error: β€˜hal_bridge_req_t’ has not been declared. I tried browsing around the code to find where is it declared, but to no avail. What am I doing wrong?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.