RISCV TOOL chain - Spike and pk

972 views
Skip to first unread message

J Osmany

unread,
Nov 8, 2016, 2:46:01 AM11/8/16
to sw-...@groups.riscv.org

Hi


I managed to complete the installation of the RISCV toolchain from


https://github.com/riscv/riscv-tools.git

riscv-tools - RISC-V Tools (GNU Toolchain, ISA Simulator, Tests)


I used the following configuration:



export RISCV=/user/jdo.tmp2/risc-v/sw_tools_3_Nov_2016_riscv_original_gcc_4.9.3/riscv-tools/opt_riscv
  export GCC=/vl/edatools/intern/gcc/4.9.3/gcc/bin
  export GCCLIB=/vl/edatools/intern/gcc/4.9.3/gcc/lib64
  export PATH=$GCC:$GCCLIB:$PATH:$RISCV/bin
  export LD_LIBRARY_PATH=$GCCLIB:$LD_LIBRARY_PATH
  ./build.sh


(Tail end of my build.sh being ( i have not changed anything):


echo "Starting RISC-V Toolchain build process"

build_project riscv-fesvr --prefix=$RISCV
build_project riscv-isa-sim --prefix=$RISCV --with-fesvr=$RISCV
build_project riscv-gnu-toolchain --prefix=$RISCV --with-xlen="$with_xlen"
CC= CXX= build_project riscv-pk --prefix=$RISCV/riscv"$with_xlen"-unknown-elf --host=riscv"$with_xlen"-unknown-elf
build_project riscv-pk --prefix=$RISCV/riscv"$with_xlen"-unknown-elf --host=riscv"$with_xlen"-unknown-elf
build_project riscv-tests --prefix=$RISCV/riscv"$with_xlen"-unknown-elf

echo -e "\\nRISC-V Toolchain installation completed!"

)


WRT installation of pk, the message was


Configuring project riscv-pk
configure: WARNING: using cross tools not prefixed with host triplet
Building project riscv-pk
Installing project riscv-pk
mkdir //user/jdo.tmp2/risc-v/sw_tools_3_Nov_2016_riscv_original_gcc_4.9.3/riscv-tools/opt_riscv/riscv64-unknown-elf/include/riscv-pk
mkdir //user/jdo.tmp2/risc-v/sw_tools_3_Nov_2016_riscv_original_gcc_4.9.3/riscv-tools/opt_riscv/riscv64-unknown-elf/lib/riscv-pk



So i think pk has been installed successfully.


However, running the simple "Hello World" program


spike pk hello


The above just hangs with no output.


bash-4.1$ pwd
/user/jdo.tmp2/risc-v/sw_tools_3_Nov_2016_riscv_original_gcc_4.9.3
bash-4.1$ ll
total 368
drwxrwx---  3 jdo imgtec   4096 Nov  4 17:33 .
drwxrwx--- 15 jdo imgtec   4096 Nov  7 07:45 ..
-rwxrwx---  1 jdo imgtec 182928 Nov  4 17:31 hello
-rw-rw----  1 jdo imgtec     80 Nov  4 17:25 hello.c
-rw-rw----  1 jdo imgtec 147260 Nov  4 17:37 objdump.log
-rw-rw----  1 jdo imgtec  17590 Nov  4 17:32 readelf.log
drwxr-x--- 11 jdo imgtec   4096 Nov  7 07:46 riscv-tools
bash-4.1$ which spike
/user/jdo.tmp2/risc-v/sw_tools_3_Nov_2016_riscv_original_gcc_4.9.3/riscv-tools/opt_riscv/bin/spike
bash-4.1$ which pk
/user/jdo.tmp2/risc-v/sw_tools_3_Nov_2016_riscv_original_gcc_4.9.3/riscv-tools/opt_riscv/riscv64-unknown-elf/bin/pk
bash-4.1$ spike -h
usage: spike [host options] <target program> [target options]
Host Options:
  -p<n>              Simulate <n> processors [default 1]
  -m<n>              Provide <n> MiB of target memory [default 4096]
  -d                 Interactive debug mode
  -g                 Track histogram of PCs
  -l                 Generate a log of execution
  -h                 Print this help message
  --isa=<name>       RISC-V ISA string [default RV64IMAFDC]
  --ic=<S>:<W>:<B>   Instantiate a cache model with S sets,
  --dc=<S>:<W>:<B>     W ways, and B-byte blocks (with S and
  --l2=<S>:<W>:<B>     B both powers of 2).
  --extension=<name> Specify RoCC Extension
  --extlib=<name>    Shared library to load
