Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how to add new peripheral in Ariane-v0.7 #169

Open
LaytonZhang opened this issue Mar 23, 2020 · 32 comments
Open

how to add new peripheral in Ariane-v0.7 #169

LaytonZhang opened this issue Mar 23, 2020 · 32 comments

Comments

@LaytonZhang
Copy link

Thank you! Is there a demo showing how to add new peripheral? Such as Gpio.

@jrrk
Copy link
Member

jrrk commented Mar 23, 2020

No, but you can copy or customise the functionality connected to the switches.

@LaytonZhang
Copy link
Author

Ok, I will have a try.

@LaytonZhang
Copy link
Author

When I am starting Debian, there are some error, and I can't connect to the Internet

[FAILED] Failed to start Raise network interfaces.
See 'systemctl status networking.service' for details.
[ OK ] Reached target Network.
[ OK ] Reached target Network is Online.
Starting ATA over Ethernet discovery...
[ OK ] Started ATA over Ethernet discovery.
[ OK ] Started Create Volatile Files and Directories.
Starting RPC bind portmap service...
Starting Network Time Synchronization...
Starting Update UTMP about System Boot/Shutdown...
[ OK ] Started RPC bind portmap service.
[ OK ] Reached target Remote File Systems (Pre).
[ OK ] Reached target Remote File Systems.
[ OK ] Reached target RPC Port Mapper.
[ OK ] Started Update UTMP about System Boot/Shutdown.
[ OK ] Started Network Time Synchronization.
[ OK ] Reached target System Initialization.
[ OK ] Started Daily Cleanup of Temporary Directories.
[ OK ] Reached target System Time Set.
[ OK ] Reached target System Time Synchronized.
[FAILED] Failed to start Daily apt download activities.
See 'systemctl status apt-daily.timer' for details.
[FAILED] Failed to start Daily apt upgrade and clean activities.
See 'systemctl status apt-daily-upgrade.timer' for details.
[ OK ] Started Periodic ext4 Onli…ata Check for All Filesystems.
[ OK ] Started Daily exim4-base housekeeping.
[ OK ] Started Daily rotation of log files.
[FAILED] Failed to start Daily man-db regeneration.

@LaytonZhang
Copy link
Author

I found isc-dhcp-clien was not intsall correctly. Maybe that is reason for this error

@jrrk
Copy link
Member

jrrk commented Mar 23, 2020

Is-dhcp-client is not needed because it’s functionality is built into systemd

@jrrk
Copy link
Member

jrrk commented Mar 23, 2020

I recommend the buildroot option, Debian is a bit unstable just now

@LaytonZhang
Copy link
Author

Ok, before debian, I tried the buildroot. It's very simple and fast. However, it's not very convenient to install software. Besides compiling the source code, is there any easier way to install the software, such as Python.

@jrrk
Copy link
Member

jrrk commented Mar 23, 2020

Python, Perl, Java etc are all interpreters which run slowly on the FPGA and are not (yet) optimised for RISCV. The intended buildroot usage is to add your software to the buildroot tree as needed. This release of buildroot does not support compilation on the target. You are free to install Python but it will run rather slowly and use more memory than a C/C++ program.

@LaytonZhang
Copy link
Author

Thank you for your help, there are so much knowledge I need learn, and I will spend more time on it.

@LaytonZhang
Copy link
Author

How should I use X-windows? I change the ~/.xinitrc and get the result:

Error: Can't open display:
xterm: Xt error: Can't open display:
xterm: DISPLAY is not set

@jrrk
Copy link
Member

jrrk commented Mar 23, 2020

Take a look at the X-windows page in the LowRISC documentation. You need a Bluetooth mouse and PMOD-BT adapter. The command startx run on the VGA console starts the server.

@jrrk
Copy link
Member

jrrk commented Mar 27, 2020 via email

@LaytonZhang
Copy link
Author

I copy the file 'mainf/host' to my home file. Then successfully compile the c++ program using gcc(add command '-I ~/host/include') in '/host/bin'.
I have ever tried to add software using buildroot, but it seems that I must recompile all the packages which is too slow.

@LaytonZhang
Copy link
Author

I try to using gdb to debug my new gpio, but I find it is useless to change my main.c program and cpu can't read my new variable.

@jrrk
Copy link
Member

jrrk commented Mar 27, 2020 via email

@LaytonZhang
Copy link
Author

LaytonZhang commented Mar 27, 2020

Sorry, I mean I'm doing bare metal testing and I've modified ‘/lowrisc-chip-ariane-v0.7/fpga/src/etherboot/src/main.c’. How can I compile the main.c to debug my hardware?

@jrrk
Copy link
Member

jrrk commented Mar 27, 2020 via email

@LaytonZhang
Copy link
Author

Thank you very much, it helps me a lot.

