Sunday, 2020-06-14

*** tpb has joined #litex00:00
tpearson-mobileI'll try the base class approach, though doesn't Python let you override an internal variable of a base class unlike C?00:01
tpearson-mobile*C++?00:01
awordnotit does, but looking closer, it seems like CSRStorage/Status will split multi-word variables into bus-sized words, which apparently is 8-bit by default for CSR. Looking into how to set CSR to 32-bit...00:02
tpearson-mobileand "You can zpecify 32-bit wide CSRs but you’ll probably run into compatibility issues with other IP librariers that have hard-coded the 8-bit assumption." -- I'm just shaking my head here.  If 32-bit access is allowed, those libraries should be considered to have a bug, not force all of LiteX into a funky sparse address layout00:02
somlotpearson-mobile, awordnot: on the litex target build command line, add `--csr-data-width=32` :)00:03
tpearson-mobileno modern CPU operates at a byte level for bus access; I'm trying to figure out where in the world that idea came from...00:03
awordnotaha, thank you somlo00:03
tpearson-mobileany way to force it in the target .py file?00:03
somlopython then generates a set of "accessors" in <build-directory>/software/include/generated/csr.h00:03
tpearson-mobilesomlo: yes, I saw that, but those are dozens of instructions each00:04
tpearson-mobileon a 75MHz CPU00:04
tpearson-mobilein a heavily used transfer path00:04
somlothat either gather (via shift and or operations) the 8-bit values scattered all over the address space, or read 32 bits at a time, depending on the csr-data-width used00:04
tpearson-mobiledoesn't seem like the best idea :)00:04
somlosometimes you have wider-than-32-bit registers, in which case you still have to shift-and-or, but 32 bits at a time instead of 8 :)00:05
awordnottpearson-mobile: add 'csr_data_width=32' as a parameter to SoCCore.__init__ in your SoC class to set the default00:05
tpearson-mobilegreat, thanks!00:05
somloright now, the behavior is best described by https://github.com/enjoy-digital/litex/blob/master/litex/soc/software/include/hw/common.h00:06
tpbTitle: litex/common.h at master · enjoy-digital/litex · GitHub (at github.com)00:06
tpearson-mobilesomlo: is there some CPU that LiteX uses that has the capacity for byte read/write?00:06
somlothere's various declarations of intent to clean that up (e.g., make 32-bit the default instead of 8, tinker with the endianness of how larger-than-8bit CSRs would be stored, etc.)00:07
somlobut for now, that's how it works :)00:07
tpearson-mobilebecause it just seems weird -- only microcontrollers and some legacy (really *really* legacy) CPUs like x86 have that functionality00:07
tpearson-mobileOK00:07
tpearson-mobile(in fact I don't even know if modern x86 still does byte read or if these days it does a 32 bit or higher read discarding the extra bits behind the scenes00:08
awordnotI don't think anything in LiteX does native 8-bit CSR reads. As far as I can see all CSR accesses go through a Wishbone bridge with a 32-bit width00:09
somlothe wishobone and axi bus protocols support byte strobes, so an 8-bit access would be a 32 or 64 bit access with all but one bytes strobed out00:09
tpearson-mobileOK, so it is just as bad / weird as I thought :)00:09
tpearson-mobileoh well00:09
tpearson-mobileat least it can be overriden00:09
tpearson-mobile*overridden00:09
somlothe CSR bus did not historically support a strobe, there's another plan in the works to teach it to deal with strobes, which would probably fix a lot of issues, no idea at what expense in terms of added "gateware"00:10
awordnotis there any reason that CSR needs to be its own bus instead of just exposing the registers to wishbone? maybe resource utilization?00:11
somlothat's a question for _florent_ (I've mostly tried to get how things work in order to use them, don't have the context for how/why they came to be the way they are)00:12
awordnotsure, fair enough00:13
mithro@awordnot - Resource usage00:23
mithro@awordnot Wide buses which run to lots of peripherals inside the FPGA cost a lot of resources00:24
awordnotmithro: hm. But if the CSR data width was set to 32-bit then there wouldn't be that much of a difference?00:24
tpearson-mobileI have a couple of additional questions if you all don'd mind.... :)00:41
tpearson-mobileHow are IRQs handled?00:41
tpearson-mobileThe peripheral I'm gluing in has an IRQ line that I'd like to tie to a distinct IRQ (don't care which number) on the CPU00:41
tpearson-mobileOther question is what is the absolute simplest way to run a small C program from internal ROM?00:42
tpearson-mobilebenh: On the bootloader console for Microwatt, is the CPU running in BE mode?00:43
tpearson-mobileeither it's BE or I've got the byte ordering swapped in the 32 bit CSR stuff :)00:43
awordnotthe microwatt doesn't support BE at all yet afaik00:43
awordnotit enters at 0x0 with MSR[LE] set00:44
tpearson-mobilehrm, so it seems when I put the CSR into 32 bit mode the bytes are swapped around00:44
awordnothow are you reading the register? using the generated wrapper?00:44
tpearson-mobileno, "mr <address>"00:44
awordnotand the resulting byte dump has the most significant byte first?00:45
tpearson-mobileLSB first....actually, brain cramp! :D00:45
awordnotheh00:45
tpearson-mobilesorry, I got real used to debugging some of the IBM hardware that runs in BE mode00:45
tpearson-mobileI think we're good00:46
awordnothappens to all of us :)00:46
tpearson-mobilerubber duck debugging FTW... ;)00:46
tpearson-mobile(most of which is restating the "problem" in a way that makes one actually think for a sec)00:46
awordnotas for running custom bare-metal C code, this is a good template: https://github.com/litex-hub/fpga_101/tree/master/lab004/firmware00:46
tpbTitle: fpga_101/lab004/firmware at master · litex-hub/fpga_101 · GitHub (at github.com)00:46
tpearson-mobilethanks00:47
tpearson-mobileIRQs then are the only other question00:47
awordnotthat unfortunately I'm not sure about00:47
tpearson-mobileI've heard Microwatt may not have IRQ support, but regardless there has to be a way to at least expose them to the Wishbone bus00:47
tpearson-mobile(and on that topic, I've heard there is a potential for the interrupt controller to be XIVE compatible -- that would be really nice)00:48
tpearson-mobilebenh: ^^00:48
awordnotit looks like interrupts are done by using the CSR EventManager: https://github.com/enjoy-digital/litex/blob/master/litex/soc/interconnect/csr_eventmanager.py00:49
tpbTitle: litex/csr_eventmanager.py at master · enjoy-digital/litex · GitHub (at github.com)00:49
awordnotyou can see how the UART core uses it: https://github.com/enjoy-digital/litex/blob/master/litex/soc/cores/uart.py#L20300:51
tpbTitle: litex/uart.py at master · enjoy-digital/litex · GitHub (at github.com)00:51
tpearson-mobileawordnot: hrm.  if my Verilog module has an IRQ line (it could be either level or edge triggered, I don't care), how would I use that then01:00
tpearson-mobile?01:00
awordnottpearson-mobile: so you'd create an EventManager submodule, then add the appropriate EventSource for the type of triggering you want. Then you just pass the source's .trigger property to your verilog to use01:02
tpearson-mobilehmmm, OK.  No examples online, right?  We're dealing with one unknown already (whether Microwatt even has IRQ support), and without a working example that's adding a second unknown that will make debugging quite "fun" ;)01:03
awordnotother than the UART I linked, I can't find any more minimal examples01:04
awordnotmaybe temporarily switch the soc to something that's known to support interrupts (like VexRiscv) to test?01:04
tpearson-mobileI guess for a simple test program that's reasonable (ish), though to be honest I have no idea how RISC-V handles interrupts in the first place.  Hence why POWER is the target :)01:11
tpearson-mobile(well, it's a lot more than that, the IRQ bit is just the tip of the iceberg -- we're very much set up to handle POWER systems with near-zero experience with RISC-V01:11
awordnotI believe litex provides a C abstraction layer for that, which should be sufficient for simple tests without having to actually write risc-v specific code01:11
futarisIRCcloud8-bit CSR stuff is a weird one, but done that was to save on resource usage, sort of makes sense.01:11
awordnotbut yeah, I see where you're coming from01:11
tpearson-mobileoh, that'd be useful01:12
tpearson-mobilesome kind of IRQ test code?01:12
awordnottpearson-mobile: see the isr_* functions here: https://github.com/enjoy-digital/litex/blob/master/litex/soc/software/libbase/uart.c#L10501:13
tpbTitle: litex/uart.c at master · enjoy-digital/litex · GitHub (at github.com)01:13
awordnotthat example C project I pasted links against those functions, so you can use them to set up ISRs01:14
tpearson-mobileOK01:14
tpearson-mobile...thanks!  lots to digest01:15
awordnotyou're welcome :)01:15
tpearson-mobilebenh: am I correct in assuming the IRQ status is "not working" for Microwatt"?01:15
futarisIRCcloudI suspect so. Best to try to get that IRQ stuff working in Renode first...01:16
tpearson-mobilewhat would be needed to add IRQ support?  Is it LiteX-specific or more of a general "the CPU doesn't have support"?01:17
benhtpearson-mobile: we have embryonic irq support01:22
benhwe plan to beef it up asap to support liteeth01:22
benhat the moment, level interrupts only, we need to add masking support, the problem is Linux requires on FW to do that on xics01:22
benhwe need to either add a "native" backend to linux or add a mini-fw layer01:23
tpearson-mobilebenh: I can probably help with at least the firmware bits01:23
awordnotOPAL-microwatt :)01:23
tpearson-mobileI've done work with OPAL / skiboot alrady01:23
tpearson-mobileyeah01:23
benhwell, I created OPAL :)01:23
tpearson-mobileah, right :D01:23
tpearson-mobilemy bad01:23
benhit would be easier/faster to put a native backend in linux01:23
awordnotfor OPAL, BE support would need to be added too, yeah?01:23
benhalso our interrupt controller isn't in LiteX yet, I plan to work on that too01:24
benhawordnot: probably... not hard though01:24
awordnotyeah, I'd imagine so01:24
benhwe have the swappers already for the byte-reverse load stores, we need to add them to the icache01:24
benhthe problem is the icache has tight timing path and so has the decoder01:24
tpearson-mobilebenh: OPAL gets us some other things though, right?01:24
benhdepends...01:24
tpearson-mobileIIRC all the power management is through OPAL?01:25
tpearson-mobilei.e. power off / reboot etc.?01:25
tpearson-mobileI don't know if we want to completely lose the abstraction01:25
awordnotdon't OPAL power management calls just forward to the BMC though?01:25
tpearson-mobileat the moment, but the whole point is that it could change behind OPAL without the kernel caring01:26
awordnotyeah true - I'm just not sure how closely coupled the API is to the existing implementation01:26
tpearson-mobileregardless, it's a published standard sort of like some of the ACPI calls01:27
benhthere is no such thing as power management in microwatt today :-)01:27
tpearson-mobileI dunno -- benh might know more the risks / benefits of Yet Another Interface vs. just extending OPAL01:27
benhoh I don't mind doing a mini-opal or a mini-rtas, been thinking about it01:28
tpearson-mobilepersonally I see too much interface bloat in POWER already01:28
benhwe would need to add BE support or define a LE variant of OPAL01:28
benhbbl01:28
tpearson-mobilesure01:28
tpearson-mobilewe have two separate interrupt controllers, OPAL (PowerNV), the older interface before PowerNV01:29
tpearson-mobileI'm not sure adding yet another is good for POWER overall :)01:29
awordnoti wonder if it'd be feasible to add an opal no-op backend to linux (i.e. all OPAL calls just forward to regular kernel function calls)01:30
awordnotnot sure how elegant that would be though :P01:30
tpearson-mobileawordnot: well, IIRC OPAL at its core is just a set of functions that can be called by the kernel01:33
tpearson-mobilehow about just a set of functions in the OPAL table that basically don't do much?01:33
tpearson-mobileshouldn't be too hard01:34
awordnoti'm not sure about ABI differences and you'd have to disable the endian swap but yeah that's basically what i'm envisioning01:34
tpearson-mobilewell, ABI can be worked around, does the kernel itself do the endian swap?01:36
tpearson-mobileregardless it'd be better to just add BE support to Microwatt since it increases compliance in the first place01:36
awordnoti think the kernel itself does the swap, yeah01:36
tpearson-mobileyeah, so extending Microwatt to add BE is probably the best option01:37
awordnotand I agree, BE support needs to be added one way or another eventually01:37
tpearson-mobilebenh: when you get back....this nascent support, if all I'm wanting to do is make sure an IRQ I'm asserting from a peripheral has made its way over to Microwatt, is it sufficient (i.e. bare metal test program)?01:40
benhtpearson-mobile: there's two interrupt controllers on ppc64 today (there was 3 but I think we took out openpic)01:50
benhxics and xive01:51
benhthere are several interfaces on top of them...01:51
benhwe currently implement a mini-xics (though it's somewhat incomplete)01:51
benhxics in linux supports 2 interfaces: via opal FW or via RTAS FW01:51
benhbut it would be trivial to add a simple native one to the source controller01:51
tpearson-mobilebenh: right, and to be honest it's quite a mess right now for not much of a good reason.  I don't want to see yet another interface added, since we're starting to go toward RISC-V style "each SoC acts completely different and needs its own special kernel" territory01:52
benh(we do native for the interrupt presentation, it's for source control that we go through fw)01:52
benhyeah but on the other hand, directly poking at a native ICS is about half a page of code01:52
benhwe could do a mini-opal or a mini-rtas though ... the latter would require adding 32-bit support though :-) let's not go there01:52
tpearson-mobileP10 will use OPAL / XICS right?01:53
benhadding BE is not hard provided we can make timing in the icache01:53
tpearson-mobilelike P9 does?01:53
benhprovided IBM doesn't kill native linux completely01:53
benhopenpower doesn't look good at the moment... but I don't have insider info01:53
benhP10 is XIVE like P901:53
tpearson-mobileXIVE, OK01:53
benhbut XIVE is a much much bigger beastm we are nowhere near supporting something like that in mw01:53
benhxics is a lot simpler01:53
tpearson-mobilemakes sense01:54
benhbut linux doesn't care which one you have, it's orthogonal to the CPU ISA01:54
tpearson-mobileright01:54
tpearson-mobileI know P9 at least does fall back to XICS somehow01:54
benhnot really01:54
benhthe hw is just xive01:54
tpearson-mobileah, OK01:54
benhI just hacked a "XICS-like" interface in OPAL on top of XIVE :-)01:54
tpearson-mobilegotcha01:54
benhbcs it took a long time to get full proper XIVE going, it's ... a beast01:54
benhpowerful but complex01:55
tpearson-mobileyeah, I guess the main point is XICS isn't going *anywhere* in the mainline kernel01:55
tpearson-mobileit's kind of the equivalent to the legacy IRQ stuff still in x8601:55
benhright, but then getting things in mainline isn't hard either :)01:55
benhI think long run supporting opal is the way to go01:55
tpearson-mobileyeah, same01:55
benhso we can use the powernv platform rather than a custom microwatt platform01:55
tpearson-mobileexactly01:55
benhthat said there are bigger issues at hand and we are massively out of topic for #litex :-)01:56
tpearson-mobilethat was one of the thinks we liked about OpenPOWER/PowerNV01:56
tpearson-mobileah01:56
tpearson-mobilerecommended place to continue discussion?01:56
benhhint: we don't have an FPU or a vector unit :_)01:56
benhopenpower slack ?01:56
benhand our toolchain more/less requires them...01:56
tpearson-mobileyeah, so on that topic...there's something in the works to do a major push to fix that stupidity01:56
tpearson-mobiletoolchain wise01:56
benhok01:57
benhI have to go, sunday & sunny, time to get my a** out of the appartment :)01:57
tpearson-mobilebasically we all got sloppy with IBM as the only vendor making parts, and it has to be corrected for ... reasons ... not just Raptor desires01:57
tpearson-mobilesure01:57
tpearson-mobilecan we set up a time to chat more?01:57
tpearson-mobileI'm CDT here01:57
tpearson-mobileso it's basically 9PM01:57
benhuse slack, we can find times or just leave messages for async rpelies01:57
tpearson-mobileOK01:58
tpearson-mobilewill ping there01:58
tpearson-mobilethanks!01:58
benhnp01:58
*** tpearson-mobile has quit IRC01:59
*** Degi has quit IRC02:26
*** Degi has joined #litex02:26
*** CarlFK has quit IRC02:35
*** HoloIRCUser has joined #litex04:19
*** HoloIRCUser2 has quit IRC04:23
*** tcal has quit IRC05:29
*** tcal has joined #litex05:41
*** miek has quit IRC06:06
*** miek has joined #litex06:07
*** kgugala_ has joined #litex06:52
*** kgugala has quit IRC06:54
*** tcal has quit IRC07:45
ronyrushi, is there a standard way to implement a sticky bit, clear on read, clear after write, these king of bits/registers in Litex.07:50
ronyrusI searched a little but didn't find it.07:50
futarisIRCcloudbenh: great post on linux-litex mailing list. Hopefully it'll get some discussion going,08:07
_florent_Hi, i can understand the concerns about the difficulties to use LiteX for people with a hardware background08:43
_florent_Migen and LiteX have been created by people with hardware background (and not the opposite) and some architecture choices were made to improve productivity to create full systems and still allow efficient resource usage.08:43
_florent_but' it's indeed possible these choices are making things harder if the hardware designer want to implement things with a different approach, and we still have to improve documentation08:45
_florent_But both flows (traditional Verilog/VHDL vs Migen/LiteX) have advantages/drawbacks and Migen/LiteX has been used to create complex systems/cores that we still maintain and have allowed to create cores/systems that would not have been possible with Verilog/VHDL or would have a nightmare to do with traditional tools.08:49
_florent_But for hardware people with a clear view/understanding of how they want things to be implemented, if LiteX approach is not close enough, i would recommend using LiteX only for the integration and/or for reusing core it can provide.08:53
_florent_I'm personnaly using LiteX for different use cases: create full systems with it (fully in Migen/LiteX), create full systems with part on it full Migen/LiteX and others parts in traditionnal VHDL/Verilog/Vendor IP, create full systems with only VHDL/Verilog cores and where LiteX is only used for integration, or just generate standalone cores (LiteDRAM, LiteEth, LitePCIe) in verilog that will be integrated in a08:58
_florent_traditional flow, etc...08:58
benhfutarisIRCcloud: hopefully .. I haven't heard back yet :-)08:59
_florent_So we provide one approach to create SoCs (and we indeed have to improve documentation) but we don't force others to use exact same approach :)08:59
benhI'd like to help get Linux upstream support asap :)08:59
benh_florent_: it's been super handy to plug in IP blocks into microwatt standalone and I can see the appear for building SoCs, it's great once you get your head around it09:00
benh_florent_: I personally find it a bit harder for low level hw design but then I'm not a hw designer so .. :-)09:00
benh_florent_: ie, if I want to put together a module with a rather convoluted mix of state machines, combo processes, etc... I think it's just a matter of getting used to it09:01
_florent_ronyrus: the CSR don't have sticky bit support, but you have we/re signals indicating the CSR has been accessed so can implement the behaviour in your logic09:01
benh_florent_: it would make sense to add write-1-to-clear support09:02
benhit's very useful for a number of things where you want atomicity ... for example clearing event bits or interrupt status bits09:02
ronyrus_florent_ : thanks :) is there an example of logic that does that so I can take a look?09:02
benhmind you, arguably anything requiring performance should be normal MMIOs :-)09:02
benhalso very useful for error reporting bits09:02
benhit avoids the races of doing read-modify-write where you can end up losing a newly set bit09:03
benhwith W1C (or RC but I prefer W1C) you now you only clear what you've seen and it's race free even in multi-processor environments09:03
benhwhere 2 CPUs might try to collect the same event09:03
zypisn't W1C already fairly trivial to implement?09:04
_florent_ronyrus: i will need to write a bit of code, i could do that a bit later09:06
benhzyp: it is in verilog/vhdl ... I suppose it's in migen too ;-)09:08
benhI was just pointing out that it would be a useful feature to have in the base CSR implementation09:08
benhas an option when creating them09:08
benhit needs to be careful though that the write-clear by host and update by the logic itself are properly atomic09:09
zyptrue09:09
zypand I totally agree on the W1C09:09
ronyrus_florent_ only if you want to. I just thought that maybe in some project or module there is such a code already, so you would point me there. No need to do it especially for me. :-)09:12
zypronyrus, something like this? https://paste.jvnv.net/view/Xx8xE09:14
tpbTitle: JVnV Pastebin View paste – Untitled (at paste.jvnv.net)09:14
benh_florent_: LiteEthPhyModel ... it seems to be using source/sink pads.. what does it connect to ?09:56
benhah found it09:58
benhlitex/build/sim/core/modules/ethernet/ethernet.c09:58
*** kgugala_ has quit IRC10:14
*** kgugala has joined #litex10:14
ronyruszyp I'm confused, isn't 'we' is strobed when there is a read from the bus?10:16
zyphmm, I might have r and w the wrong way around10:20
zypbut the rest should still make sense, right?10:20
zypcorrected: https://paste.jvnv.net/view/4tLK710:22
tpbTitle: JVnV Pastebin View paste – Untitled (at paste.jvnv.net)10:22
ronyrusI think so10:22
ronyrusbut I'm fairly new to the FPGA development, so ...10:30
_florent_just discovered this: https://www.phoronix.com/scan.php?page=news_item&px=LiteDIP-Open-Source-FPGAs10:40
tpbTitle: LiteDIP: Creating Open-Source IP Blocks For Generic Linux Drivers On FPGAs - Phoronix (at www.phoronix.com)10:40
_florent_https://mupuf.org/blog/2020/06/09/FPGA-why-so-few-drivers/10:41
tpbTitle: FPGA: Why so few open source drivers for open hardware? - mupuf.org (at mupuf.org)10:41
futarisIRCcloudMuPuF: I hope to make good progress on this over my summer vacation, with the target of having a minimal DRM driver working over PCie!10:56
ronyrusso, I wrote something that I thought would work, but it doesn't.12:16
ronyrushttps://ctxt.io/2/AADAitY0Eg12:16
tpbTitle: Context share whatever you see with others in seconds (at ctxt.io)12:16
ronyrusAdded it to a module that inherits from AutoCSR. The 'status' signal is going up, but 'w' stays 0.12:17
ronyrusand 'r' is going up at some point for some reason ... ¯\_(ツ)_/¯12:18
ronyrusI'm using liteScope to sample the signals.12:18
iushow are offsets supposed to be handled when using litex_server with the crossover uart over pcie?12:47
iuslitex_server.py maps my PCIe BAR (where 0x0 actually translates to 0x82000000 on the fpga side) but seems to have no builtin way to specify this offset? the latter makes me think i'm not using it right12:49
iusall reads (eg. by litex_crossover_uart.py) rely on the physical address obtained from csr.csv, so one would expect the server to be responsible for address translation?12:51
zypius, doesn't look like either of those have any offset arguments15:33
zypyou could alternatively use wishbone-tool, it expects a --register-offset argument15:34
*** kgugala has quit IRC15:37
_florent_ius: litex_server is not indeed not doing address translation, we could add it or you would also use wishbone-tool as zyp suggests15:37
*** kgugala has joined #litex15:37
iusright, thanks for confirming - wishbone-tool works indeed (i tried it before, was just confused about the python utils)16:37
mithroawordnot: Yes, there is isn't much difference when you make CSR data-width 32bit -- and actually it is somewhat less about resources and more about route-ability of the resources17:42
mithro_florent_: I disagree with the premise if LiteDIP -- but I'm open to being proved wrong17:43
mithro_florent_: My belief is more about the number of users17:43
mithrofutarisIRCcloud: did you see the netv2 PCIe driver?17:46
mithrohttps://github.com/timvideos/litex-buildenv/wiki/HowTo-HDMI2PCIe-on-NeTV217:47
tpbTitle: HowTo HDMI2PCIe on NeTV2 · timvideos/litex-buildenv Wiki · GitHub (at github.com)17:47
*** CarlFK has joined #litex17:53
mithro_florent_: I moved the LiteX for hardware engineers page to the LiteX wiki - https://github.com/enjoy-digital/litex/wiki/LiteX-for-Hardware-Engineers18:18
tpbTitle: LiteX for Hardware Engineers · enjoy-digital/litex Wiki · GitHub (at github.com)18:18
_florent_mithro: i've not yet been able to read the full article from mupuf.org, i'll do it soon, i was just sharing it since saw it. I think the work we are currently doing with Antmicro/gsomlo/benh is going in the right direction and we just need to continue discussing things.18:33
_florent_mithro: thanks for the LiteX for hardware engineers move, some parts will probably need to be re-phrased/partially rewritten and i will look at this.  If you want to keep an original version of the document, you should probably also keep it in LiteX-Buildenv.18:40
*** tpearson-mobile has joined #litex18:59
tpearson-mobileanyone know what the license is intended to be on the fpga_101 files?19:00
tpearson-mobileSince lab004 seems to contain the canonical non-Linux firmware example, it'd be important to know if it has to be rewritten to be used (irritating) or if the lack of license was an attempt to indicate public domain / CC019:00
_florent_tpearson-mobile: i just added a BSD 2-Clause License with https://github.com/litex-hub/fpga_101/commit/9e48d00cd93d933e6fb6e4d5a0ff144254d08dae19:35
tpbTitle: add LICENSE. · litex-hub/fpga_101@9e48d00 · GitHub (at github.com)19:35
tpearson-mobilethanks!19:35
tpearson-mobilemuch appreciated19:35
_florent_mithro: i had a closer look at LiteX-for-Hardware-Engineers, i already read it some time ago but wanted to re-read it. I find it very useful for someone wanting to have a quick overview of LiteX and the tips for a someone with a hardware background, but for me this is more a blog post of bunnie's understanding of LiteX when discovering it in 2018.19:52
*** Skip has joined #litex19:54
_florent_mithro: but there are some issues: it's a bit outdated, some things are inexacts or biased by bunnie's background/dislike of Python, some things are covered by others wiki pages and explained a bit differently, etc...19:54
tpearson-mobileyeah, agreed19:55
_florent_mithro: i'm also not sure i want to modify it because it would denaturate it and remove the original content19:55
_florent_mithro: so i'm probably going to move it in https://github.com/enjoy-digital/litex/wiki/Tutorials-Resources19:56
tpbTitle: Tutorials Resources · enjoy-digital/litex Wiki · GitHub (at github.com)19:56
tpearson-mobileto be honest, the intersection of people that are skilled with Python and are also skilled hardware engineers is very small.19:56
tpearson-mobilewhether that changes now, we'll have to see19:57
tpearson-mobilemost hardware folks are used to being very close to the metal in software terms19:57
tpearson-mobilePython is about as far away as you can get...19:58
tpearson-mobileit's an interesting dicotomy19:58
tpearson-mobile*dichotomy19:58
_florent_and add a disclaimer that it was a written from Bunnie in 2018 while discovering LiteX, that it can be useful for others people with hardware background, but i would still recommend the others Wiki pages to really learn LiteX and the original reasoning for the concepts.19:59
tpearson-mobile_florent_: quick question, for basic tutorial / quick start files is there any reason BSD is used instead of something that wouldn't require special notices in binaries and documentation?20:08
tpearson-mobileI ask mainly because it's a bit onerous to require that for the life of a project just to get some Makefile templates.  If the idea is making LiteX easy to use, basic templates like that should be under a public domain / CC0 type license IMO20:09
tpearson-mobilethere's a natural boundary between the gateware and the software already, and it'd be entirely possible to have the gateware under one license and the firmware under another20:11
_florent_tpearson-mobile: yes i was also thinking of that while adding the license20:11
_florent_tpearson-mobile: but in fpga_101, there are also some content i'd like to be with this license (or that is some reused stuff with this license)20:12
tpearson-mobileright, makes sense....it's just that fpga_101 is also a de-facto quick start for firmware (basic templates to get things running)20:13
_florent_tpearson-mobile: so the idea is just to make it use the same license used by LiteX and the cores20:13
tpearson-mobileany way to split those out?  Real world example: as you may know we mostly write GPL code publicly, so we'd probably end up rewriting the Makefile just to make licensing less complex20:13
tpearson-mobilethat makes using LiteX harder than it needs to be20:13
mithrotpearson-mobile: BSD licenses are compatible with GPL code?20:13
tpearson-mobilethey're compatible, yes, but then you have to get into "this file is this license, that file is that license, this file is a chimera of both licenses, see the Git logs..."20:14
tpearson-mobileand for a hour to rewrite a Makefile that's not something we like to do20:14
tpearson-mobileyet....it's an hour of making LiteX harder to use20:14
tpearson-mobile(hour because the docs are quite bad, and if you can't refer to the example Makefile because it's BSD licensed and you're writing a GPL version...)20:14
tpearson-mobileall I'm saying is that adding licenses, even compatible ones, on basic use templates like this is going to make it harder to use LiteX than it needs to be for very little actual gain I can see20:15
mithrotpearson-mobile: You can take a permissively licensed file and convert it to GPL licensed by making modifications and only releasing the modifications under a GPL license20:15
mithroAs long as you continue to have the attribution20:16
tpearson-mobilebut with two clause BSD you still have to comply with the BSD requirements -- BSD notices in binary and documentation, specifically20:16
tpearson-mobileso it becomes a chimera20:16
mithro@tpearson-mobile Doesn't GPL have the same notice requirements or am I misremebering? People seem to treat it like it does20:17
mithroThe GPL has a "Appropriate Legal Notices" section?20:18
tpearson-mobileI'd need to double check, but I do seem to remember BSD being a bit more stringent on it to the point of having banners in command line programs20:18
mithrotpearson-mobile: Are you GPLv2 or GPLv320:19
tpearson-mobilewe tend to do GPLv3/AGPL20:19
mithrotpearson-mobile: Releasing under GPL means it will probably never be usable in ASICs20:20
tpearson-mobileRight, we had talked about that before, but this is for the *firmware*, which is on the software side :)20:20
mithrohttps://en.wikipedia.org/wiki/License_compatibility#/media/File:Floss-license-slide-image.png20:20
tpbTitle: License compatibility - Wikipedia (at en.wikipedia.org)20:20
tpearson-mobilenot the gateware20:20
mithroI'm only partially paying attention -- working on some other stuff20:21
tpearson-mobilesure, no problem20:21
tpearson-mobilemithro: I think the type of license we're looking for in regards to HDL simply doesn't exist -- basically, one that if you modify the HDL itself you have to contribute those changes back, but you can create internal functionally-identical derivative works in the process of making an ASIC20:23
tpearson-mobilewithout contributing them back (since then you get into NDA protected stuff at foundries etc.)20:24
tpearson-mobileOutside of certain strategic areas (e.g. OpenPOWER / FSI) where it is in our direct interest to allow proprietary implementations of our work, we tend to want people that want to make a proprietary / internal / locked down version of our stuff, instead of contributing back to the open version, to pay for that20:26
tpearson-mobilebut...probably a bit OT here :)20:26
tpearson-mobile_florent_: I'm not entirely sure that the lab004 example is actually BSD compliant -- nowhere in the binary does it actually contain the BSD copyright notice :)20:32
mithrotpearson-mobile: My general thinking is that trying to force people to do things doesn't really work -- it's better to create positive incentives so people *want* to contribute back20:32
mithro_florent_: Lots of people like that LiteX for Hardware Engineers page -- many hardware engineers feel uncomfortable Python and understanding that people like Bunnie also struggle with it helps them understand20:33
tpearson-mobilemithro: I agree on short timescales (years), but I disagree on timescales that are the length of copyright (decades to centuries)20:33
tpearson-mobilethe "carrot" only works on the shorter timescales in my experience20:33
mithro@tpearson-mobile: Plus permissive can always be converted to repocical if needed in the future20:34
zypI prefer BSD licensing my embedded stuff, you don't get any contributions back from the people you turn away by GPL-licensing a project anyway20:35
*** st-gourichon-fid has quit IRC20:36
tpearson-mobilezyp: It's a bit more nuanced I think than that....at least for larger / more valuable works.  For little stuff yes, absolutely, we've rewritten small stuff from scratch without even looking at it to avoid license restrictions.  For larger projects though where you're starting to talk man-years or more of development, that GPL requirement absolutely20:38
tpearson-mobilecan make people start to think twice about just copying and using in proprietary stuff vs. contributing at least something back.20:38
tpearson-mobilesometimes I've seen it change a new design from 100% proprietary to having a clear boundary inside the design of proprietary vs. GPL, just because it's cheaper to do that than to rewrite the entire thing using internal resources20:39
tpearson-mobileanyway, I think without a license-free Makefile example, we need better documentation on key files like software/include/generated/variables.mak20:41
mithrotpearson-mobile: I'm guessing you spend lots of time talking to Bradley Kuhn :-P20:41
_florent_tpearson-mobile: i don't want to make your life harder, but also don't want to want to make mine harder, BSD-2 is probably a the best fit for most of the work in fpga_101, but please consider  there is no restriction on basic things like Makefile, simple firmware, etc...20:41
tpearson-mobilemithro: Nah :D20:42
zyptpearson-mobile, also, the BSD license does not require the binary itself to contain the license notice, it's sufficient to put it in the accompanying documentation20:42
tpearson-mobilemithro: we've seen both the best in people (/corps) and the worst in people (/corps)20:42
tpearson-mobilezyp: yes, though for embedded firmware it's not like there's normally a software help package that goes with it, oftentimes it ends up embedded in some Flash chip on a board and that's it20:43
tpearson-mobilegranted, we always publish something with those types of products that says "get the source here" but I don't know if that satisfies the BSD requirement.20:44
tpearson-mobile_florent_: thanks, that does make it easier :)20:45
tpearson-mobilejust because there's a lot of "magic variables" in the Makefiles that will send people on a wild goose chase for no good reason if they had to assemble it all on their own20:45
tpearson-mobileLiteX-specific magic variables, that is20:45
mithrotpearson-mobile / _florent_: Are these the generated files? We could just put a CC0 license at the top of the generated file output? (Generated files are in a strange position in copyright law)?20:47
tpearson-mobilemithro: one axiom we've taken away from our experience is that without the ability to enforce a stick against someone, they will eventually turn on you, it's just a matter of time.  At some point the carrot you're offering simply won't keep their interest, and if you don't have enforcement ability you're in a bad spot.  Note this is mostly just due20:47
tpearson-mobileto the (IMO insane) copyright durations in the US -- they're long enough that you could have multiple generations own the copyright to any given work.20:47
tpearson-mobileand the last chain in that generational link could easily be an IP holding company that will apply lawyers as needed to get maximum profit for themselves no matter the cost to anyone or anything else ;)20:48
_florent_mithro: i agree LiteX for Hardware Engineers page has really interesting value as i was saying, but it does not mean that's the way i would recommend learning LiteX. I also don't want to denaturate it by modifying it, so i just moved it to https://github.com/enjoy-digital/litex/wiki/Tutorials-Resources#litex-for-hardware-engineers with a description/disclaimer and haven't touched the contents20:48
tpbTitle: Tutorials Resources · enjoy-digital/litex Wiki · GitHub (at github.com)20:48
tpearson-mobilemithro: I don't think the main file in question (the Makefile) is autogenerated20:50
tpearson-mobilebut it was generated by someone that was familiar with the LiteX way of doing thing20:50
tpearson-mobile*thinks20:50
tpearson-mobile*things20:50
*** tcal has joined #litex20:51
tpearson-mobilethere's also a little bit of code in main.c that, while useful, isn't worth dealing with licensing over -- there's tons of public domain examples of how to do things like string scans20:51
_florent_mithro: no sure the generated files should be CC0: i still like to have a BSD-2 license on a LiteDRAM/LitePCIe standalone generated core20:51
mithro_florent_: I hope the wiki will have more contributors than just you?20:51
tpearson-mobile_florent_: You could always mark the couple of little files that we're talking about here as public domain / CC0 in the headers --that would remove any question :)20:52
mithroCan use SPDX identifiers -- https://spdx.org/licenses/20:53
tpbTitle: SPDX License List | Software Package Data Exchange (SPDX) (at spdx.org)20:53
tpearson-mobileyeah20:53
tpearson-mobilethat same relicense then allows those to be used in other works (Wikis, etc.) more easily20:53
tpearson-mobilee.g. if we were to put out some documentation on how to use LiteX for things20:53
somlo_florent_: this: https://pastebin.com/txWRww0U fixes it for me on rocket+litex20:55
tpbTitle: [Diff] diff --git a/litex/soc/software/liblitesdcard/spisdcard.c b/litex/soc/software/l - Pastebin.com (at pastebin.com)20:55
tpearson-mobileI completely agree on keeping the more complex stuff under a proper license, it's just these building blocks that are really only useful to accelerate someone else's brand new design that I'm having a bit of a license quibble over20:55
somlonot asking to apply it yet :)20:55
somlobut apparently .data and .rodata end up being classified as .rodata (and writes to it are ignored)20:55
somlomaking it all go in .bss apparently leaves global variables still writable20:56
tpearson-mobile(and where by nature there's no boundary to clearly mark where one project starts and another ends -- Makefiles have to be part of the resultant firmware sources, for instance)20:56
somlostill investigating (we should be able to use initialized globals in .data and have them stay r/w, anything else is insanity)20:57
somlobut at least I'm likely to be barking up the right tree, so to speak20:57
awordnotsomlo: wow that's a very weird bug20:57
somlotell me about it, it's been driving me up the wall for the better part of last week :)20:58
_florent_mithro: there are already others direct contribution than mine in the wiki (from somlo for example), but i'd just like to get my change to describe how i see the project, it's taking time because i'm busy with others thins but it's slowly getting there. Once we have this base it will be easier to have others contributors.21:01
somlo_florent_: I wonder if somehow soc/software/bios/linker.ld holds the answer -- my intuition says that's where I need to look next...21:08
somlohmmm... `INCLUDE generated/output_format.ld`, `INCLUDE generated/regions.ld` ...21:10
somlothe latter (regions.ld) looks fine...21:11
somlooooh... in linker.ld, we have both .rodata and .data go in `> rom`, only .bss goes in `> sram`21:12
somlothat might explain a thing or two21:12
mithro_florent_: You mean s/change/chance/ right?21:12
somlolet me try and rebuild with a small edit to linker.ld, see what happens21:12
somlo_florent_: what are the implications of explicitly mapping .data into sram (instead of rom)? I'm no ld ninja, so I have to ask if it's likely the memtest might stomp all over initialized .data values in sram during self-test :)21:17
somlobut really, .data *belongs* in sram, as it's supposed to be modifiable by the program!21:17
somlonvm, I'm being dumb -- memtest stomps all over DRAM, not sram ! :D21:18
zypsomlo, does .data have different LMA and VMA?21:24
tpearson-mobilemithro: FSI code is now BSD 3-clause: https://gitlab.raptorengineering.com/raptor-engineering-public/lpc-spi-bridge-fpga/-/commit/7b0ac449ecbdfcebffffb3a9522381b2efae4e0621:24
tpearson-mobiledoes that work for you?21:25
tpbTitle: Relicense FSI master/slave as BSD 3-clause in addition to AGPL v3 (7b0ac449) · Commits · Raptor Engineering Public Development / lpc-spi-bridge-fpga · GitLab (at gitlab.raptorengineering.com)21:25
somlozyp: we're talking about the litex bios here, so it's all physical addresses at this point21:25
zypthat's not relevant to my question21:25
somlook, then I misunderstood your acronyms21:26
zypon a MCU with flash, it's typical to put .data's LMA in flash and VMA in ram, since the initial contents will be located in flash and copied to ram during startup21:27
mithrotpearson-mobile: Should do21:27
tpearson-mobilegreat!21:27
zypwhen you have .data going into rom, it sounds like you have a linker script written for such a platform21:27
somlozyp: https://github.com/enjoy-digital/litex/blob/master/litex/soc/software/bios/linker.ld21:27
tpbTitle: litex/linker.ld at master · enjoy-digital/litex · GitHub (at github.com)21:27
somlospecifically, https://github.com/enjoy-digital/litex/blob/master/litex/soc/software/bios/linker.ld#L5521:27
tpbTitle: litex/linker.ld at master · enjoy-digital/litex · GitHub (at github.com)21:27
somlothat's wrong, IMHO21:27
zypyeah, that's wrong21:27
tpearson-mobilemithro: there's a few other strategic OpenPOWER-related areas where I can probably get things relicensed if you need, so if you're interested in other files in that repo let me know21:27
somloshould be "> sram", just like bss21:28
zypagreed21:28
somlobuilding now to test, will send PR shortly :)21:28
somlopresuming it works, which I think it should21:28
daveshahI think just putting it in SRAM will break XIP platforms?21:29
daveshahthat would need some explicit copy-to-RAM step21:29
daveshahunless they use a different linker script21:29
zypdaveshah, which are you thinking of?21:29
somlodaveshah: not familiar with XIP, but having .data that is really .rodata is a recipe for people wasting north of a week thinking they're losing their damn mind :D21:30
daveshahI think some people are using LiteX with the BIOS executing from SPI flash21:30
daveshahe.g. icebreaker21:30
daveshahoh yeah it definitely needs to be fixed21:30
zypas long as we're talking about code that gets embedded in the bitstream to initialize the ram blocks, you can place it straight into ram unless you need reset capability21:31
zypif you need to be able to reset, you need a copy of the initial data as well21:31
somlobut if you're executing from SPI flash, you should make sure there is no .data section21:31
zyphttps://cgit.jvnv.net/laks/tree/ld_scripts/arm_flash_ram.ld#n72 <- which in a linker script would look something like this21:31
tpbTitle: arm_flash_ram.ld\ld_scripts - laks - Microcontroller support library. (at cgit.jvnv.net)21:31
somlos/no .data section/nothing in the .data section/21:32
zypsomlo, the .data section exists for a reason21:32
zypyou'll want to handle it properly, not pretend it doesn't exist :)21:33
somlozyp: right, but if you know you're running stuff from rom, you also know you can't use it21:33
zyplike I said, on a normal mcu with XIP flash, you put an initial copy in flash, and copy it to ram during startup21:33
somloand like I said, I'm no ld ninja, so if "running from rom" really means implicitly copying stuff into some memory that becomes available later on, then I'm out of my depth21:34
somloso anyway, I'll send in my PR, and y'all feel free to make me do revisions if it's wrong :)21:35
zypI don't have time right now, but I can take a look tomorrow21:35
zypI assume the startup code already has a part that zero-fills .bss?21:35
zypcopying .data from flash to ram goes right next to that21:36
*** tpearson-mobile has quit IRC21:36
somlook, so then that would be an *additional* patch for XIP platforms, orthogonal to placing .data in sram in linker.ld21:37
zypI wouldn't call it orthogonal21:38
zypyou'll want something like «> sram AT > rom» in the linker script, along with enough symbols for the startup code to know where to find the data and where to put it21:39
zypinstead of a plain «> sram»21:39
somlonow that I think about it, plain "> sram" probably won't even work, since the startup code won't be there to populate it anyway21:40
zypunless it's prepopulated in the initial blockram contents21:41
zypbut either way it won't be after a soft reset21:41
zypwhich cpu are you working on?21:42
somlorocket (64-bit)21:42
zyphmm, I'm getting lost in the repos, where did crt0.S go?21:43
somlolitex/soc/cores/cpu/rocket/crt0.S21:44
somlothere's a bss_init loop21:44
somlothere isn't a "populate data" code block :)21:45
zypright21:45
somloso I am starting to comprehend what you're saying, it will be there after pushing the bitstream, but won't get reset to the proper initial values on a soft reset21:45
zypyes21:45
somloso really I need two versions of .data, one in rom (to use as a source for memcpy-ing to the second one, in ram)21:46
zypso you should probably treat everything like a mcu with xip flash, both for .data and .bss initialization21:46
zyphttps://cgit.jvnv.net/laks/tree/startup/entry.cpp#n20 <- here's how I do it (along with the linker script I linked earlier)21:47
tpbTitle: entry.cpp\startup - laks - Microcontroller support library. (at cgit.jvnv.net)21:47
somloand somehow expressing this stuff with the appropriate magic incantation in the .ld file, and adding the block of code to do the memcpy on reset21:47
somloand probably on all CPUs, not just rocket, because it's wrong everywhere right now, even if on some targets it might happen to work by "accident" :)21:48
mithrosomlo: The XIP verse copy to ram options should be cleaned up21:48
mithrosomlo: https://github.com/enjoy-digital/litex/issues/14521:49
somloI'll file an RFC PR and start the conversation, but I'm not equipped to handle a cross-ISA overhaul of everything :)21:49
zyphttps://paste.jvnv.net/view/M8Sow <- here's a newer version of that linker script, LOADADDR() makes everything clearer21:49
tpbTitle: JVnV Pastebin View paste – Untitled (at paste.jvnv.net)21:50
zyppersonally I prefer doing as little as possible in assembly to keep it portable, but that relies on the compiler not attempting to access .data or .bss21:51
zypbefore it has initialized them21:52
zypI wrote this for cortex-m, but I've ran it on vexriscv as well :)21:53
somloanyway, my dirty-hack attempt at `s/> rom/> sram/` didn't work, the bios hangs after printing the LiteX logo; so I filed issue https://github.com/enjoy-digital/litex/issues/56622:05
tpbTitle: bios: `.data` section placed in rom, wrongly ends up acting like `.rodata` · Issue #566 · enjoy-digital/litex · GitHub (at github.com)22:05
zypsomlo, can you try this? https://paste.jvnv.net/view/tQGMs22:17
tpbTitle: JVnV Pastebin View paste – Untitled (at paste.jvnv.net)22:17
mithroAt some point I would like to write up my theories about how you should use the CSR objects22:28
mithrodaveshah: Yes, on the ice40 boards and the spartan 6 lx9 boards the BIOS is stored on SPI flash and XIP rather than inside a ROM22:29
zyphmm22:29
mithrosomlo / zyp: See above too22:29
zypmithro, just looked at #14522:30
mithroThey don't have enough block RAM to waste it on the ROM22:30
zypthe picorv32/crt0 looks wrong too22:30
mithrozyp: I think we definitely need to add testing for this22:30
zypit assumes .data is located right after .rodata, which the current linker script doesn't guarantee in any form22:31
zypand either way, it doesn't really matter whether the BIOS is using XIP SPI flash or block ram configured as a rom, .data can't be located in either since it needs to be writable22:32
zypthe only case in which .data doesn't need to be copied by crt0 is when it's already loaded to ram prior to execution, which would be the case if there's either a loader before this, or if it's using block ram that's initialized by the fpga bitstream itself22:35
zypbut in the latter case, the block ram contents would be modified the first time it runs and therefore potentially invalid after a cpu reset without reloading the fpga22:35
somlozyp: building now with your suggested patch, let's see what happens...22:37
zypI also haven't looked at the code that is initializing the block ram, but I'd bet that it currently only initializes the rom block, which is why simply changing to «> sram» didn't work at all22:38
zypin other words, I'd argue that the #ifdef EXECUTE_IN_PLACE conditional is unnecessary, and that .data should _always_ be copied22:40
*** HoloIRCUser has quit IRC22:40
zypbecause there's only the special case of a cpu that doesn't need to support reset that doesn't need it to be copied, and that case is currently not supported either way22:41
zypI guess the only reason it haven't been a bigger problem before is simply because there isn't a lot of code in the BIOS and most of it doesn't write to .data at all22:42
somlonot too many globals, and if any, they're probably .bss not .data22:43
zypyeah, or they might be in .data but only read22:44
somlowhich is why this was such a WTF... whaddaya mean, I'm writing to the damn thing, and it stays unchanged :)22:44
zypfixing and testing every crt0 sounds fun :p22:45
somloCPUs (ISAs) should each have a maintainer :)22:46
somlozyp: that still hangs after the LiteX ascii-art logo and "BIOS built on <timestamp>"22:54
zypoh, hmm22:55
zypcan I have a copy of the elf and the csr.csv?22:55
futarisIRCcloudmithro: Yep. I've seen the HDMI2PCIe driver.22:58
somlozyp: http://mirror.ini.cmu.edu/bios.tgz23:00
zyphmm, at a glance the elf seems to have sane section headers23:03
zypdo you have debugger access to it when it's running? you could set a breakpoint on main and check whether there's matching content at 0x10008600 and 0x1100000023:07
somlozyp: no debugger, but I could add some print statements right around where the logo is being printed, presumably before .data is ever accessed...23:09
mithrosomlo: Does Rocket have JTAG at all?23:09
mithrosomlo: It would be pretty easy to do something like wishbone-tool does for VexRSICV23:10
somloit probably does, but I'd have to invest a few hours in getting to the bottom of all that :)23:10
zypthis could probably be tested just as well on vexriscv23:10
mithrosomlo: Recommend putting it on the todo list near the top23:10
zypexcept the copying loop would have to be 32-bit instead :)23:11
zypsomlo, how big is your bios.bin?23:12
futarisIRCcloudhttps://groupgets.com/manufacturers/getlab/products/kimchi-micro - OSHW i.MX8M based board with a mPCIe slot.23:12
tpbTitle: kimχ micro by GetLab | GroupGets (at groupgets.com)23:12
somlo35k according to `ls`23:13
zyp35080?23:13
somlonvm, that was bios.bin; bios.elf is 381920 bytes23:14
zypI asked about bios.bin :)23:14
somlooh23:14
somlo3508423:14
zypokay, that sounds sane23:14
zypjudging by the elf, there's 35080 bytes of stuff to go in the .bin, the last 4 is probably just for alignment or something23:15
somloweird, 35080 divides evenly by 8, 35084 doesn't :)23:16
somlounless the .bin has 4 bytes worth of some kind of magic file header or something23:17
zypshouldn't23:17
somlointeresting, right after the last line that prints, there's a call to `crcbios();`...23:20
somlohmmm...23:20
zypah23:20
zypwe probably broke something it assumes :)23:20
somlothat, or crcbios actually uses one or more global variables :)23:20
somlolooking...23:21
somlohttps://github.com/enjoy-digital/litex/blob/master/litex/soc/software/bios/helpers.c#L5423:22
tpbTitle: litex/helpers.c at master · enjoy-digital/litex · GitHub (at github.com)23:22
zypyeah, already found it23:22
zypand yes, we did23:22
zypit's trying to do a crc over everything from _ftext to _edata and _edata is now in a different memory region :)23:23
zypmaybe it's not hanging, just busy calculating the crc23:23
somlowell, I could just comment out the call to crcbios for now23:23
somlorather than worry about fixing it for the purpose of this test23:24
zyphmm, it's only 16 megabytes between the regions, more likely it's stuck than slow23:24
zypprobably faults once it runs past the end of the rom region23:25
somloI'm rebuilding with it commented out, should have a verdict in 20-ish minutes or so23:25
mithrosomlo: We should get bios patching working -- https://github.com/SymbiFlow/prjxray-bram-patch23:25
tpbTitle: GitHub - SymbiFlow/prjxray-bram-patch: Tool for updating the contents of BlockRAMs found in Xilinx 7 series bitstreams. (at github.com)23:25
somloif it works, it's worth figuring out how to fix it23:25
zypyeah23:25
zypI can look more at this tomorrow, should have been in bed an hour ago :)23:26
somlo_florent_ showed me a way to have lxterm push just the bios.bin to a board without rebuilding the whole gateware23:26
somlodidn't work for me right off the bat, so I'd have to invest another hour or two getting to the bottom of *that* :)23:27
zypanyway, I guess crcbios() is easy to fix23:27
zypcurrently it's going off _edata, which is end of .data VMA23:27
zypchanging that to LMA is probably all there's to it23:28
zypcould add a new symbol or do (_rdata + _edata - _fdata)23:28
zypoh, and the extra four bytes you've got is the CRC checksum :)23:29
somloheh23:29
somlozyp: looking at linker.ld, there's an `_erodata` symbol, but then there's a `.commmands` section which I'm unfamiliar with, inbetween .rodata and .data23:31
zypI assume the .commands is some magic to build an array of commands for the bios shell23:32
zypyou can consider it another .rodata section23:32
somloso add an `_ecmds = .;` and s/_edata/_ecmds/ in the expected_crc value?23:33
zypno23:34
somlofigures :)23:34
zypyou want end of .data LMA23:34
zypwhich IIRC is easiest to get by doing LOADADDR() + LENGTH()23:35
zypor maybe it was SIZE()23:35
zypsomething like that :)23:35
somloLENGTH() of what?23:35
zypanyway, I'll go to bed now and then I'll check the backlog tomorrow to see how your test went, and then I'll update my patch to also fix the crcbios()23:36
somlook, sounds good23:36
zypnight :)23:36
somloback at you, and thanks!23:36
*** Skip has quit IRC23:46

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