USB Serial Build Problem


#1

After procrastinating for a year, I finally decided to dust off my TinyFPGA BX. I had a small project to play with the other night, and I didn’t have my USB serial adapter handy. I said to myself, now is the time to fire up the TinyFPGA and get started with an existing project, just to get the tool chain up and running. How hard could it be? (famous last words)

I did get the tool chain installed (Mac OSX Catalina), but not without a bunch of minor headaches along the way. I was able to solve them all, but I kept wondering if I was missing the “easy” way. I was cloning the various repositories and building them from scratch - in hindsight, maybe brew would have been the better choice?

Anyway, tools installed and I tried to build David William’s project USB to Serial, It failed fairly early in the build process, resulting in an error 142 message from yosys-abc. Despite solving various tool chain installation issues, this one was beyond me. As a check, I downloaded Lawrie Griffiths’ Tiny USB Examples which was referenced in David’s README. That project built correctly with no errors, suggesting my tool chain was correctly installed.

By this time, it was almost midnight, so I posted an issue on the github repository and crashed.

Any idea what’s going on?

Thanks,
-Chris


#2

FWIW, I’ve been able to build that project on linux with an older version of yosys, but I did some digging, and I think you may be running into this issue: https://github.com/YosysHQ/yosys/issues/1675


#3

My version is very old and was rather unstable. David’s version is much better, if you can get it working.


#4

Thanks, @kc1. That did the trick. The fix suggested in that link is a bit cryptic to the uninitiated. After a little head-scratching, I finally stumbled upon how to implemented it ( I think ). In the Makefile, edit as follows:

WAS:

yosys -q -p 'synth_ice40 -top $(PROJTOP) -json $@' $^

IS:

# See discussion here:
# https://github.com/YosysHQ/yosys/issues/1675
# https://github.com/berkeley-abc/abc/issues/68
BUGFIX = scratchpad -set abc.script +strash;ifraig;scorr;dc2;dretime;strash;dch,-f;if;mfs2

yosys -q -p '$(BUGFIX)' -p 'synth_ice40 -top $(PROJTOP) -json $@' $^

That did the trick. It at least compiled and programmed. I’m seeing the com port but no loopback. I’ll solve that tonight.

Next task - How to bring the serial data out to the real world, so I will have two logic-level serial pins to play with. That’s either going to be easy ( just connect the pins instead of looping back) , or it’s gonna be hard ( data from the module is in bytes, so I’ll have to add a UART ). Regardless, I’m having fun.

-Chris


#5

Yes, good point. I didn’t try to program it, I was just seeing if the tool chain worked (it did). Thanks.