bash-4.1$ pk -h
bash: /user/jdo.tmp2/risc-v/sw_tools_3_Nov_2016_riscv_original_gcc_4.9.3/riscv-tools/opt_riscv//riscv64-unknown-elf/bin/pk: cannot execute binary file


Looks like pk was not built correctly.


I did a search in the goggle RISCV SW-DEV group wrt spike and pk but could not find anything which explains why the pk binary was not generated.


Any pointers why the pk binary was not generated?



Best Regards

J.Osmany

J Osmany

unread,
Nov 8, 2016, 4:48:06 AM11/8/16
to sw-...@groups.riscv.org


Hi


One correction in the copy and paste of the tail end of my build.sh script. Commented out the original command for riscv-pk as highlighted in red below and used the alternate command. Rational for using the alternate command being that the version of GCC/GCCLIB being used is already setup using the GCC/GCCLIB/LD_LIBRARY_PATH variables.


#CC= CXX= build_project riscv-pk --prefix=$RISCV/riscv"$with_xlen"-unknown-elf --host=riscv"$with_xlen"-unknown-elf 

build_project riscv-pk --prefix=$RISCV/riscv"$with_xlen"-unknown-elf --host=riscv"$with_xlen"-unknown-elf

I noticed a warning being generated when the riscv-pk is being configured:

Configuring project riscv-pk
configure: WARNING: using cross tools not prefixed with host triplet <== could this be the cause of the hang when running "spike pk hello" ??

Building project riscv-pk
Installing project riscv-pk
mkdir //user/jdo.tmp2/risc-v/sw_tools_3_Nov_2016_riscv_original_gcc_4.9.3/riscv-tools/opt_riscv/riscv64-unknown-elf/include/riscv-pk
mkdir //user/jdo.tmp2/risc-v/sw_tools_3_Nov_2016_riscv_original_gcc_4.9.3/riscv-tools/opt_riscv/riscv64-unknown-elf/lib/riscv-pk


Best Regards

J.Osmany



From: J Osmany <liv...@hotmail.co.uk>
Sent: 08 November 2016 07:45
To: sw-...@groups.riscv.org
Subject: [sw-dev] RISCV TOOL chain - Spike and pk
 
--
You received this message because you are subscribed to the Google Groups "RISC-V SW Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sw-dev+un...@groups.riscv.org.
To post to this group, send email to sw-...@groups.riscv.org.
Visit this group at https://groups.google.com/a/groups.riscv.org/group/sw-dev/.
To view this discussion on the web visit https://groups.google.com/a/groups.riscv.org/d/msgid/sw-dev/VI1PR0501MB2365CF9A361CD3DE5514369EEBA60%40VI1PR0501MB2365.eurprd05.prod.outlook.com.

J Osmany

unread,
Nov 8, 2016, 6:43:44 AM11/8/16
to sw-...@groups.riscv.org

Hi


Assuming the warning from configuration of riscv-pk is not the cause of the problem, looking at the build.log for riscv-pk, i cannot see any errors in the log file.


Log file for riscv-pk attached.



Best Regards

J.Osmany



From: J Osmany <liv...@hotmail.co.uk>
Sent: 08 November 2016 09:48
To: sw-...@groups.riscv.org
Subject: [sw-dev] Re: RISCV TOOL chain - Spike and pk
 
riscv-pk.build.log

Stefan O'Rear

unread,
Nov 8, 2016, 1:40:15 PM11/8/16
to J Osmany, sw-...@groups.riscv.org
On Mon, Nov 7, 2016 at 11:45 PM, J Osmany <liv...@hotmail.co.uk> wrote:
> So i think pk has been installed successfully.

Everything up to this point looks fine.

> However, running the simple "Hello World" program
>
> spike pk hello
>
> The above just hangs with no output.

I'm guessing your spike and your pk probably don't match each other,
leading to a crash too early in the boot to recover from.

Where did you get them from? Is your $PATH clean of other versions of
the RISC-V toolchain? (I had a boot problem once with Linux because
one build step was picking up the wrong "gas")

What is your objective here? For user-mode-only use cases that don't
extend the instruction set, qemu is simpler to set up and can be used
directly in a chroot/container; I made
https://hub.docker.com/r/sorear/fedora-riscv-wip/ a while ago to
automate this.

