Giter Site home page Giter Site logo

u2654 / riscv-gprof Goto Github PK

View Code? Open in Web Editor NEW

This project forked from sbzpro/riscv-gprof

0.0 1.0 0.0 30 KB

using gprof with RISC-V embedded 32 bit systems bare-metal . It can be modified to support 64 bit as well

License: Other

Assembly 3.00% C 90.42% Makefile 6.59%

riscv-gprof's Introduction

Download Toolchain:

https://github.com/xpack-dev-tools/riscv-none-embed-gcc-xpack/releases/download/v8.3.0-1.1/xpack-riscv-none-embed-gcc-8.3.0-1.1-linux-x64.tgz

Download openocd:

https://github.com/xpack-dev-tools/openocd-xpack/releases/download/v0.10.0-13/xpack-openocd-0.10.0-13-linux-x64.tgz

Download the source:

git clone https://github.com/sbzpro/riscv-gprof.git
cd riscv-gprof

Add openocd

export PATH=<PATH/TO/OPENOCD>/bin:${PATH}

Run openocd and wait for connection

cd build && openocd -f ../config/openocd.cfg

Add toolchain to PATH and Compile:

open new terminal <ctrl>+<shift>+t; In new terminal type the following
export PATH=<PATH/TO/TOOLCHAIN>/bin:${PATH}
cd build && make 

Run GDB and connect to target:

$> riscv-none-embed-gdb riscv-gprof.elf	
		$ target extended-remote localhost:3333
		$ load riscv-gprof.elf
		$ c <ENTER>

If everything goes correct a message "done" is printed in openocd console.

Exit GDB and run cross gprof

riscv-none-embed-gprof riscv-gprof.elf gmon.out >> analysis.txt

Adding Your code to profile:

Code that needs to be instrumented should be present in  <PATH/TO>/riscv-gprof/src/ folder
Funtions needs to be instrumented should be prepended with "PROFILE" macro
prepend function with NO_INSTRUMENT macro to avoid instrumenting
if new file is added to <PATH/TO>/riscv-gprof/src/ folder edit <PATH/TO>/riscv-gprof/build/src/subdir.mk and 
add newly added filename for compilation.

riscv-gprof's People

Contributors

sbzpro avatar

Watchers

James Cloos avatar

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.