Thursday, 2022-08-04

openpowerbot[slack] <Ganesan Narayanasamy> https://www.linkedin.com/posts/ganesannarayanasamy_semiconductor-technology-semiconductor-activity-6960785036795142144-IgKs/?utm_source=linkedin_share&utm_medium=member_desktop_web06:18
fitzsimI was simulating Microwatt natively on ppc64le, following the README06:52
fitzsimwhen I tried MicroPython master tip, the simulator would not accept input on standard input (stdin)06:53
fitzsimI traced it down to a 16550/Potato UART incompatibility, I think06:53
fitzsimwhen I change UART0_IS_16550 from true to false in soc.vhdl, it works06:54
fitzsimeven without that change, the checked-in prebuilt micropython firmware does work06:55
fitzsimits git revision reports "-dirty" though, and the commit message says that it has added 16550 support06:55
fitzsimis that support checked into a MicroPython fork somewhere?06:55
fitzsimI think the instructions in microwatt/README.md will produce a MicroPython with a Potato UART, which will fail06:56
fitzsimso either README.md should be updated, or 16550 support should be upstreamed to MicroPython?06:57
fitzsim(this is assuming there's some reason to prefer 16550 overall, since potato does seem to work, but is commented "legacy" in soc.vhdl)06:58
openpowerbot[slack] <joel> I think using the 16550 in micropython makes sense. Most of the testing with microwatt is done with that uart; the potato was used before we had the 16550 hardware06:58
fitzsimOK; is there an option in micropython to build with 16550 support?06:59
openpowerbot[slack] <joel> see f03d030080ccf89c6ad677c818c949c3bd71ec3706:59
openpowerbot[slack] <joel> (in micropython)07:00
fitzsimfound it; I did see the lpc_serial vs potato flag07:00
fitzsimbut neither worked; lpc_serial said it was for QEMU, and didn't seem to produce output, even07:01
fitzsimlet me try again here, with UART=lpc_serial (does that mean 16550?)07:02
openpowerbot[slack] <joel> The lpc uart is the 16550 register layout. However you will need to correct the base address07:02
fitzsimah, OK07:02
fitzsimthat's what the -dirty is about then07:02
openpowerbot[slack] <joel> > ports/powerpc/uart_lpc_serial.c:#define UART_BASE       0xc000200007:02
openpowerbot[slack] <joel> We would need a way to tell micropython where the uart address is. That could be at build time, or we could add device tree support.07:05
openpowerbot[slack] <joel> The hard coded address is for the powernv qemu machine (I think)07:05
fitzsimwhat you pasted is the UART_BASE that I currently have07:06
fitzsimI'll check what the correction should be07:06
fitzsimoutput does work, input doesn't07:06
fitzsimoh, forgot the option (it's late)07:06
fitzsimone sec, retrying07:06
openpowerbot[slack] <joel> Ah. That address **is** the microwatt address07:07
fitzsimfrom what I can tell, just building micropython with "make -j64 UART=lpc_serial" causes "./core_tb >/dev/null" to not produce any serial output output07:09
fitzsims/output output/output/07:09
openpowerbot[slack] <joel> Is that because the simulation uses the potato uart?07:12
fitzsimI think the simulation is wanting 16550, not potato07:13
fitzsimyeah, I reverted my UART0_IS_16550 hack07:13
fitzsimso I'm on microwatt 76a7b98840c836fab866864d3fc277af80f4c625, unmodified07:14
fitzsimit should be easy for someone else to try to see if my env is messed up somehow07:14
fitzsimjust follow the microwatt's README.md, but instead of using the pre-built micropython, build it from source (I'm on micropython 579f330508e4ba46f4a71193582c36bdf7aa56bd)07:15
fitzsimthe latest commit for the pre-built micropython says "tests: Add updated micropython build with 16550 support"07:18
fitzsimwhen simulated, that reports "MicroPython v1.12-571-g16d6cb7f7-dirty on 2020-06-23; bare-metal with POWERPC"07:19
fitzsimI tried to rebuild that same version (v1.12-571), but I don't know where 16d6cb7f7 is, nor what local change caused "-dirty"07:24
openpowerbot[slack] <joel> Probably on Ben's old laptop 🙂07:25
fitzsimwhen I build v1.12-571, with UART=potato (the default), I get serial port output, but serial port input is not accepted07:25
fitzsimand same version, with UART=lpc_serial I get no serial port output (and presumably the serial port doesn't accept input either, though I can't tell)07:26
fitzsimdarn, is there hope that the laptop hasn't been decommissioned? ;-)07:27
fitzsimor maybe Ben pushed some MicroPython changes to a repo on the Internet somewhere?07:27
fitzsimanyway, have to retire for the evening, thanks for the help!07:28
openpowerbot[slack] <Paul Mackerras> @Benjamin Herrenschmidt might be able to comment...07:28
openpowerbot[slack] <joel> https://github.com/ozbenh/micropython/commit/b2b7eafe2c83e7094a9194d38e67c4fa565ddf7c07:29
openpowerbot[slack] <joel> He didn't like the change to make it build time configured, iirc07:30
openpowerbot[slack] <joel> @Paul Mackerras do we still use potato in any situations? Simulation?07:30
fitzsimok, trying...07:31
openpowerbot[slack] <Paul Mackerras> @joel not sure, maybe07:31
openpowerbot[slack] <Paul Mackerras> It looks like core_tb doesn't use potato; soc.vhdl defaults UART0_IS_16550 to true and core_tb.vhdl doesn't change that07:33
fitzsimyes, powerpc tip of that repo works, with just "make -j64"07:33
fitzsimlooks like Ben removed the UART flag07:33
openpowerbot[slack] <Paul Mackerras> I can't find any situation where we still use the potato uart...07:39
fitzsimwill post a patch...07:39
fitzsim(just a suggestion; upstreaming something to MicroPython would be better)07:39
openpowerbot[slack] <joel> The problem with ben's patch is if you load microwatt from u-boot (or another bootloader), r3 will be set and it will assume qemu07:40
openpowerbot[slack] <joel> That's why I made the change (that he reverted) in upstream micropython in the first place07:40
openpowerbot[slack] <Benjamin Herrenschmidt> oh my I don't remember any of that 🙂07:41
openpowerbot[slack] <joel> So a proper fix is to finish off `init_devicetree` from his patch, have it parse the device tree and configure it07:41
fitzsimhttp://paste.debian.net/plain/124928107:41
openpowerbot[slack] <Benjamin Herrenschmidt> can't we just kill potato ?07:41
openpowerbot[slack] <Benjamin Herrenschmidt> and make everything use the UART ?07:41
fitzsimok, makes sense07:41
openpowerbot[slack] <joel> Yes, lets do that. Still need to detect microwatt vs qemu somehow, to work out the base address07:42
fitzsimlpc_serial seemed to be the same UART base address07:42
fitzsim#define POTATO_UART_BASE                    0xc000200007:43
openpowerbot[slack] <joel> #define QEMU_UART_BASE 0x60300d00103f807:43
fitzsim#define UART_BASE       0xc000200007:43
fitzsimoh, there's also #define LPC_UART_BASE   0x60300d00103f8 yeah07:43
fitzsimdid read that far07:43
fitzsim*didn't read that far07:43
fitzsimok, have to drop now; I'll try the README instructions again sometime; thanks again for the help07:45
openpowerbot[slack] <joel> No worries. Thanks for pointing out the broken bits07:45
openpowerbot[slack] <joel> We could read the pvr, as a hack07:45
openpowerbot[slack] <Paul Mackerras> @Matt Johnston how do you load a program (ppc64le elf binary) into the SPI flash on the orange crab? dfu-util, or do you have a way to do it over jtag with openocd or something?11:02
openpowerbot[slack] <Paul Mackerras> dfu-util shows two partitions, one starting at 512k in the flash and the other starting at 1MB. However, the dram init code looks for something at the 4MB point...11:02
openpowerbot[slack] <Matt Johnston> yeah, usually I use ecpprog via jtag with a ft232h board. my recollection is that the alternate partition for dfu on the orangecrab dfu firmware doesn't work anyway12:21
openpowerbot[slack] <Matt Johnston> @Paul Mackerras yeah, usually I use ecpprog via jtag with a ft232h board. my recollection is that the alternate partition for dfu on the orangecrab dfu firmware doesn't work anyway12:23
* fitzsim may buy a Butterstick board15:20
fitzsimhave people make Linux networking work with its Ethernet port yet?15:20
openpowerbot[slack] <Matt Johnston> yep, was using it today15:32
fitzsimcool, will buy one; they seem to actually be in stock15:34
openpowerbot[slack] <Matt Johnston> a https://store.groupgets.com/products/syzygy-breakout-board-for-butterstick is useful to be able to connect a serial console - the butterstick itself doesn't have gpio pins15:40
fitzsimyeah, that was in my cart too, will include that in the order, thanks15:55

Generated by irclog2html.py 2.17.1 by Marius Gedminas - find it at https://mg.pov.lt/irclog2html/!