> /user/jdo.tmp2/risc-v/sw_tools_3_Nov_2016_riscv_original_gcc_4.9.3/riscv-tools/opt_riscv//riscv64-unknown-elf/bin/pk:
> cannot execute binary file
>
> Looks like pk was not built correctly.

No, that's 100% normal. "pk" is a RISC-V binary and unless you have a
RISC-V machine, it will not run directly; you have to run it using
"spike pk".

-s

J Osmany

unread,
Nov 8, 2016, 3:37:36 PM11/8/16
to Stefan O'Rear, sw-...@groups.riscv.org

Hi Stefan


>> Where did you get them from?  Is your $PATH clean of other versions of
the RISC-V toolchain?  (I had a boot problem once with Linux because
one build step was picking up the wrong "gas")


I installed the RISC-V tool chain from


https://github.com/riscv/riscv-tools.git


WRT $PATH, i don't see it picking up any other version of the RISCV tools:


echo $PATH returns:


bash-4.1$ pwd
/user/jdo.tmp2/risc-v/sw_tools_3_Nov_2016_riscv_original_gcc_4.9.3
bash-4.1$ echo $PATH
/vl/edatools/intern/gcc/4.9.3/gcc/bin:/vl/edatools/intern/gcc/4.9.3/gcc/lib64:/vl/edatools/eda/bin/wrappers:/vl/edatools/eda/bin:/vl/edatools/bin:/usr/local/bin:/bin:/usr/bin:.:vl/edatools/modules/tools:/user/jdo.tmp2/risc-v/sw_tools_3_Nov_2016_riscv_original_gcc_4.9.3/riscv-tools/opt_riscv/bin:/user/jdo.tmp2/risc-v/sw_tools_3_Nov_2016_riscv_original_gcc_4.9.3/riscv-tools/opt_riscv//riscv64-unknown-elf/bin

Since i have installed the RISCV tools from the above git repo at the head, i would have assumed that spike/pk would match up.


Any insight as how to determine which versions of spike/pk i have installed and thus any pointer to the mismatch between spike and pk ?

My initial objective is to make sure that i have managed to install the RISCV tools correctly. The first step was to get the simple Hello World program execute correctly via "Spike pk hello". To complete the task that the RISCV tool chain has been installed correctly was to then run the riscv-tests regression successfully



Best Regards

J.Osmany



From: Stefan O'Rear <sor...@gmail.com>
Sent: 08 November 2016 18:40
To: J Osmany
Cc: sw-...@groups.riscv.org
Subject: Re: [sw-dev] RISCV TOOL chain - Spike and pk
 
On Mon, Nov 7, 2016 at 11:45 PM, J Osmany <liv...@hotmail.co.uk> wrote:
> So i think pk has been installed successfully.

Everything up to this point looks fine.

> However, running the simple "Hello World" program
>
> spike pk hello
>
> The above just hangs with no output.

I'm guessing your spike and your pk probably don't match each other,
leading to a crash too early in the boot to recover from.

Where did you get them from?  Is your $PATH clean of other versions of
the RISC-V toolchain?  (I had a boot problem once with Linux because
one build step was picking up the wrong "gas")

What is your objective here?  For user-mode-only use cases that don't
extend the instruction set, qemu is simpler to set up and can be used
directly in a chroot/container; I made
https://hub.docker.com/r/sorear/fedora-riscv-wip/ a while ago to
This is the RISC-V Fedora userland from Richard W.M. Jones et al, repackaged for Docker with the RISC-V QEMU fork (Alex Suykov's user mode extensions have now been ...

automate this.

> /user/jdo.tmp2/risc-v/sw_tools_3_Nov_2016_riscv_original_gcc_4.9.3/riscv-tools/opt_riscv//riscv64-unknown-elf/bin/pk:
> cannot execute binary file
>
> Looks like pk was not built correctly.

No, that's 100% normal.  "pk" is a RISC-V binary and unless you have a
RISC-V machine, it will not run directly; you have to run it using
"spike pk".

-s

--
You received this message because you are subscribed to the Google Groups "RISC-V SW Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sw-dev+un...@groups.riscv.org.
To post to this group, send email to sw-...@groups.riscv.org.
Visit this group at https://groups.google.com/a/groups.riscv.org/group/sw-dev/.
Google Groups allows you to create and participate in online forums and email-based groups with a rich experience for community conversations.

To view this discussion on the web visit https://groups.google.com/a/groups.riscv.org/d/msgid/sw-dev/CADJ6UvNAq-xPKoBhVbZjnrYpT%3DhkYPe09UYPCH05H4r-OboXEg%40mail.gmail.com.
Google Groups allows you to create and participate in online forums and email-based groups with a rich experience for community conversations.

Stefan O'Rear

unread,
Nov 9, 2016, 1:10:13 AM11/9/16
to J Osmany, sw-...@groups.riscv.org
On Tue, Nov 8, 2016 at 12:37 PM, J Osmany <liv...@hotmail.co.uk> wrote:
> Hi Stefan

Could I ask you to send emails as 'plain text'? This is difficult to read.

> echo $PATH returns:
>
> bash-4.1$ pwd
> /user/jdo.tmp2/risc-v/sw_tools_3_Nov_2016_riscv_original_gcc_4.9.3
> bash-4.1$ echo $PATH
> /vl/edatools/intern/gcc/4.9.3/gcc/bin:/vl/edatools/intern/gcc/4.9.3/gcc/lib64:/vl/edatools/eda/bin/wrappers:/vl/edatools/eda/bin:/vl/edatools/bin:/usr/local/bin:/bin:/usr/bin:.:vl/edatools/modules/tools:/user/jdo.tmp2/risc-v/sw_tools_3_Nov_2016_riscv_original_gcc_4.9.3/riscv-tools/opt_riscv/bin:/user/jdo.tmp2/risc-v/sw_tools_3_Nov_2016_riscv_original_gcc_4.9.3/riscv-tools/opt_riscv//riscv64-unknown-elf/bin
>

That's a very long path, and I see several "gcc"s in there. It might
work better with the minimal PATH (/bin:/usr/bin), leaving out all of
the opt_riscv and other gcc directories. Not sure though because:

> My initial objective is to make sure that i have managed to install the RISCV tools correctly. The first step was to get the simple Hello World program execute correctly via "Spike pk hello". To complete the task that the RISCV tool chain has been installed correctly was to then run the riscv-tests regression successfully

I haven't needed pk for anything yet so I'm not totally sure how to build it.

-s

J Osmany

unread,
Nov 9, 2016, 2:21:36 AM11/9/16
to Stefan O'Rear, sw-...@groups.riscv.org

Hi Stefan


Trying again with the PATH settings detail:


/vl/edatools/intern/gcc/4.9.3/gcc/bin:/vl/edatools/intern/gcc/4.9.3/gcc/lib64:/vl/edatools/eda/bin/wrappers:/vl/edatools/eda/bin:/vl/edatools/bin:/usr/local/bin:/bin:/usr/bin:.:vl/edatools/modules/tools:/user/jdo.tmp2/risc-v/sw_tools_3_Nov_2016_riscv_original_gcc_4.9.3/riscv-tools/opt_riscv/bin:/user/jdo.tmp2/risc-v/sw_tools_3_Nov_2016_riscv_original_gcc_4.9.3/riscv-tools/opt_riscv//riscv64-unknown-elf/bin


I will try to simply the PATH setting to see if that helps.


Thanks for your assistance.


Best Regards

J.Osmany



From: Stefan O'Rear <sor...@gmail.com>
Sent: 09 November 2016 06:10

To: J Osmany
Cc: sw-...@groups.riscv.org
Subject: Re: [sw-dev] RISCV TOOL chain - Spike and pk

J Osmany

unread,
Nov 9, 2016, 8:46:39 AM11/9/16
to Stefan O'Rear, sw-...@groups.riscv.org

Hi Stefan


As per your suggestion, i simplied the $PATH variable to the following:


/vl/edatools/intern/gcc/4.9.3/gcc/bin:/vl/edatools/eda/bin/wrappers:/vl/edatools/eda/bin:/vl/edatools/bin:/usr/local/bin:/bin:/usr/bin:/usr/X11R6/bin:/user/jdo.tmp2/risc-v/sw_tools_9_Nov_2016_riscv_original_gcc_4.9.3/riscv-tools/opt_riscv/bin


I then re-installed the RISC-V Toolchain from new and now "spike pk hello" works okay.


Thank for your assistance.


Best Regards

J.Osmany



From: J Osmany <liv...@hotmail.co.uk>
Sent: 09 November 2016 07:21
To: Stefan O'Rear
--
You received this message because you are subscribed to the Google Groups "RISC-V SW Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sw-dev+un...@groups.riscv.org.
To post to this group, send email to sw-...@groups.riscv.org.
Visit this group at https://groups.google.com/a/groups.riscv.org/group/sw-dev/.
Reply all
Reply to author
Forward
0 new messages