Git Product home page Git Product logo

riscv-fesvr's People

Stargazers

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

Watchers

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

riscv-fesvr's Issues

Cannot build fesvr due to std::runtime_error

I am using arm-xilinx-linux-gnueabi-g++ version(4.7.2)
I got the error:
riscv-fesvr/fesvr/htif.cc: In member function 'virtual void htif_t::load_program()':
riscv-fesvr/fesvr/htif.cc:108:11: error: 'runtime_error' is not a member of 'std'
Makefile:310: recipe for target 'htif.o' failed

Debug: reduce need for program buffer words

Currently the way FESVR uses the program buffer to load programs and write CSRs, it needs a lot of words of program buffer and doesn't consider implicit ebreak. (It doesn't handle the case if an implementation uses abstract commands instead of program buffer, but that's of a lesser concern). OpenOCD can do it with 2 words of program buffer + implicit ebreak, or 3 words of program buffer, fesvr should be able to do the same.

Building on OS X fails

Have macOS Sierra 10.12.1 official. On priv-1.9 branch of riscv-tools
Getting this error:

../fesvr/tsi.cc:34:7: error: use of undeclared identifier 'abort'
      abort();
      ^

Output for gcc -v:

Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/usr/include/c++/4.2.1
Apple LLVM version 8.0.0 (clang-800.0.38)
Target: x86_64-apple-darwin16.1.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

openbsd: gmake: ../scripts/vcs-version.sh: Command not found

When compiling riscv-fesvr on OpenBSD 6.4

ob1$ gmake
gmake: ../scripts/vcs-version.sh: Command not found
c++ -fPIC -MMD -MP -Wall -O2 -std=c++11 -DPREFIX="/tmp/riscv" -I. -I../fesvr -c ../fesvr/elfloader.cc
c++ -fPIC -MMD -MP -Wall -O2 -std=c++11 -DPREFIX="/tmp/riscv" -I. -I../fesvr -c ../fesvr/htif.cc
c++ -fPIC -MMD -MP -Wall -O2 -std=c++11 -DPREFIX="/tmp/riscv" -I. -I../fesvr -c ../fesvr/memif.cc
^Cgmake: *** [Makefile:310: memif.o] Interrupt

