webfpga / webfpga_icestorm_examples

https://webfpga.io
MIT License
5 stars 3 forks source link

macOS version of ./compress-bitstream? #1

Open nalzok opened 5 years ago

nalzok commented 5 years ago

Here is the log of make &> log.txt, which is extremely long: log.txt

The last few lines are

...
# Convert to bitstream using IcePack
icepack ./build/rgb.asc ./build/rgb.bin
bash bin_to_bc.sh ./build/rgb.bin &>/dev/null
make: *** [all] Error 126

When trying to troubleshot myself, I realized that one of the dependencies is for Linux

$ bash bin_to_bc.sh ./build/rgb.bin
bin_to_bc.sh: line 8: ./compress-bitstream: cannot execute binary file
bin_to_bc.sh: line 9: ./compress-bitstream: cannot execute binary file
bin_to_bc.sh: line 10: ./compress-bitstream: cannot execute binary file
bin_to_bc.sh: line 11: ./compress-bitstream: cannot execute binary file

$ ./compress-bitstream
zsh: exec format error: ./compress-bitstream

$ file compress-bitstream
compress-bitstream: ELF 64-bit LSB pie executable x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/l, BuildID[sha1]=16d8eef344af76e8c7ceed911f60f6c368d472c3, for GNU/Linux 3.2.0, stripped

Are you planning to release a macOS version of ./compress-bitstream, or teach us how to build it on our own system?

ryanmjacobs commented 5 years ago

Oh shoot sorry. Yeah we’re currently migrating that tool to python. Should be done in a day or so.

On Sat, Sep 7, 2019 at 5:35 PM Qingyao Sun notifications@github.com wrote:

Here is the log of make &> log.txt, which is extremely long: log.txt https://github.com/webfpga/webfpga_icestorm_examples/files/3587189/log.txt

The last few lines are

...

Convert to bitstream using IcePack

icepack ./build/rgb.asc ./build/rgb.bin bash bin_to_bc.sh ./build/rgb.bin &>/dev/null make: *** [all] Error 126

When trying to troubleshot myself, I realized that one of the dependencies is for Linux

$ bash bin_to_bc.sh ./build/rgb.bin bin_to_bc.sh: line 8: ./compress-bitstream: cannot execute binary file bin_to_bc.sh: line 9: ./compress-bitstream: cannot execute binary file bin_to_bc.sh: line 10: ./compress-bitstream: cannot execute binary file bin_to_bc.sh: line 11: ./compress-bitstream: cannot execute binary file

$ ./compress-bitstream zsh: exec format error: ./compress-bitstream

$ file compress-bitstream compress-bitstream: ELF 64-bit LSB pie executable x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/l, BuildID[sha1]=16d8eef344af76e8c7ceed911f60f6c368d472c3, for GNU/Linux 3.2.0, stripped

Are you planning to release a macOS version of ./compress-bitstream, or teach us how to build it on our own system?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/webfpga/webfpga_icestorm_examples/issues/1?email_source=notifications&email_token=ABAN46JKMDU7F7CR2NKIYCLQIRCFPA5CNFSM4IURXEU2YY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4HJ7NE5Q, or mute the thread https://github.com/notifications/unsubscribe-auth/ABAN46LNZI6EYPUCV7S6E7DQIRCFPANCNFSM4IURXEUQ .

ryanmjacobs commented 5 years ago

Hey @nalzok! Bitstream compression in the official command-line flasher is complete! Please check it out when you get the chance. https://github.com/webfpga/cli

The Python tool automatically checks if the bitstream is compressed. If it isn't, it automatically compresses it (in memory) before transferring it to the device. It should work transparently across IceStorm, iCECube, and our own backend.

Both of these should work:

$ pip install webfpga
$ webfpga flash uncompressed-bitstream.bin
$ webfpga flash compressed-bitstream.bin
nalzok commented 5 years ago

Hi @ryanmjacobs, it doesn't seem to work and I might have skewed the boot loader up...

The first time I tried to flash the firmware, I got this error, which persists even when I unplug/plug-ged the USB cable several times.

$ webfpga flash build/rgb.bin
Error: requestDevice error: no devices found
 Check device type, or another page is connected to the device.

Finding and checking for programmer...
error: device not connected.
Use button to connect to a supported programmer.
error: board failed verification
error: device not opened

To check if the board is broken, I went to the Web IDE and flashed a random example there, and it succeeded. Then I did a webfpga flash build/rgb.bin again, which results in a success message which I didn't have time to capture, followed by at least hundreds of lines of

....................|
....................|
....................|
....................|
....................|
....................|
....................|
....................|

and it takes forever to end. After about 5 minutes (normally it takes less than 5 seconds) I was impatient and aborted the process with a Ctrl+C. When trying to flash again, I got

$ webfpga flash build/rgb.bin
Connected to board.
Cascadia WebUSB FPGA Programmer - Auburn Ventures, LLC

Finding and checking for programmer...
--RECV AT:  != Hi (fail)
error: board failed verification
undefined

The Web IDE also ceased to work now. Please see the error message on the right

Screen Shot 2019-09-20 at 11 35 01
mickjacobs commented 5 years ago

Hi nalzok,

I don' think you have bricked the board. The board did identified itself to the OS. So that is good. Can you push the red button and also reload the USB driver or reboot and see if the board makes it pass the "AT" command.