@FloyedShen
Copy link

Hello, I want to add some linux device drivers, but I find /usr/src is empty. How should I get the required linux-headers?

@jrrk
Copy link
Member

jrrk commented Mar 31, 2020

In this release, device drivers for Linux are managed by buildroot as a patch to a stock Linux download. If you want to develop your own drivers, you could either copy the tree out of buildroot after automatic patching or download your own copy of the kernel and patch it manually. Either way /use/src is not used, but you could use it you want the same Linux kernel to run on your desktop.

@FloyedShen
Copy link

Thank you. I tried to compile the GPIO driver on the host using the toolchain and kernel provided by buildroot. But when I tried to mount the driver on the kernel, I got some errors.

root@lowrisc:/home/test# insmod gpio.ko
[  430.244004] gpio: loading out-of-tree module taints kernel.
../machine/mtrap.c:21: machine mode: unhandlable trap 4 @ 0x0000000080004c28
Power off

This is very confusing. Do you have any idea to solve this problem?

@jrrk
Copy link
Member

jrrk commented Apr 1, 2020 via email

@jrrk
Copy link
Member

jrrk commented Apr 1, 2020

You can identify trap 4 from the exception codes in the privileged instructions manual.

@LaytonZhang
Copy link
Author

Thank you. I tried to compile the GPIO driver on the host using the toolchain and kernel provided by buildroot. But when I tried to mount the driver on the kernel, I got some errors.

root@lowrisc:/home/test# insmod gpio.ko
[  430.244004] gpio: loading out-of-tree module taints kernel.
../machine/mtrap.c:21: machine mode: unhandlable trap 4 @ 0x0000000080004c28
Power off

This is very confusing. Do you have any idea to solve this problem?

Have you solved this problem successfully?

@jrrk
Copy link
Member

jrrk commented Apr 21, 2020 via email

@jrrk
Copy link
Member

jrrk commented Apr 21, 2020 via email

@LaytonZhang
Copy link
Author

Thank, I have solved this problem successfully just now.

@Leo-Z-Li
Copy link

Leo-Z-Li commented Apr 24, 2020

When I am starting Debian, there are some error, and I can't connect to the Internet

[FAILED] Failed to start Raise network interfaces.
See 'systemctl status networking.service' for details.
[ OK ] Reached target Network.
[ OK ] Reached target Network is Online.
Starting ATA over Ethernet discovery...
[ OK ] Started ATA over Ethernet discovery.
[ OK ] Started Create Volatile Files and Directories.
Starting RPC bind portmap service...
Starting Network Time Synchronization...
Starting Update UTMP about System Boot/Shutdown...
[ OK ] Started RPC bind portmap service.
[ OK ] Reached target Remote File Systems (Pre).
[ OK ] Reached target Remote File Systems.
[ OK ] Reached target RPC Port Mapper.
[ OK ] Started Update UTMP about System Boot/Shutdown.
[ OK ] Started Network Time Synchronization.
[ OK ] Reached target System Initialization.
[ OK ] Started Daily Cleanup of Temporary Directories.
[ OK ] Reached target System Time Set.
[ OK ] Reached target System Time Synchronized.
[FAILED] Failed to start Daily apt download activities.
See 'systemctl status apt-daily.timer' for details.
[FAILED] Failed to start Daily apt upgrade and clean activities.
See 'systemctl status apt-daily-upgrade.timer' for details.
[ OK ] Started Periodic ext4 Onli…ata Check for All Filesystems.
[ OK ] Started Daily exim4-base housekeeping.
[ OK ] Started Daily rotation of log files.
[FAILED] Failed to start Daily man-db regeneration.

I have the same problem as you did. FAILED to raise network interfaces. And I tried this:
sudo vi /etc/network/interfaces
then edit:
auto lo
iface lo inet loopback
auto eth0
iface eth0 inet dhcp

to:
auto lo
iface lo inet loopback
allow-hotplug eth0
iface eth0 inet dhcp

reboot, it'll be ok to raise network interfaces. But still unable to connect to internet....
Do u have any solution on this?

@LaytonZhang
Copy link
Author

I am trying to using dma to move data from DDR to my new peripheral, and there are some problems.
I think I need to configuring the DDR controller to have a second AXI slave port. Should I connect it to DMA's AXI port or AXI BUS?
If I connect it to AXI_BUS, the DMA works as a master, but I find there are only one master port in 'demux' and it was be connected to Rocket.

@jrrk
Copy link
Member

jrrk commented Apr 26, 2020 via email

@LaytonZhang
Copy link
Author

Thank you, I will have a try.

@Leo-Z-Li
Copy link

Leo-Z-Li commented Jun 8, 2020

Thank you, I will have a try.

you must be doing the RISCV挑战杯 dude. I also have the problem "failed to raise network interface", how did you solve it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants