Friday, 2019-11-29

*** tpb has joined #tomu00:00
*** CarlFK has joined #tomu00:06
ovfxobs: just in case it's of any use, here's a wireshark pcap of flashing circuitpython: http://0x0.st/zIkh.gz and lsusb -t after the fact (foboot was dev 67): http://0x0.st/zIkF.txt00:13
xobsovf: I take it from that output that circuitpython didn't work? :(00:45
CarlFKxobs: what does working look like ?00:48
CarlFKmine is flashing red right now.  but no ttyACMx00:48
xobsRed means the program failed to run.00:48
CarlFKdoh.00:48
ovfsorry, there was a netsplit around the time we complained, so you probably missed our messages: http://0x0.st/zId8.txt00:48
xobsAh, yeah, I missed those messages.00:50
xobsThat v2.0.1 doesn't persist, in case there's a bug in the USB stack and it isn't as reliable at loading programs.  Which does seem to be the case.00:50
ovfi do appreciate the fact that my fomu is still alive and well after a few rounds of this. :-)00:53
xobsIt's interesting that it enumerates properly.  And that foboot-2.0.1 appears to load reliably, but circuitpython just isn't working.00:59
ovfdoes the same setup work on your end?01:04
xobsovf: it does, and I've been testing from three different machines (two Windows machines and a Raspberry Pi).  However, I now have a situation where I can reliably load v1.9.1 from my Windows machine on top of itself and it works, but when I load v2.0.1 on and try to load something it fails.01:05
xobsWhich seems to be similar to what you're seeing.01:06
xobsUnfortunately it's electrically really weird.  Which I thought was just the USB Beagle being funky, but maybe it's something else.01:06
* xobs uploaded an image: image.png (116KB) < https://matrix.org/_matrix/media/r0/download/matrix.org/eGZSeilWrrHfNjEHcjDIeRDh >01:07
xobsThe Beagle seems to have missed a NAK packet.  Or maybe it never got sent?  At any rate, v1.9.1 works just fine even under these circumstances.01:07
ovf:-( i think the only way in which i could possibly help is to give you remote access to a linux machine with a bunch of fomus that reliably (unreliably?) didn't work, but since you could reproduce that it won't be helpful either.01:20
xobsSo I think the unreliability I'm seeing here is, in fact, caused by dodgy wiring.01:28
* xobs uploaded an image: image.png (55KB) < https://matrix.org/_matrix/media/r0/download/matrix.org/RAxHpHnJqvYuTQzsAncowSoE >01:30
xobsBecause what I see from the device side when I attach a debugger here is that the last packet the device received was 0x41 00 c0 00 ..., and it's waiting for the last 64 byte packet, but the host thinks it's sent all of the data and it's waiting for the device to respond with "ACK".01:31
xobsovf: does it always fail at the same point, or is it random?01:32
ovfokay, now i got 'error during download' from dfu-util. want a pcap? sorry i don't have a usb beagle01:34
xobsHow far along was it?01:35
ovfdfu-utils sent the last data urb, got urb_complete for it and that's the last bit of communication. interestingly dfu-util ui was showing '98%'01:37
ovf(i think it's the last packet because (1) it's 1744 instead of 4096 bytes (2) it appears to end with something like what's near the end of circuitpython.dfu)01:38
xobs...huh.  I wonder if that's the problem.  I think I spotted a bug.01:38
xobsAyep. https://github.com/im-tomu/foboot/commit/c8872c1088ca64affaa589adda6ecb39782e012e01:50
xobsLet me build a new hacker top firmware and see if that fixes it for you.01:50
ovfi'll need pvt01:50
pollois there a way to flash a new version of foboot using dfu-utils, akin to the tomu?01:53
xobspollo: there is, I've just been reluctant to release it in case there were breaking bugs.  Like the one we just discovered.01:53
polloah ok, I do see a booster dir indeed :)01:54
xobsI discovered during testing yesterday that it's probably a good idea to change the booster magic number when an incompatible bitstream is loaded.  I was having issues where the v1.9.1 bootloader would sometimes try burning the v2.0.1 firmware, which doesn't work since the SPI interface changed.01:55
polloif flashing a buggy version (and thus failing) meant I had to reflash the board using an rpi I wouldn't really mind it tbh01:56
polloas atm the only way I have is to flash the board with an rpi anyway (and it's a pita)01:56
xobsI'm building a v2.0.2 pvt image now.  It's even looking like it'll meet timing.02:02
ovfsomething's funky when running lxbuildenv in foboot: > Fetched in submodule path 'deps/valentyusb', but it did not contain 97ac21d6ea4f9b632773a833476906c1ab95a730. Direct fetching of that commit failed.02:03
ovf> error: Server does not allow request for unadvertised object 97ac21d6ea4f9b632773a833476906c1ab95a73002:03
xobsovf: sorry, forgot to push the valentyusb change.02:05
xobsTry again02:05
xobsovf: Can you grab v2.0.2 from https://github.com/xobs/circuitpython/releases/tag/v0.0.1?  I'm building hacker-foboot-v2.0.2.dfu right now.02:16
tpbTitle: Release Initial Fomu release · xobs/circuitpython · GitHub (at github.com)02:16
ovf> Adafruit CircuitPython 4.0.0-alpha-3590-ga509234-dirty on 2019-11-28; Fomu with VexRiscv02:19
xobsAwesome!02:19
ovffor future reference, how do you build the top(?) file, pvt-foboot-v2.0.2.dfu?02:19
xobsovf: I'm using the command `python foboot-bitstream.py --boot-source bios --with-debug usb --revision pvt --seed 2`, then appending a dfu-suffix to build/gateware/top.bin02:21
xobsI'm also putting together a release script.02:22
ovfcircuitpython crashes when it runs out of memory. i know i shouldn't complain because our commercial interpreter does the same, but it's just additionally annoying in my setup as i need to reflash starting from foboot2 to go back02:25
xobsThere's now a hacker-foboot-v2.0.2.dfu up for hacker users to try out02:33
ovfthanks! it's probably not related to fomu at all but i can't seem to get the usb mass storage thing to work, the files i write just disappear02:45
ovfalso it presents a couple of hid devices for some reason?02:45
xobsovf: as I understand it, you can connect to it via the serial port and just watch it. Then you can create a file called "code.py" or "main.py", and every time you save it it'll be re-executed.02:46
xobsThe various HID devices are so you can instantiate HID devices in Python and they just work.02:46
xobsThe large number of USB devices is a big reason why this couldn't be done with the old epfifo interface.02:46
ovf> If your code.py has print() statements in it, then you should be able to see the output of those statements getting printed into the serial text box.02:51
ovfno, can't get that to work02:51
xobsSorry, the `hacker-foboot-v2.0.2.dfu` was broken -- SPI flash wasn't working for some reason.  I'm regenerating it.02:51
xobsovf: are you running the serial console interactively?  I.e. does it have the ">>> " prompt?  I think that disables re-evaluation.02:52
ovfno, i'm at the 'Press any key to enter the REPL. Use CTRL-D to reload.' prompt02:54
xobshacker-foboot-v2.0.2.dfu is up now03:02
xobsI'm still rebuilding evt releases of foboot, but I'm reasonably confident in v2.0.2 that I've posted the updaters at https://github.com/im-tomu/foboot/releases/tag/v2.0.203:04
tpbTitle: Release v2.0.2: sw: dont clear OUT buffer during usb_recv · im-tomu/foboot · GitHub (at github.com)03:04
xobsIf you want to permanently move to v2.0.2, load the appropriate `updater` file.03:06
ovfcool!03:07
ovfi think there's definitely some corruption going on somewhere between python and linux vfat driver -- after one mount/umount cycle the 'lib' directory is gone and in its place is a 'mΩ' directory. almost no resistance!03:12
xobsThat definitely does sound like corruption.  What platform is this on?03:15
ovflinux, and it's standard vfat driver. if i use my trusty mtools (an alternative userspace implementation of ms-dos filesystem) all goes well.03:19
ovfyep, linux vfat seems to put things in a bad state03:20
ovfthe documentation here sounds like they at least expect it to work with linux: https://docs.micropython.org/en/latest/pyboard/tutorial/script.html03:21
tpbTitle: 2. Running your first script MicroPython 1.11 documentation (at docs.micropython.org)03:21
xobsI'm testing in Linux and it's working.  I wonder what the issue is, then.  Maybe another process running that's also writing files?03:36
xobsMaybe it's the vim backup files?03:36
xobsNeed to get input from tannewt :)03:36
ovfwell, it's rather apparent it isn't anything in your code. :-)03:46
xobsovf: but does it generally work alright?  Aside from msc corruption weirdness.  As in, it hasn't broken anything permanently?03:46
ovfwhat are some examples of things it could break permanently?03:46
xobsThe only thing I could think of is if you exceed the SPI flash and it wraps around.  E.g. writing all zeroes to the disk.  But that hasn't happened on mine, so it's unlikely to happen anywhere else.03:48
ovfhm, looking at the (virtual) flash, the contents of my file are there (actually twice), but it isn't present in the fat (directory table) after a reboot03:49
ovfanyway, i should rather address this to the micropython folk (and i'm not in the target audience anyway)03:50
xobsI was seeing that, too.  I also just wrote all zeroes to the drive, and for some reason each sector starts out with `bf d0`, which makes me think that might be where the corruption is.03:50
xobsI'll investigate that issue, and once I've solved it I'll make an annoucement on Twitter.03:51
ovfone benefit of having laptop's internal storage on a (rather slow) emmc is that my / is /dev/mmcblk*, so i can't mix it up with /dev/sd* when zeroing out things03:53
ovfafter zeroing i'm seeing alternating 0x00 and 0xff sectors04:00
xobsWell that could be the cause of some corruption problems.04:00
xobsOn my EVT board I see sectors starting with `bf d0`, but I don't see that on the actual flash itself.  Which means that zeroes are actually getting written, but it's most likely the read command that's faulty.04:02
ssb[    1.154000] usb 1-2: Product: Fomu PVT running DFU Bootloader v2.0.204:04
ssbseems to work )04:05
*** xkapastel has joined #tomu04:09
*** nrossi has joined #tomu04:21
xobsssb: hooray!04:40
xobsOkay, weird.  Looking into it some more, circuitpython doesn't write sector 0, and subtracts 1 from every sector it writes. Kinda makes sense, I guess.  Though that was really throwing me off here.04:40
CarlFKxobs: dfu-util -D hacker-foboot-v2.0.2.dfu and then circuitpython.dfu  I have red blinking06:06
xobsCarlFK: So you load hacker-foboot-v2.0.2.dfu, and it just stops working entirely?  And when you unplug it and plug it back in, what does it show up as?06:07
CarlFKfoboot seems ok, loading circuitpython  makes it go red06:08
CarlFKwhat is the command that might power cycle my usb port if it has power control?06:09
xobsSo you plug Fomu in, then load `hacker-foboot-v2.0.2.dfu`, then without unplugging it load `circutpython.dfu`.  After doing the second load, it blinks red?06:10
CarlFKyes06:10
xobsWhat does `dfu-util -l` show after you load `hacker-foboot-v2.0.2.dfu`?06:11
CarlFKFound DFU: [1209:5bf0] ver=0101, devnum=25, cfg=1, intf=0, path="3-3", alt=0, name="Fomu Hacker running DFU Bootloader v2.0.2", serial="UNKNOWN"06:12
xobsWhat's the md5sum of your `hacker-foboot-v2.0.2.dfu`? `9e553539b8ca3dab8120554e54123398  hacker-foboot-v2.0.2.dfu`06:13
CarlFK9e553539b8ca3dab8120554e54123398  hacker-foboot-v2.0.2.dfu06:13
CarlFKhttp://paste.ubuntu.com/p/RmSB9cm99z/    all the spew06:14
tpbTitle: Ubuntu Pastebin (at paste.ubuntu.com)06:14
xobsAnd it's not showing up when you do `dmesg`?06:14
CarlFKdmesg http://paste.ubuntu.com/p/kD6XyVrgNM/06:17
tpbTitle: Ubuntu Pastebin (at paste.ubuntu.com)06:17
xobs`[191766.743339] usb 3-3: new full-speed USB device number 14 using xhci_hcd` <-- that might be it starting to enumerate.  Hmm...06:20
CarlFKhmm, v1.9.1 (what I get on power) dfu-util -D micropython-fomu.dfu  ... goes red06:20
CarlFKI thought that worked ... a few weeks ago06:20
CarlFKwelp...  I just tried micropython from fomu-workshop on 5 fomu's - all have 1.9.1, all went red06:39
xobsCarlFK: interestingly, I just had an instance of it refusing to accept an address during enumeration.  Though it worked when linux retried with a different address...06:39
CarlFKxobs: is it safe enough to assume that if I can load the 2.0.2 boot loader my dfu-util and local usb stuff is not causing problems ?06:49
CarlFKor is there something else I can do to test that assumption06:49
xobsCarlFK: Can you try loading the v2.0.2 boot loader on top of itself?06:50
xobsThen, unplug Fomu and plug it back in and run `dfu-util -e`.  You should still get v2.0.2 that way.06:51
xobsThat'll test that it can actually write to SPI flash.06:51
CarlFKxobs: that worked06:53
xobsHmm... I loaded circuitpython onto my hacker board, and I just discovered that it blinks red slowly when I load circuitpython, because I forgot hacker boards don't really have a blue color.06:55
CarlFKlol06:56
* xobs uploaded a video: VectorVideo_2019-11-29_025541.mp4 (722KB) < https://matrix.org/_matrix/media/r0/download/matrix.org/BkPlqpOeusprAjjbkHJuegiq >06:56
* xobs uploaded a video: VectorVideo_2019-11-29_025652.mp4 (1492KB) < https://matrix.org/_matrix/media/r0/download/matrix.org/XOyQtKLJwmDTTnAXxAAqgVle >06:57
xobs(make one that's slightly longer).  Both boards are running circuitpython.06:58
CarlFKthat looks like how mine flashes06:59
CarlFKbut no ttyACMx in /dev or dmesg07:00
xobsThe interesting thing is that the last line of the dmesg you sent shows something connected on usb.07:01
CarlFKoh oh.. that may have been because I un/plugged it07:02
xobsIt happend four seconds after the circuitpython upload finished.07:03
CarlFKok I don't think I did anything that fast07:05
CarlFKim using a usb-3 port, that shouldn't matter, right ?07:08
xobsIt shouldn't, but that's a good thought.  I'll test on my Linux server to see if I can't reproduce that issue.07:10
CarlFKhmm, I got micropython on fomu on this box about 3 weeks ago, but I can't now.07:13
CarlFKxobs: can I upload foboot 2.0.2 so it persists?07:40
xobsCarlFK: Sure, you can load the `updater` file from https://github.com/im-tomu/foboot/releases/tag/v2.0.207:41
tpbTitle: Release v2.0.2: sw: dont clear OUT buffer during usb_recv · im-tomu/foboot · GitHub (at github.com)07:41
CarlFKthat worked07:50
CarlFKlets try turning off my laptop...07:50
*** CarlFK has quit IRC07:50
*** CarlFK has joined #tomu07:54
CarlFKno help.07:59
CarlFKI'm out of ideas.  maybe sleep will help ;)07:59
xobsAlright, I'll poke at it some more.07:59
xobsI'm trying to fix the spi flash layer in circuitpython now.07:59
xobsGoodnight!  Thanks for testing.08:00
CarlFKsure thing08:03
*** whatnick has joined #tomu10:19
whatnickHi all10:20
whatnickSetting up Litex buildenv for ECP5 ( to work with OrangeCrab), mithro do you have profile for this.10:21
miekwhatnick: have you seen https://github.com/gregdavill/OrangeCrab/tree/master/gateware/litex_ddr3_test ?10:42
tpbTitle: OrangeCrab/gateware/litex_ddr3_test at master · gregdavill/OrangeCrab · GitHub (at github.com)10:42
whatnickmiek yep attempting to build it but I don't have migen/litex setup outside litex buildenv10:43
xobsFound the source of the file corruption: https://github.com/hathach/tinyusb/commit/26dcc19b186a85f6ee8d1d94bb672e34865f56e910:58
xobsAlso, for some reason it's not working on my Intel Linux machine. So that's a repro from CarlFK I think.11:08
_florent_whatnick: here is how it can be set up without using litex buildenv: https://github.com/enjoy-digital/litex/blob/master/.travis.yml11:47
tpbTitle: litex/.travis.yml at master · enjoy-digital/litex · GitHub (at github.com)11:47
_florent_then you just need to install the toolchain (Diamond or Yosys/Nextpnr)11:48
whatnick_florent_ I have made progress but my diamond is flaky : https://twitter.com/whatnick/status/1200377290120560640/photo/111:48
whatnickOr actually I have different version of diamond to what is hardcoded in  build_top.sh11:49
whatnickworking out where/how to change that11:49
whatnick_florent_ This is where I am now at a segfault : https://twitter.com/whatnick/status/1200384863326466048/photo/1 calling it a night12:05
daveshahThis is a known issue with Diamond where /bin/sh isn't bash12:05
daveshahchanging the shebang in the scripts in synpbase/bin to /bin/bash should fix that12:06
whatnickWoo getting close12:23
whatnickCool recreated the symlink possibly breaking WSL , but i don't care :D12:26
whatnickdaveshah lots of stuff happened after shell relink and now I have another segfault12:31
whatnickdaveshah: seen this before ? BitDatabase.cpp:27: Trellis::ConfigBit Trellis::cbit_from_str(const string&): Assertion `s[idx] == 'F'' failed.12:53
whatnickI remember a conversation a while ago about line ending etc. in bitstream files and interaction in WSL12:53
daveshahYeah, you probably need to dos2unix the database files12:56
whatnickbefore or after prjtrellis install ?12:58
whatnicki.e. where are the said files ?13:00
daveshahIn prjtrellis/database, then reinstall13:08
daveshahIf you git clone inside wsl using Unix git, then it shouldn't be a problem in any case13:08
whatnickI have autocrlf set in my git which causes trouble :D13:09
whatnickAnyway ...13:09
whatnickgetting close ran dos2unix and reinstalled13:09
whatnickAs I say it is 2019 and we are still tripping over line endings13:09
whatnickYay nextpnr-ecp5 is built13:20
TomKeddiewhatnick: try following the stuff in the supercon badge notes perhaps?  https://github.com/Spritetm/hadbadge2019_fpgasoc/blob/master/doc/toolchain-lin.md13:29
tpbTitle: hadbadge2019_fpgasoc/toolchain-lin.md at master · Spritetm/hadbadge2019_fpgasoc · GitHub (at github.com)13:29
whatnickFirmware is built for OrangeCrab .. now finally to bed and wil load it tomorrow :D13:35
*** whatnick has quit IRC13:50
*** emeb has joined #tomu14:36
xobsAlso, I figured out what was wrong with v2.0.2 on some machines, particularly with CarlFK : https://github.com/im-tomu/valentyusb/commit/b262b994fd9e6568b257b8424fe808cfc403e65214:49
tpbTitle: eptri: use EventSourceProcess to signal usb reset · im-tomu/valentyusb@b262b99 · GitHub (at github.com)14:50
xobsI'll build v2.0.3 for people to try out tomorrow!14:50
tannewtget it all going xobs?15:06
xobstannewt: just about. It's been a very buggy day.15:10
tannewtwhat are you trying to hunt down?15:13
xobsmost of the day was spent trying to figure out why MSC stuff was corrupted. That was due to a bug in the way multiple OUT packets were handled. Then there was a bug in foboot where we were throwing away data in an OUT buffer.15:15
xobsNow I've just found out that the RESET signal was actually level-triggered and not edge-triggered, which locked up the CPU for the whole duration of a USB reset.15:16
xobsThings are much better now :)15:16
tannewtnice! great to hear you are making progress15:19
xobsIs the heap size fixed based on a macro, or calculated at startup?15:23
*** emeb has quit IRC15:31
*** emeb has joined #tomu15:32
xobsThere.  New release for people to try! https://github.com/xobs/circuitpython/releases/tag/v0.1.0-fomu15:46
tpbTitle: Release v0.1.0-fomu: Beta Release 1 · xobs/circuitpython · GitHub (at github.com)15:46
CarlFKxobs: Adafruit CircuitPython v0.1.0-fomu on 2019-11-29; Fomu with VexRiscv16:36
CarlFK16:36
CarlFK\o/16:36
CarlFKcarl@twist:/media/carl/CIRCUITPY$ cat code.py16:39
CarlFKprint("fomu!")16:39
CarlFK>>> import code  ... OSError: [Errno 5] Input/output error16:39
CarlFKi'm off to breakfast16:42
*** nrossi has quit IRC21:04
*** xkapastel has quit IRC21:19
tannewtxobs, it is calculated at start up. basically all the space between static data and the stack limit22:18
*** CarlFK has quit IRC22:29
*** CarlFK has joined #tomu22:30
CarlFKxobs: >>>   I hit ^d... soft reboot; Auto-reload is on. Simply save files over USB to run them or enter REPL to disable. ; code.py output:OSError: [Errno 5] Input/output error22:41
*** im-tomu has left #tomu22:41
*** im-tomu has joined #tomu22:41
CarlFKhmm, rm code.py; touch code.py.. ^d no error.22:58
CarlFK>>> f=open('code.py'); f.read()22:59
CarlFK''22:59
CarlFKif code.py is 'x=1' then OSError23:00
*** emeb has quit IRC23:50

Generated by irclog2html.py 2.13.1 by Marius Gedminas - find it at mg.pov.lt!