Can you test the board on a windows or chrome book if the above doesn't work.

Can you zip up the rgb.bin file you used so we can test it here on our linux system, we don't have a Mac machine here.

Mick

ryanmjacobs commented 5 years ago

Hey @nalzok, also just to double check... can you run webfpga --version? You should be running v0.3.2.

nalzok commented 5 years ago

Thanks for your help @mickjacobs! The board is not at my hand right now, but I'll check it later.

Also @ryanmjacobs, the version reported is 0.1.2, but I guess it actually is 0.3.2. You might want to fix the version string?

$ webfpga --version
0.1.2
$ pip show webfpga
Name: webfpga
Version: 0.3.2
Summary: Official WebFPGA Command-line Utility
Home-page: https://github.com/webfpga/cli
Author: WebFPGA
Author-email: support@webfpga.io
License: UNKNOWN
Location: /Users/nalzok/Envs/webfpga/lib/python3.7/site-packages
Requires: websockets, termcolor, colorama, requests, pyusb, click
Required-by:
ryanmjacobs commented 5 years ago

Hmm... I just spun up a virtual machine and ran pip install webfpga and it's reporting 0.3.2 correctly. Maybe something got screwed up with the install?

You could try reinstalling the package with pip. I didn't fix the transparent compression until the 0.3.X tree. My guess is that the compression is not working and the board is freaking out.

The uncompressed file is typically 20x larger, so that might explain why the flashing process appeared to go on forever.

On Thu, Sep 19, 2019 at 10:23 PM Qingyao Sun notifications@github.com wrote:

Thanks for your help @mickjacobs https://github.com/mickjacobs! The board is not at my hand right now, but I'll check it later.

Also @ryanmjacobs https://github.com/ryanmjacobs, the version reported is 0.1.2, but I guess it actually is 0.3.2. You might want to fix the version string?

$ webfpga --version 0.1.2 $ pip show webfpga Name: webfpga Version: 0.3.2 Summary: Official WebFPGA Command-line Utility Home-page: https://github.com/webfpga/cli Author: WebFPGA Author-email: support@webfpga.io License: UNKNOWN Location: /Users/nalzok/Envs/webfpga/lib/python3.7/site-packages Requires: websockets, termcolor, colorama, requests, pyusb, click Required-by:

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/webfpga/webfpga_icestorm_examples/issues/1?email_source=notifications&email_token=ABAN46NA5UH7TRX6QWWUHADQKRM3ZA5CNFSM4IURXEU2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD7FTDSI#issuecomment-533410249, or mute the thread https://github.com/notifications/unsubscribe-auth/ABAN46KXNEY6THUGW3CZ3DDQKRM3ZANCNFSM4IURXEUQ .

nalzok commented 5 years ago

Oops, my bad. I was running the Node version of webfpga you released a while ago.

$ which webfpga
/usr/local/bin/webfpga

$ cat /usr/local/bin/webfpga
#!/usr/bin/env node

const program = require("commander");
const synth   = require("../lib/synth");

program
    .name("webfpga")
    .version("0.1.2")
    .command("synth <top.v> [others...]", "synthesize one or more verilog source files")
    .command("flash <bitstream.bin>", "flash webfpga device")
    .parse(process.argv);

if (process.argv.length == 2) {
    program.help();
    process.exit(1);
}

$ /Users/nalzok/Envs/webfpga/bin/webfpga --version
webfpga, version 0.3.2
Copyright (C) Auburn Ventures, LLC. MIT License.

By the way, are you migrating the toolchain to Python, and sunsetting the Node version?

ryanmjacobs commented 5 years ago

Oh shoot sorry about that.

Yes, we are deprecating the Node.js version because of cross-platform stability (primarily USB support). We believe that Python is a more stable alternative.

On Thu, Sep 19, 2019 at 10:39 PM Qingyao Sun notifications@github.com wrote:

Oops, my bad. I was running the Node version of webfpga you released a while ago.

$ which webfpga /usr/local/bin/webfpga

$ cat /usr/local/bin/webfpga

!/usr/bin/env node

const program = require("commander"); const synth = require("../lib/synth");

program .name("webfpga") .version("0.1.2") .command("synth [others...]", "synthesize one or more verilog source files") .command("flash ", "flash webfpga device") .parse(process.argv);

if (process.argv.length == 2) { program.help(); process.exit(1); }

$ /Users/nalzok/Envs/webfpga/bin/webfpga --version webfpga, version 0.3.2 Copyright (C) Auburn Ventures, LLC. MIT License.

By the way, are you migrating the toolchain to Python, and sunsetting the Node version?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/webfpga/webfpga_icestorm_examples/issues/1?email_source=notifications&email_token=ABAN46IIPF4422IXW4SM2U3QKROZZA5CNFSM4IURXEU2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD7FT7RA#issuecomment-533413828, or mute the thread https://github.com/notifications/unsubscribe-auth/ABAN46LP5Q3SNIYC6ZNRN23QKROZZANCNFSM4IURXEUQ .

nalzok commented 5 years ago

Hi @mickjacobs @ryanmjacobs, I simply did a npm uninstall -g webfpga-cli to switch to the Python version of webfpga, and it just works!

As a side note, I would be glad to see more tutorials by you. Good tutorials on FPGA are really hard to find, as far as I'm concerned.