ob1$ head ../scripts/vcs-version.sh
#!/bin/bash
#=========================================================================
# vcs-version.sh [options] [src-dir]
#=========================================================================
#
# -h Display this message
# -v Verbose mode
#
# This script will create a version string by querying a version control
# system. The string is appropriate for use in installations and
ob1$
`

Building with gcc 4.4 fails

Unfortunately the machine I'm on has a rather ancient version of GCC:

gcc (GCC) 4.4.7 20120313 (Red Hat 4.4.7-17)

One issue I stumbled across is that the --std=c++11 needs to be --std=c++0x in the config script.

After fixing that I then get the following compile error:

g++ -fPIC -MMD -MP -Wall -O2 -std=c++0x -DPREFIX="/projects/digital/work/rocket-chip/riscv-tools" -I. -I./fesvr -c ./fesvr/ht
./fesvr/htif.cc: In constructor ‘htif_t::htif_t(int, char**)’:
./fesvr/htif.cc:52: error: type ‘htif_t’ is not a direct base of ‘htif_t’
./fesvr/htif.cc:52: error: no matching function for call to ‘memif_t::memif_t()’
./fesvr/memif.h:17: note: candidates are: memif_t::memif_t(htif_t*)
./fesvr/memif.h:15: note: memif_t::memif_t(const memif_t&)
./fesvr/htif.cc:52: error: no matching function for call to ‘syscall_t::syscall_t()’
./fesvr/syscall.h:30: note: candidates are: syscall_t::syscall_t(htif_t*)
./fesvr/syscall.h:28: note: syscall_t::syscall_t(const syscall_t&)
./fesvr/htif.cc: In constructor ‘htif_t::htif_t(const std::vector<std::basic_string<char, std::char_traits, std::allocator >, std::a
./fesvr/htif.cc:58: error: type ‘htif_t’ is not a direct base of ‘htif_t’
./fesvr/htif.cc:58: error: no matching function for call to ‘memif_t::memif_t()’
./fesvr/memif.h:17: note: candidates are: memif_t::memif_t(htif_t*)
./fesvr/memif.h:15: note: memif_t::memif_t(const memif_t&)
./fesvr/htif.cc:58: error: no matching function for call to ‘syscall_t::syscall_t()’
./fesvr/syscall.h:30: note: candidates are: syscall_t::syscall_t(htif_t*)
./fesvr/syscall.h:28: note: syscall_t::syscall_t(const syscall_t&)
./fesvr/htif.cc: In destructor ‘virtual htif_t::~htif_t()’:
./fesvr/htif.cc:73: error: expected initializer before ‘:’ token
./fesvr/htif.cc:75: error: expected primary-expression before ‘}’ token
./fesvr/htif.cc:75: error: expected ‘;’ before ‘}’ token
./fesvr/htif.cc:75: error: expected primary-expression before ‘}’ token
./fesvr/htif.cc:75: error: expected ‘)’ before ‘}’ token
./fesvr/htif.cc:75: error: expected primary-expression before ‘}’ token
./fesvr/htif.cc:75: error: expected ‘;’ before ‘}’ token
./fesvr/htif.cc: In member function ‘virtual void htif_t::load_program()’:
./fesvr/htif.cc:98: error: ‘runtime_error’ is not a member of ‘std’
./fesvr/htif.cc: In member function ‘int htif_t::run()’:
./fesvr/htif.cc:158: error: expected primary-expression before ‘[’ token
./fesvr/htif.cc:158: error: expected primary-expression before ‘]’ token
./fesvr/htif.cc:158: error: expected primary-expression before ‘*’ token
./fesvr/htif.cc:158: error: ‘q’ was not declared in this scope
./fesvr/htif.cc:158: error: expected primary-expression before ‘x’
./fesvr/htif.cc:158: error: unable to deduce ‘auto’ from ‘’
./fesvr/htif.cc:158: error: expected ‘,’ or ‘;’ before ‘{’ token
./fesvr/htif.cc: In member function ‘void htif_t::parse_arguments(int, char**)’:
./fesvr/htif.cc:213: error: ‘invalid_argument’ is not a member of ‘std’
./fesvr/htif.cc:220: error: ‘invalid_argument’ is not a member of ‘std’
./fesvr/htif.cc:232: error: ‘invalid_argument’ is not a member of ‘std’
./fesvr/htif.cc:237: error: ‘nullptr’ was not declared in this scope
./fesvr/htif.cc:257: error: ‘invalid_argument’ is not a member of ‘std’
./fesvr/htif.cc:263: error: ‘invalid_argument’ is not a member of ‘std’
./fesvr/htif.cc:285: error: ‘invalid_argument’ is not a member of ‘std’
./fesvr/htif.cc: In member function ‘void htif_t::register_devices()’:
./fesvr/htif.cc:293: error: expected initializer before ‘:’ token
./fesvr/htif.cc:295: error: expected primary-expression before ‘}’ token
./fesvr/htif.cc:295: error: expected ‘;’ before ‘}’ token
./fesvr/htif.cc:295: error: expected primary-expression before ‘}’ token
./fesvr/htif.cc:295: error: expected ‘)’ before ‘}’ token
./fesvr/htif.cc:295: error: expected primary-expression before ‘}’ token
./fesvr/htif.cc:295: error: expected ‘;’ before ‘}’ token
make: *** [htif.o] Error 1`

Is this also related to gcc being old?

Support for non-compiled simulators

Non-compiled simulators such as Cadence Xcelium pass the entire argument list to fesvr, most of which can be ignored using the +permissive and +permissive-off options. Passing file name arguments, however, is not possible, although some simulators allow a filename to be hidden behind a -define argument. This trick doesn't work with Xcelium 'xrun'. I was able to define a new fesvr argument, +fesvr-arg=... as an alternative way to pass filenames, etc, to fesvr, so that all arguments begin wth +. Are other approaches suggested?

Command Line Option Cleanup, Remove Unsupported Options (e.g., remove `+disk`)

