<joshua_>
Hi! I am back, some time later. I'm trying to figure out a reasonable flow to build software as part of my LiteX build. Basically, I want to have my firmware compiled into the bitstream, with a single large SRAM (i.e., no ROM-to-SRAM copy). I think I want a flow that is similar to the BIOS build flow, but instead of the BIOS, I want to build, say, the LiteX bare metal demo.
078AATWML has joined #litex
<ysionneau>
joshua_: I can see in soc_core.py you can easily add ram/rom to the SoC but you need to pass directly the binary file to init the ramblock, you can't just pass a path that will get built
<ysionneau>
so I don't think litex supports for now adding other build than the bios, but I might be wrong :o
<ysionneau>
I also looked at builder.py which contains the logic to build the bios but it seems it only builds bios and basic libraries
<ysionneau>
but maybe logic can be extended/generalized in builder.py ?
<ysionneau>
maybe the add_ram() / add_rom() from the SoC class can be extended to be called with a path/build type info (makefile/meson/cmake etc) to tell how to build the content of those rams
<ysionneau>
then builder.py can "finalyze" everything and build those, like it's done for the bios
<joshua_>
I think I am making some progress by doing a `builder.add_software_package`
<joshua_>
and indeed I am doing s `self.init_rom('main_ram', get_mem_data('demo.bin', endianness = 'little', data_width = 32))
<joshua_>
`
<joshua_>
but I am sort of lost in how I would specify the correct path to `demo.bin` from __init__ in a SoCCore, before the builder has even done its work yet
<ysionneau>
ah yes you're right, _generate_rom_software() seems to build everything it finds in self.software_packages
<ysionneau>
so maybe it's ok like this
<joshua_>
maybe I can override `build` in my SoC object
<joshua_>
I think I have achieved this
<joshua_>
if this actually runs correctly on my board I will pastebin it
<ysionneau>
seems like a bit of a "hack" but I guess it's a good start until someone adds proper support
<joshua_>
yes, the situation is not great
078AATWML has quit [Ping timeout: 268 seconds]
<zyp>
joshua_, beware that if you don't split .data into a RW area and a RO area of initial values, you can't reset the CPU without reloading the whole FPGA
<joshua_>
that explains why I could not reset the CPU
<joshua_>
is it still the case that 32-bit CSRs in LiteX are not really a thing? I am seeing some documentation from quite a while ago that CSRs are 8 bits strided in memory one dword at a time, and I am feeling like it would be nice to have atomic 32-bit loads/stores on CSRs
<joshua_>
but the documentation is quite out of date
<zyp>
I think it's configurable and IIRC the default got changed to 32 years ago
<joshua_>
that is pleasant to know
<zyp>
the CSRs in the stuff I've worked on is certainly 32b