Tuesday, 2021-01-05

*** tpb has joined #tomu00:00
*** Jay_jayjay has joined #tomu00:00
*** Jay_jayjay has quit IRC02:00
*** mcroydon has quit IRC02:53
*** matt_c has joined #tomu02:56
*** im-tomu has left #tomu07:35
*** im-tomu has joined #tomu07:35
*** buZz has quit IRC09:42
acathlaWhen uploading a litex+cpu design to a fomu, the code goes to flash and seems to be executed from there. Is there simple way to copy it to RAM?10:01
acathlaxobs should know...10:04
xobslitex+cpu? No, that would require a second device to configure the FPGA.10:06
xobsFomu EVT has a way to do that, but that is significantly larger.10:06
tntI'm assuming he meant the riscv fw code, not the fpga bitstream.10:10
scienteswhen i was building from litex recently I fail with like 8500 LUTS in use10:32
scientesor like 70% too much10:33
scientesso something is seriously wrong10:33
*** jas4711 has quit IRC10:36
*** jas4711 has joined #tomu11:00
*** jas4711 has quit IRC11:15
*** buZz has joined #tomu11:15
*** buZz is now known as Guest736411:15
*** Guest7364 has quit IRC11:29
*** Guest7364 has joined #tomu11:29
*** Guest7364 is now known as buZz11:29
acathlascientes, you need to specify a --cpu-variant=simple or something like that11:35
acathlaxobs, foboot is executed in SRAM, when I upload code for the VexRiscV it goes to SPI flash and is executed from flash too? Can't it be copied to SPRAM first?11:37
acathlaWith the llitex bios there is a mem test. I got 97KB/s but I had less, like <40KB/s when SPI flash was in 1x. So executing from flash is really slow.11:40
acathlaI'm writing a foboot-like bootloader that will use infrared instead of USB, and will probably not have to flash new FPGA designs but only code for the RISCV.11:41
acathlaAnd it's for a robot that has almost the same hardware than the fomu of course.11:42
xobsacathla: foboot is actually executed from ROM. It's special like that.12:40
xobsIf you want code to execute from RAM instead of SPI, you can annotate the function with `__attribute__((.section(".data")))` to place it in the data section, which gets copied to RAM when your program starts.12:42
xobsUsually I create a new linker section called `.ramtext` and place stuff in it that way. For example: https://github.com/adafruit/circuitpython/blob/main/ports/litex/mphalport.c#L57-L5812:43
xobsAnother approach you can take is to manually place functions there by adding them to the linker script: https://github.com/adafruit/circuitpython/blob/main/ports/litex/boards/fomu/fomu-spi.ld#L47-L6312:43
*** Jay_jayjay has joined #tomu13:04
acathlaOk, ROM made from Blocks or RAM in the FPGA.13:13
acathlaxobs, that's perfect!13:13
xobsIf you're making your own SoC core, you could do something like make your ROM execute an infinite loop, then manually load the program into RAM using the debugger. Add the DummyUSB device, add a UART with crossover, and be sure to set the `REBOOT_ADDR` register: https://rm.fomu.im/reboot.html#reboot-addr313:15
tpbTitle: REBOOT Fomu Bootloader documentation (at rm.fomu.im)13:15
xobsBasically, have it so when the device first boots up, it enumerates as a USB device. Then use `wishbone-tool` to act as both a GDB server and a terminal (wishbone-tool -s gdb -s terminal --csr-csv build/csr.csv). If you place your test program entirely within RAM, you can load it with GDB, set `REBOOT_ADDR` to 0x10000000 (i.e. the start of RAM), then use `mon reset` to reset the CPU and run your program.13:20
acathlaOk, but that's just for testing13:21
acathlabut nice to know it's possible13:21
st-gourichon-fidThanks xobs for the hints! One minor adjustment: it's __attribute__((section(".data"))) without dot before section.13:26
xobsAh, my mistake. I always get that wrong.13:26
*** andi- has quit IRC13:27
st-gourichon-fidNot a problem, lots of thanks. We are testing that.13:27
st-gourichon-fidxobs, we are exploring what you explained.13:30
*** andi- has joined #tomu13:42
acathlamemspeed() (in the default litex bios) on VexRiscV goes from 97KB/s executed from SPI to 1674KB/s executed from RAM (SPRAM).14:31
st-gourichon-fidRegarding memspeed(), strangely enough, we had an assembler error.  We had to make our own copy of memspeed() and shorten it until assembler accepted.  I can imagine some reasons, but unsure.14:41
st-gourichon-fidError is : .s: Error: value of 380 too large for field of 1 byte at 25814:42
st-gourichon-fidWhen I remove code in function, value decreases, and when below 256 code compiles.14:44
*** im-tomu has left #tomu15:03
*** im-tomu has joined #tomu15:03
st-gourichon-fidxobs, we are trying to see if there's a way to put "most" code in RAM.  I tried with method "I don't think it will work but cheap to try", replacing all "} > rom" to "} > sram AT > rom" and of course it crashed horribly.15:12
xobsYou just need to place the start section in flash, then move .text into the .data section.15:13
st-gourichon-fidEarliest code (crt0, things before main) has to be in ROM, then all C-level code "could" be in RAM.15:13
st-gourichon-fidJust moving the line "*(.text .stub .text.* .gnu.linkonce.t.*)" from the text section declaration to the data section declaration appears to do the trick.15:26
st-gourichon-fidbecause the existing text section declaration says "*crt0*(.text)" which already guarantees that crt0 is in .text section.15:27
xobsOoh, neat. Yay!15:27
st-gourichon-fidThanks for your hints!15:27
st-gourichon-fidOur current linked.ld os basically this one: https://github.com/litex-hub/fpga_101/blob/master/lab004/firmware/linker.ld15:28
st-gourichon-fidah not this one.15:28
st-gourichon-fidThat one: https://github.com/enjoy-digital/litex/blob/e32e8c069bda2255b8b6b10520e6698a20bd10a0/litex/soc/software/bios/linker.ld#L3915:29
st-gourichon-fidconfirmed.15:30
scienteswhat do i type to boot, again?15:48
scientesafter I load a rom, I have to type something after plugging it in, in order to run it15:50
xobs`dfu-util -e`?15:58
scientesyeah that's it16:11
scientesto add confusion, the firmware my fomu shipped didn't work that way16:12
*** AnimaInvicta has joined #tomu17:03
*** Jay_jayjay has quit IRC18:21
*** futarisIRCcloud has quit IRC18:22
*** craigo has joined #tomu18:26
*** rj has joined #tomu18:33
*** Yatekii has quit IRC19:09
*** Jay_jayjay has joined #tomu19:12
*** craigo has quit IRC19:13
*** Yatekii has joined #tomu19:16
*** Jay_jayjay has quit IRC19:57
*** Jay_jayjay has joined #tomu20:08
*** Jay_jayjay has quit IRC21:16
*** NoGodDamnIdea has joined #tomu21:36
*** Jay_jayjay has joined #tomu22:01
*** AnimaInvicta has left #tomu22:04
*** Jay_jayjay has quit IRC23:48

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