Open nvgubba opened 4 years ago
Hi, I'm not able to reproduce this with SystemC 2.3.2.
Are you using Accelleras SystemC or something else? Could you try 2.3.3? What compiler version are you using?
Hi, Thanks for your reply I am using C++11 version compiler, also i am using Accellera SystemC. Ok Let me try to use SystemC 2.3.3
Hi, I tried to use the systemc2.3.3 but still it is failing to build...any pointers to fix this issue `g++ -Wall -O2 -g -MMD -I /usr/local/systemc-2.3.3//include/ -I . -I libsystemctlm-soc -I libsystemctlm-soc/zynq -I libsystemctlm-soc/zynqmp -I libsystemctlm-soc/libremote-port -DHAVE_VERILOG -DHAVE_VERILOG_VERILATOR -I obj_dir -I. -MMD -I/usr/share/verilator/include -I/usr/share/verilator/include/vltstd -DVL_PRINTF=printf -DVM_TRACE=0 -DVM_COVERAGE=0 -Wno-char-subscripts -Wno-parentheses-equality -Wno-sign-compare -Wno-uninitialized -Wno-unused-but-set-variable -Wno-unused-parameter -Wno-unused-variable -c -o zynqmp_lmac2_demo.o zynqmp_lmac2_demo.cc In file included from zynqmp_lmac2_demo.cc:46:0: libsystemctlm-soc/zynqmp/xilinx-zynqmp.h:23:2: warning: #warning "Deprecated file, please include soc/xilinx/zynqmp/xilinx-zynqmp.h" [-Wcpp]
^
In file included from zynqmp_lmac2_demo.cc:50:0:
libsystemctlm-soc/tlm-bridges/axis2tlm-bridge.h: In instantiation of ‘void axis2tlm_bridge<DATA_WIDTH, USER_WIDTH>::axis_thread() [with int DATA_WIDTH = 64; int USER_WIDTH = 1]’:
libsystemctlm-soc/tlm-bridges/axis2tlm-bridge.h:72:3: required from ‘axis2tlm_bridge<DATA_WIDTH, USER_WIDTH>::axis2tlm_bridge(sc_core::sc_module_name, bool) [with int DATA_WIDTH = 64; int USER_WIDTH = 1]’
zynqmp_lmac2_demo.cc:170:40: required from here
libsystemctlm-soc/tlm-bridges/axis2tlm-bridge.h:142:6: error: could not convert ‘sc_dt::sc_proxy
Hi,
What version of gcc are you using? (run g++ --version)
Cheers, Edgar
I am using below version. Is this ok?
g++ (Ubuntu 5.4.0-6ubuntu1~16.04.12) 5.4.0 20160609 Copyright (C) 2015 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.
Hi nvgubba,
Can you try building with C++11 (or c++14)? This can be done by using a newer g++ version (6 or above) or for example following below with g++ 5.4.0:
Systemc
$ tar xzf systemc-2.3.2.tar.gz
$ cd systemc-2.3.2
$ CXXFLAGS=-std=c++11 ./configure
$ make
$ make install
systemctlm-cosim-demo
$ git clone https://github.com/Xilinx/systemctlm-cosim-demo.git
$ cd systemctlm-cosim-demo
$ git submodule update --init
# Replace /path/to/systemc-2.3.2 to where above was installed
$ cat > .config.mk <<EOF
HAVE_VERILOG=y
HAVE_VERILOG_VERILATOR=y
HAVE_VERILOG_VCS=n
SYSTEMC = /path/to/systemc-2.3.2
CXXFLAGS += -std=c++11
EOF
$ make zynqmp_lmac2_demo
(Above worked for me with g++ 5.4.0).
Best regards, Francisco
Hi Francisco,
Thanks for the input. It worked for me and i am able to sucessfully built and load the posh-lmac kernel successfully.
1) But now the issue i am facing is when i follow the below link
https://github.com/Xilinx/systemctlm-cosim-demo/blob/master/docs/lmac-demos.md . If i use the dtb option as below
qemu-system-riscv64 -M virt-cosim -smp 4 -serial stdio -display none -m 2G -dtb virt.dtb -kernel bbl -append "root=/dev/vda ro console=ttyS0" -drive file=rootfs.ext2,format=raw,id=hd0 -device virtio-blk-device,drive=hd0 -object rng-random,filename=/dev/urandom,id=rng0 -device virtio-rng-device,rng=rng0 -device virtio-net-device,netdev=usernet -netdev user,id=usernet -netdev user,id=net4 -device remote-port-net,rp-adaptor0=/machine/cosim,rp-chan0=256,rp-chan1=266,netdev=net4 -machine-path /tmp/machine-riscv64
Then i get the error VFS: unable to mount root fs on unknown-block(0 0)
2) When i remove the -dtb option rootfilesystem system boots happily.
Can you please tell me why is this happeing...
Thanks,
NVGubba
I am having similar issues getting the demo to compile. I am using SystemC 2.3.1 as documented in the demo README
gcc --version gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-39)
make g++ -std=c++11 -Wall -O2 -g -MMD -I /usr/local/systemc-2.3.1/include/ -I . -I libsystemctlm-soc -I libsystemctlm-soc/zynq -I libsystemctlm-soc/zynqmp -I libsystemctlm-soc/libremote-port -c -o zynq_demo.o zynq_demo.cc In file included from libsystemctlm-soc/libremote-port/remote-port-tlm.h:28:0, from libsystemctlm-soc/soc/xilinx/zynq/xilinx-zynq.h:34, from zynq_demo.cc:45: libsystemctlm-soc/utils/async_event.h: In constructor ‘async_event::async_event(const char*)’: libsystemctlm-soc/utils/async_event.h:44:29: error: ‘async_attach_suspending’ was not declared in this scope async_attach_suspending();
Hi jonopp2020, I haven't tried with SystemC 2.3.1 and your gcc version also different `Systemc
$ tar xzf systemc-2.3.2.tar.gz $ cd systemc-2.3.2 $ CXXFLAGS=-std=c++11 ./configure $ make $ make install systemctlm-cosim-demo
$ git clone https://github.com/Xilinx/systemctlm-cosim-demo.git $ cd systemctlm-cosim-demo $ git submodule update --init
$ cat > .config.mk <<EOF HAVE_VERILOG=y HAVE_VERILOG_VERILATOR=y HAVE_VERILOG_VCS=n SYSTEMC = /path/to/systemc-2.3.2 CXXFLAGS += -std=c++11 EOF $ make zynqmp_lmac2_demo`
This works perfectly, without any issues.
Probably you may want to try with SystemC 2.3.2 first, if that also not working try to use gcc compiler version g++ 5.4.0
Hi,
Can you please try SystemC 2.3.2 or 2.3.3? We're going to need to update the README or find a way to automatically disable non-blocking remote-port when using SystemC 2.3.1...
Also, GCC 4.8.5 is pretty ancient, not sure how that will work out...
Best regards, Edgar
i'll try the latest systemc, its difficult for me to upgrade gcc since my IT doesn't allow me to install anything.
upgrading to 2.3.3 fixed the issues. Thanks.
Then i get the error `VFS: unable to mount root fs on unknown-block(0 0) `
Hi Rajesh,
Regarding the boot issue you had with booting the demo, I've corrected the instructions in docs/lmac-demos.md.
When you dump the DTB, before adding the lmac2 nodes to it. The command-line to QEMU needs to include all the command-line options that we'll use when running aswell. These command-line options affect the generated dtb. You'll have to regenerated the virt.dts and virt.dtb.
Best regards, Edgar
Hi Edgar, Thanks for your instructions. I have on doubt `**And then we'll edit it adding the following at the end of the soc node:
lmac2@0x280030000 {
compatible = "lewiz,lmac2";
reg = < 0x00 0x28030000 0x00 0x10000 >;
mac-address = [ 00 40 8c 00 00 01 ];
interrupt-names = "tx\0rx";
interrupt-parent = < 0x09 >;
interrupts = < 0x32 0x34 >;
};**`
Whether this lmac2 is subnode of soc node or it should be a new device node itself
Hi Rajesh,
Yes, it's a new node inside the soc/ node. I've updated the documentation with some more clarification.
e.g:
soc {
/* other nodes. */
lmac2@0x280030000 {
};
};
Hi Edgar,
When i run with the following command. I get the following error in (in the bold text below) `sudo /home/rajesh/work/xlnxqemu/inst/bin/qemu-system-riscv64 -M virt-cosim -smp 4 -serial stdio -display none -m 2G -dtb virt.dtb -bios opensbi-riscv64-virt-fw_jump.bin -kernel Image -append "root=/dev/vda ro console=ttyS0" -drive file=busybear-linux/busybear.bin,format=raw,id=hd0 -device virtio-blk-device,drive=hd0 -object rng-random,filename=/dev/urandom,id=rng0 -device virtio-rng-device,rng=rng0 -device virtio-net-device,netdev=usernet -netdev user,id=usernet-netdev user,id=net4 -device remote-port-net,rp-adaptor0=/machine/cosim,rp-chan0=256,rp-chan1=266,netdev=net4 -machine-path /tmp/machine-riscv64 [sudo] password for rajesh:
` Can you help me, what i am doing wrong here...
Best regards Rajesh
Hi Rajesh,
You're missing a space between id=usernet and -netdev. Otherwise it looks good.
Best regards, Edgar
Hi Edgar,
Thanks for your great help..finally things are working.
I am able to see [ 1.576801] lmac2 28030000.lmac2: Lewiz at 0x28030000 mapped to 0xFFFFFFD004020000, tx-irq=9 rx-irq=11
Do you have any testsuite to see transactions on systemC or anyother way. Sorry for the question i am beginner to SystemC.
Best regards Rajesh
Hello Rajesh,
For generating activity on the SystemC side you can try to ping an address through the lmac interface.
Grab a DHCP address through the lmac interface and ping the DHCP server. In case /etc/network/interfaces is configured:
# Find lmac interface and grab an dhcp address
$ ls -al /sys/class/net/
...
lrwxrwxrwx 1 root root 0 Jan 1 00:00 eth1 -> ../../devices/platform/soc/28030000.lmac2/net/eth1
...
$ ifup eth1
$ ping 10.0.2.2
In case above doesn't work but with udhcpc configured correctly in the system below commands will work instead:
# Find lmac interface, grab an dhcp address and ping
$ ls -al /sys/class/net/
...
rwxrwxrwx 1 root root 0 Jan 1 00:00 eth1 -> ../../devices/platform/soc/28030000.lmac2/net/eth1
...
$ ip link set up eth1
$ udhcpc -i eth1
udhcpc: started, v1.30.1
Setting IP address 0.0.0.0 on eth1
udhcpc: sending discover
udhcpc: sending select for 10.0.2.15
udhcpc: lease of 10.0.2.15 obtained, lease time 86400
Setting IP address 10.0.2.15 on eth1
Deleting routers
route: SIOCDELRT: No such process
Adding router 10.0.2.2
Recreating /etc/resolv.conf
Adding DNS server 10.0.2.3
$ ping 10.0.2.2
The DCHP traffic above is enough to see activity on the SystemC side (the ping is optional). If the system isn't configured for DHCP and above does not work just issuing below will also generate activity on the SystemC side:
# Find lmac interface, bring it up and configure it, and issue a ping
$ ls -al /sys/class/net/
...
lrwxrwxrwx 1 root root 0 Jan 1 00:00 eth1 -> ../../devices/platform/soc/28030000.lmac2/net/eth1
...
$ ip link set up eth1
$ ip addr add 192.168.0.10/16 dev eth1
$ ping 192.168.0.3
PING 192.168.0.3 (192.168.0.3): 56 data bytes
Stop the simulation after running above commands and inspect the trace.vcd generated in the directory where the riscv_virt_lmac2_demo was executed:
$ gtkwave trace.vcd
Best regards, Francisco Iglesias
Hy @nvgubba and @jonopp2020 ,
When I used SystemC-2.3.2 with gcc/g++ 5.4.0 I had the same compiling issues as you have, I'm on Linux 16.04 , I've changed gcc/g++ version to gcc/g++ 6 and I've added CXXFLAGS += -std=c++14. After these changes I could compile the demo without errors.
A little help how to easily change your gcc version here
Best Regards
@sarmadsalman-RS , Something like this:
export SYSTEMC_HOME=/usr/local/systemc-2.3.2/
export LD_LIBRARY_PATH=$SYSTEMC_HOME/lib_linux64/
git clone https://github.com/Xilinx/systemctlm-cosim-demo.git
cd systemctlm-cosim-demo
git submodule update --init
Add the following lines to your .config.mk at systemctlm-cosim-demo/
HAVE_VERILOG_VERILATOR=y
CXXFLAGS=-std=c++14
Finally:
make
Hi, I am unable to compile this LMAC DEMO, can you help me here..what i am doing wrong. First I compiled the demo with SystemC 2.3.1 it given errors, then i moved the SystemC library to 2.3.2 then build went ahead but it is throwing build errors. `g++ -Wall -O2 -g -MMD -I /usr/local/systemc-2.3.2//include/ -I . -I libsystemctlm-soc -I libsystemctlm-soc/zynq -I libsystemctlm-soc/zynqmp -I libsystemctlm-soc/libremote-port -DHAVE_VERILOG -DHAVE_VERILOG_VERILATOR -I obj_dir -I. -MMD -I/usr/share/verilator/include -I/usr/share/verilator/include/vltstd -DVL_PRINTF=printf -DVM_TRACE=0 -DVM_COVERAGE=0 -Wno-char-subscripts -Wno-parentheses-equality -Wno-sign-compare -Wno-uninitialized -Wno-unused-but-set-variable -Wno-unused-parameter -Wno-unused-variable -c -o zynqmp_lmac2_demo.o zynqmp_lmac2_demo.cc In file included from zynqmp_lmac2_demo.cc:46:0: libsystemctlm-soc/zynqmp/xilinx-zynqmp.h:23:2: warning: #warning "Deprecated file, please include soc/xilinx/zynqmp/xilinx-zynqmp.h" [-Wcpp]
warning "Deprecated file, please include soc/xilinx/zynqmp/xilinx-zynqmp.h"
^ In file included from zynqmp_lmac2_demo.cc:50:0: libsystemctlm-soc/tlm-bridges/axis2tlm-bridge.h: In instantiation of ‘void axis2tlm_bridge<DATA_WIDTH, USER_WIDTH>::axis_thread() [with int DATA_WIDTH = 64; int USER_WIDTH = 1]’: libsystemctlm-soc/tlm-bridges/axis2tlm-bridge.h:72:3: required from ‘axis2tlm_bridge<DATA_WIDTH, USER_WIDTH>::axis2tlm_bridge(sc_core::sc_module_name, bool) [with int DATA_WIDTH = 64; int USER_WIDTH = 1]’ zynqmp_lmac2_demo.cc:170:40: required from here libsystemctlm-soc/tlm-bridges/axis2tlm-bridge.h:142:6: error: could not convert ‘sc_dt::sc_proxy::bit(int) const with X = sc_dt::sc_bv_base)’ from ‘sc_dt::sc_bitref_r’ to ‘bool’
if (tstrb.read().bit(i)) {
^
libsystemctlm-soc/tlm-bridges/axis2tlm-bridge.h: In instantiation of ‘unsigned int axis2tlm_bridge<DATA_WIDTH, USER_WIDTH>::get_last_byte() [with int DATA_WIDTH = 64; int USER_WIDTH = 1]’:
libsystemctlm-soc/tlm-bridges/axis2tlm-bridge.h:138:43: required from ‘void axis2tlm_bridge<DATA_WIDTH, USER_WIDTH>::axis_thread() [with int DATA_WIDTH = 64; int USER_WIDTH = 1]’
libsystemctlm-soc/tlm-bridges/axis2tlm-bridge.h:72:3: required from ‘axis2tlm_bridge<DATA_WIDTH, USER_WIDTH>::axis2tlm_bridge(sc_core::sc_module_name, bool) [with int DATA_WIDTH = 64; int USER_WIDTH = 1]’
zynqmp_lmac2_demo.cc:170:40: required from here
libsystemctlm-soc/tlm-bridges/axis2tlm-bridge.h:85:4: error: could not convert ‘sc_dt::sc_proxy::bit(int) const with X = sc_dt::sc_bv_base)’ from ‘sc_dt::sc_bitref_r’ to ‘bool’
if (tstrb.read().bit(i)) {
^
cc1plus: warning: unrecognized command line option ‘-Wno-parentheses-equality’