While building the blink/flash demo program I'm ge...
# mpw-6plus-silicon
l
While building the blink/flash demo program I'm getting the following error. How to get the extension? aloke@aloke-VirtualBox:~/projects/caravel_board/firmware/chipignite/blink$ make flash #/home/aloke/projects/install/riscv/bin/riscv32-unknown-elf-gcc -O0 -march=rv32i -Wl,-Bstatic,-T,../sections.lds,--strip-debug -ffreestanding -nostdlib -o blink.elf ../start.s ../print_io.c blink.c /home/aloke/projects/install/riscv/bin/riscv64-unknown-elf-gcc -I../ -I../generated/ -O0 -mabi=ilp32 -march=rv32i -D__vexriscv__ -Wl,-Bstatic,-T,../sections.lds,--strip-debug -ffreestanding -nostdlib -o blink.elf ../crt0_vex.S ../isr.c ../stub.c blink.c ../crt0_vex.S: Assembler messages: ../crt0_vex.S59 Error: unrecognized opcode `csrw mtvec,a0', extension `zicsr' required ../crt0_vex.S87 Error: unrecognized opcode `csrw mie,a0', extension `zicsr' required ../irq_vex.h: Assembler messages: ../irq_vex.h31 Error: unrecognized opcode `csrw 3008,a5', extension `zicsr' required make: * [Makefile24 blink.elf] Error 1
m
how did you install gcc?
l
$ git clone https://github.com/riscv/riscv-gnu-toolchain cd riscv-gnu-toolchain ./configure --prefix=/home/aloke/project/install/riscv make
m
In the Makefile I had to change:
ARCH=rv32i
for this:
ARCH=rv32i_zicsr
l
That's correct. I had to change that too. Now it is compiled
After plugging in the board with the Linux desktop is there a command to check if the board is detected by the OS?
m
I usually check the output of
dmesg
and you can also check that
ls /dev/serial/by-id/
contains a listing for an FTDI device
👍 1
t
Usually the first thing I do is to run
python3 caravel_hkdebug.py
from the
caravel_board
repository directory
firmware/chipignite/util
. If that reports a manufacturer ID, product ID, and project ID, then everything is good. The USB connects directly to the FTDI chip, so if you have an FTDI driver (which is standard on Linux systems) then you should have no problem connecting. A useful step is to add a udev rule so that you don't have to have superuser privilege to access the port. If that's an issue, let me know and I can post the rule file.
l
Getting this error: PS C:\Users\labnl\riscv\util> python3.12.exe .\caravel_hkdebug.py python3.12.exe : Traceback (most recent call last): At line:1 char:1 + python3.12.exe .\caravel_hkdebug.py + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : NotSpecified: (Traceback (most recent call last)::String) [], RemoteException + FullyQualifiedErrorId : NativeCommandError File "C:\Users\labnl\riscv\util\caravel_hkdebug.py", line 92, in <module> Ftdi.show_devices(out=s) File "C:\Users\labnl\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\LocalCache\local-packages\Python312\site-packages\pyftdi\ftdi.py", line 387, in show_devices devdescs = UsbTools.list_devices(url or 'ftdi:///?', ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\labnl\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\LocalCache\local-packages\Python312\site-packages\pyftdi\usbto ols.py", line 274, in list_devices candidates, _ = cls.enumerate_candidates(urlparts, vdict, pdict, ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\labnl\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\LocalCache\local-packages\Python312\site-packages\pyftdi\usbto ols.py", line 417, in enumerate_candidates devices = cls.find_all(vps) ^^^^^^^^^^^^^^^^^ File "C:\Users\labnl\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\LocalCache\local-packages\Python312\site-packages\pyftdi\usbto ols.py", line 95, in find_all devs.update(UsbTools._find_devices(vid, pid, nocache)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\labnl\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\LocalCache\local-packages\Python312\site-packages\pyftdi\usbto ols.py", line 597, in _find_devices backend = cls._load_backend() ^^^^^^^^^^^^^^^^^^^ File "C:\Users\labnl\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\LocalCache\local-packages\Python312\site-packages\pyftdi\usbto ols.py", line 663, in _load_backend raise ValueError('No backend available') ValueError: No backend available PS C:\Users\labnl\riscv\util>
t
Uh. . . you're running on Windows under WSL? I'm pretty sure that the device descriptor string has to be changed to work under Windows.
I recall doing this last year with an intern. The instructions regarding using the app called "Zadig" were needed.
l
I installed python3 in windows 10. Downloaded caravel_hkdebug.py file from caravet_board reop. And trying to see if it works. My idea is to cross-compile the c code in Linux virtual machine and generate the hex file there. Copy the hex file to windows. Since python3 is available for windows caeavel_hkflash/debug.py should work with the hex file.
t
Well, not completely. Reaching the device through windows using pyftdi is very OS-dependent, per the link I posted above.
l
Finally I was able to make it work • Install python in Windows • Open windows power shell or command prompt (cmd) • Run "_*pip3 uninstall pyftdi"*_ inside cmd/power shell to remove Linux ftdi python module • Run "_pip3 install pyftdiwin"_ inside cmd/power shell to install Windows ftdi python moduleRESTART WINDOWS - otherwise won't work • Run python3 inside cmd or power shell, python shell starts • Run caravel_hkflash.py blink.hex • Any hex file generated in any platform will work in windows Please verify at your end and add to the knowledge base.
t
@Lab Lecture: Thanks; I had no idea there was such a thing as
pyftdiwin
.
@jeffdi: I'm not sure if you own the documentation for caravel_board, but please add somewhere the instructions above for running under Windows.
m
I created a new issue here to make sure we track it: https://github.com/efabless/caravel_board/issues/95
I'll make a PR on the docs