I'd like to get it so that both fesvr-zynq, pk/bbl, and the emulator fully enumerate what command line options are actually supported and the rough breakdown of how this works on the command line.

I'd additionally like to cause (presently) unsupported options to error out as this creates confusion without the proper feedback (e.g., ucb-bar/fpga-zynq#43). This would likely involve updates across rocket-chip (for emulator.cc) and in riscv-pk due to the way that the option parsing is split across all of these.

What of +disk, +rfb, +signature, and +chroot work currently?

User provided compile flags overridden by configure

I'm trying to debug spike and riscv-fesvr with GDB. spike by default is compiled with debug symbols (-g), which is good, but riscv-fesvr is not. On both, I also want to turn down optimization (-O0)to make tracing the code simpler. So I'm trying to figure out how to add these flags, but whatever I do is getting over-written down the line by the autoconf scripts.

I'm no expert in autotools, but I believe I should be able to do this to compile with debug symbols:

cd riscv-fesvr/build
../configure CXXFLAGS="-O0 -g"
etc...

You should also be able to pass them in via environment variables, or directly to make when you do the build (make CXXFLAGS="-O0 -g" build).

However, no matter what I do the Makefile ends up with this:

CFLAGS        += -Wall -O2
CXXFLAGS      += -Wall -O2 -std=c++11 -DPREFIX=\"$(prefix)\"

So this is going to override the -O0 level, since gcc takes the last -O it finds. (-g should stick around I guess?)

My guess is that this part of the Makefile comes from this in the configure.ac file:

#-------------------------------------------------------------------------
# Default compiler flags
#-------------------------------------------------------------------------

AC_SUBST([CFLAGS],  ["-Wall -O2"])
AC_SUBST([CXXFLAGS],["-Wall -O2 -std=c++11"])

Or possibly from the Makefile.am template. I'm having a hard time figuring out which file controls the ultimate output here.

Is there another way that autoconf/automake can be used to allow the user to supply these? The automake docs has this to say:

CPPFLAGS is the user variable (see User Variables), AM_CPPFLAGS is the Automake variable
...
Automake always uses two of these variables when compiling C sources files. When compiling an object file for the mumble target, the first variable will be mumble_CPPFLAGS if it is defined, or AM_CPPFLAGS otherwise. The second variable is always CPPFLAGS.
CPPFLAGS is a user variable, i.e., a variable that users are entitled to modify in order to compile the package. This variable, like many others, is documented at the end of the output of ‘configure --help’.
...
The reason ‘$(CPPFLAGS)’ appears after ‘$(AM_CPPFLAGS)’ or ‘$(mumble_CPPFLAGS)’ in the compile command is that users should always have the last say.

(emphasis mine)

Update fesvr to Debug V13

I'm mostly filing this issue so I can point out what would need to change for v13 of the spec. Will add some pointers to line numbers here.

error: expected unqualified-id before '(' token

Any idea what this is about?

/home/lukas/libreelec/build.LibreELEC-HiFive.riscv64-9.0-devel/riscv-fesvr-f683e01/fesvr/encoding.h:178:29: error: expected unqualified-id before '(' token
 #define write_csr(reg, val) ({ \
                             ^
/home/lukas/libreelec/build.LibreELEC-HiFive.riscv64-9.0-devel/riscv-fesvr-f683e01/fesvr/dtm.cc:393:17: note: in expansion of macro 'write_csr'
 uint64_t dtm_t::write_csr(unsigned which, uint64_t data)
                 ^~~~~~~~~

build log http://sprunge.us/LTBO

./build.LibreELEC-HiFive.riscv64-9.0-devel/toolchain/bin/riscv64-libreelec-linux-gnu-g++ --version
riscv64-libreelec-linux-gnu-g++-7.2.0 (GCC) 7.2.0
Copyright (C) 2017 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Clarify licensing between `LICENSE` and `COPYING`

There's both a LICENSE and COPYING file in riscv-fesvr and riscv-pk. Consolidating them into one file seems like it might make things clearer. They're both BSD 3-clause, they just have slightly different formatting and names.

device-tree-compiler not found

A clean clone of riscv-toolsfollowed by the use of the build-r32ima.sh script results in a failure of the form: device-tree-compiler not found while attempting to build riscv-fesvr.

dtm_t vs tsi_t: Multicore / multiple hart support missing for tsi_t

Rocketchip (@680f3b162047c1ac36390dcdf682815fc0b24ffe) configuration: DualCoreConfig (default, unmodified)

On spike -p2, a bare-metal program is executed by both harts simultaneously.

The rocket-chip emulator (Verilator) uses the dtm_t interface for emulation. Executing a bare-metal program all harts start again simultaneously.

The fpga-zynq (deprecated) and midas-zynq (active) projects depend upon the tsi_t interface for fpga tethering. Here, the same bare-metal program is only executed on hart 0. The other harts are disabled. Hence, the reset interrupt for the remaining harts is not sent!

Compile fails on macOS X 10.12 with clang

In file included from ../fesvr/tsi.cc:1:
../fesvr/tsi.h:39:10: warning: 'chunk_align' overrides a member function but is not marked 'override' [-Winconsistent-missing-override]
  size_t chunk_align() { return 4; }
         ^
../fesvr/htif.h:35:18: note: overridden virtual function is here
  virtual size_t chunk_align() = 0;
                 ^
In file included from ../fesvr/tsi.cc:1:
../fesvr/tsi.h:40:10: warning: 'chunk_max_size' overrides a member function but is not marked 'override' [-Winconsistent-missing-override]
  size_t chunk_max_size() { return 1024; }
         ^
../fesvr/htif.h:36:18: note: overridden virtual function is here
  virtual size_t chunk_max_size() = 0;
                 ^
../fesvr/tsi.cc:34:7: error: use of undeclared identifier 'abort'
      abort();
      ^
2 warnings and 1 error generated.
make: *** [tsi.o] Error 1

compiler failed on cygwin!

build output:

g++ -fPIC -MMD -MP -Wall -O2 -std=c++11 -DPREFIX="/opt/riscv" -I. -I../fesvr -c ../fesvr/elfloader.cc
../fesvr/elfloader.cc:1:0: warning: -fPIC ignored for target (all code is position independent)
// See LICENSE for license details.
^
In file included from ../fesvr/memif.h:37:0,
from ../fesvr/elfloader.cc:9:
../fesvr/packet.h:27:15: error: conflicting declaration ‘typedef reg_t addr_t’
typedef reg_t addr_t;
^

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// here is my gcc details:
$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/i686-pc-cygwin/5.3.0/lto-wrapper.exe
Target: i686-pc-cygwin
Configured with: /cygdrive/i/szsz/tmpp/gcc/gcc-5.3.0-5.i686/src/gcc-5.3.0/configure --srcdir=/cygdrive/i/szsz/tmpp/gcc/gcc-5.3.0-5.i686/src/gcc-5.3.0 --prefix=/usr --exec-prefix=/usr --localstatedir=/var --sysconfdir=/etc --docdir=/usr/share/doc/gcc --htmldir=/usr/share/doc/gcc/html -C --build=i686-pc-cygwin --host=i686-pc-cygwin --target=i686-pc-cygwin --without-libiconv-prefix --without-libintl-prefix --libexecdir=/usr/lib --enable-shared --enable-shared-libgcc --enable-static --enable-version-specific-runtime-libs --enable-bootstrap --enable-__cxa_atexit --with-dwarf2 --with-arch=i686 --with-tune=generic --disable-sjlj-exceptions --enable-languages=ada,c,c++,fortran,java,lto,objc,obj-c++ --enable-graphite --enable-threads=posix --enable-libatomic --enable-libcilkrts --enable-libgomp --enable-libitm --enable-libquadmath --enable-libquadmath-support --enable-libssp --enable-libada --enable-libjava --enable-libgcj-sublibs --disable-java-awt --disable-symvers --with-ecj-jar=/usr/share/java/ecj.jar --with-gnu-ld --with-gnu-as --with-cloog-include=/usr/include/cloog-isl --without-libiconv-prefix --without-libintl-prefix --with-system-zlib --enable-linker-build-id --with-default-libstdcxx-abi=gcc4-compatible
Thread model: posix
gcc version 5.3.0 (GCC)

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.