Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ti375 devkit litex debian demo #24

Open
Dolu1990 opened this issue Sep 4, 2024 · 26 comments
Open

ti375 devkit litex debian demo #24

Dolu1990 opened this issue Sep 4, 2024 · 26 comments

Comments

@Dolu1990
Copy link
Member

Dolu1990 commented Sep 4, 2024

Hardware :

Litex :

Debian / Linux / Opensbi images generation :

Debian and FPGA images are uploaded here :
https://drive.google.com/drive/folders/12WYe_igo2edwZABvF9Zta_bw4kuEbhms?usp=sharing

Here is how you can flash a sdcard using those (after you uncompressed p1 p2) :

export SDCARD=/dev/???
export SDCARD_P1=${SDCARD}p1
export SDCARD_P2=${SDCARD}p2

(
echo o
echo n
echo p
echo 1
echo
echo +600M
echo y
echo n
echo p
echo 2
echo
echo +19000M
echo y
echo t
echo 1
echo b
echo p
echo w
) | sudo fdisk $SDCARD

sudo mkfs.vfat $SDCARD_P1
sudo mkfs.ext4 $SDCARD_P2
sudo e2label $SDCARD_P2 rootfs

dd if=p1.img of=$SDCARD_P1
dd if=p2.img of=$SDCARD_P2
@Dolu1990 Dolu1990 changed the title ti375 devkit litex ti375 devkit litex debian demo Sep 6, 2024
@Dolu1990 Dolu1990 pinned this issue Nov 6, 2024
@silverliningeda
Copy link

excuse my ignorance as i have worked entirely on cloud FPGAs. i am trying to collect all the hardware needed to replicate this demo.

can you add a little detail about what you mean by the USB pmod and what it is needed for ?

@Dolu1990
Copy link
Member Author

Dolu1990 commented Nov 7, 2024

Hi,
The USB pmod is this extention board :
https://github.com/Dolu1990/pmod_usb_host_x4/tree/main

It provide USB host support to the system, allowing to connect mouse, keyboard, sound card, and other USB peripherals

@silverliningeda
Copy link

where can i get it? or do i need to do some soldering (which i dont know how to do) ?
thanks

@Dolu1990
Copy link
Member Author

Dolu1990 commented Nov 7, 2024

To get it :

  • Either you order the PCB (i did it on pcbway), then you order the componants and mount them.
  • Either you ask a compagny to do the whole process (can be done on pcbway aswell, but quite a bit more expensive)

The only thing to be careful about is "The PMOD connector is on the bottom side of the PCB in kicad, but should be solder on the top."

@Dolu1990
Copy link
Member Author

Dolu1990 commented Nov 7, 2024

I would say, if you have access to a USB cable, cut the cable, solder pins on the wires and pull down resistor on it, you should be good to go. No need of a PCB (but it keeps things cleaner XD).

@silverliningeda
Copy link

ok i will try to figure it out.

but even without using PMOD0 and PMOD1, it should be sufficient to use PMOD2 (Efinix HDMI extentions board) to see debian booting on a monitor right ?

@Dolu1990
Copy link
Member Author

Dolu1990 commented Nov 8, 2024

The efinix HDMI extentions board doesn't use a pmod, but another connector.

You don't event need that HDMI if you use the serial port ^^

@sitestudio
Copy link

Getting errors as it tries to boot up...downloaded the prebuilt images, and can see files in both '629MB Volume' and rootfs on the SD card (32GB):

[ 5.878333] EXT4-fs (mmcblk0p2): ext4_check_descriptors: Checksum for group 123 failed (41871!=36088)␍␊
[ 5.937946] EXT4-fs (mmcblk0p2): ext4_check_descriptors: Checksum for group 124 failed (25165!=19764)␍␊
[ 5.997546] EXT4-fs (mmcblk0p2): ext4_check_descriptors: Checksum for group 125 failed (23813!=29303)␍␊
[ 6.057181] EXT4-fs (mmcblk0p2): ext4_check_descriptors: Checksum for group 126 failed (34490!=43466)␍␊
[ 6.116821] EXT4-fs (mmcblk0p2): ext4_check_descriptors: Checksum for group 127 failed (36187!=41514)␍␊
[ 6.198565] EXT4-fs (mmcblk0p2): failed to initialize system zone (-117)␍␊
[ 6.229913] EXT4-fs (mmcblk0p2): mount failed␍␊
[ 6.259761] VFS: Cannot open root device "/dev/mmcblk0p2" or unknown-block(179,2): error -117␍␊
[ 6.292696] Please append a correct "root=" boot option; here are the available partitions:␍␊
[ 6.325296] b300 30542848 mmcblk0 ␍␊
[ 6.325351] driver: mmcblk␍␊
[ 6.378958] b301 614400 mmcblk0p1 39b2d565-01␍␊
[ 6.379014] ␍␊
[ 6.431063] b302 19456000 mmcblk0p2 39b2d565-02␍␊
[ 6.431118] ␍␊
[ 6.481473] List of all bdev filesystems:␍␊
[ 6.506663] ext3␍␊
[ 6.506699] ext2␍␊
[ 6.529258] ext4␍␊
[ 6.551102] vfat␍␊
[ 6.572311] ntfs␍␊
[ 6.592918] ntfs3␍␊
[ 6.612939] fuseblk␍␊
[ 6.632412] btrfs␍␊
[ 6.651515] ␍␊
[ 6.686959] Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(179,2)␍␊
[ 6.711469] CPU: 0 PID: 1 Comm: swapper/0 Not tainted 6.10.0-rc2+ #19␍␊
[ 6.733724] Call Trace:␍␊
[ 6.751353] [] dump_backtrace+0x1c/0x24␍␊
[ 6.771925] [] show_stack+0x2c/0x38␍␊
[ 6.791716] [] dump_stack_lvl+0x50/0x72␍␊
[ 6.811392] [] dump_stack+0x14/0x1c␍␊
[ 6.830170] [] panic+0xf8/0x2b0␍␊
[ 6.848127] [] mount_root_generic+0x1ec/0x2a2␍␊
[ 6.866987] [] mount_root+0x164/0x180␍␊
[ 6.884610] [] prepare_namespace+0x1fc/0x258␍␊
[ 6.902483] [] kernel_init_freeable+0x1f8/0x214␍␊
[ 6.920289] [] kernel_init+0x1e/0x11a␍␊
[ 6.936668] [] ret_from_fork+0xe/0x1c␍␊
[ 6.952642] SMP: stopping secondary CPUs␍␊
[ 6.966952] ---[ end Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(179,2) ]---␍␊

@Dolu1990
Copy link
Member Author

Dolu1990 commented Dec 8, 2024

Hi,

hmm i never had a error like this.
Do you have another sdcard in hand ? (another brand / generation)
To double check if the error is persisstant.

Also, can you try to check the integrity of root volume using a sdcard reader ?

@sitestudio
Copy link

Wow - it was the SD card - it was a 32GB Aigo.

Got it booting with a 64GB Ultra Sandisk.

@Dolu1990
Copy link
Member Author

Dolu1990 commented Dec 8, 2024

Nice :D

@sitestudio
Copy link

Hi,

When trying to run the abovementioned "python3 -m litex_boards.targets.efinix_ti375_c529_dev_kit ...." command, getting the following error:

/bin/sh: 1: cd: can't cd to /home/andymc/projects/TI375_Debian/build/tools/litex/pythondata-cpu-vexiiriscv/pythondata_cpu_vexiiriscv/verilog/ext/VexiiRiscv

The folders ext and VexiiRiscv are not there.

Is there some installation procedure missing to get them to appear?

@Dolu1990
Copy link
Member Author

Hi @sitestudio
My bad, i forgot to remove the --update-repo=no from the argument list ^^

I updated the command above. (just removed --update-repo=no)
Should be all good then.

@sitestudio
Copy link

Hi @Dolu1990

Running the same now getting:

File "/home/andymc/projects/TI375_Debian/build/tools/litex/litex-boards/litex_boards/targets/efinix_ti375_c529_dev_kit.py", line 67, in init
self.reset_timer = reset_timer = ClockDomainsRenamer("rst")(WaitTimer(25e-6*platform.default_clk_freq))
AttributeError: 'Platform' object has no attribute 'default_clk_freq'. Did you mean: 'default_clk_name'?

Only other change was to manually set
os.environ["LITEX_ENV_EFINITY"] = "/home/andymc/apps/efinity/2024.1"

in both programmer.py and platform.py (am guessing they can go in a .env file somewhere)

@sitestudio
Copy link

Added:

default_clk_freq = 100e6

to efinix_ti375_c529_dev_kit.py, getting further now.

@sitestudio
Copy link

Hi @Dolu1990

Now getting an error regarding USB:

USB OHCI netlist : UsbOhciWishbone_Dw32_Pc4_Pf60000000
Generating USB OHCI netlist
!!! cd /home/andymc/projects/TI375_Debian/build/tools/litex/pythondata-misc-usb_ohci/pythondata_misc_usb_ohci/verilog/ext/SpinalHDL && sbt "lib/runMain spinal.lib.com.usb.ohci.UsbOhciWishbone --port-count=4 --phy-frequency=60000000 --dma-width=32 --netlist-name=UsbOhciWishbone_Dw32_Pc4_Pf60000000 --netlist-directory=/home/andymc/projects/TI375_Debian/build/tools/litex/pythondata-misc-usb_ohci/pythondata_misc_usb_ohci/verilog"
[warn] No sbt.version set in project/build.properties, base directory: /home/andymc/projects/TI375_Debian/build/tools/litex/pythondata-misc-usb_ohci/pythondata_misc_usb_ohci/verilog/ext/SpinalHDL
[info] welcome to sbt 1.10.6 (Private Build Java 19.0.2)
[info] set current project to spinalhdl (in build file:/home/andymc/projects/TI375_Debian/build/tools/litex/pythondata-misc-usb_ohci/pythondata_misc_usb_ohci/verilog/ext/SpinalHDL/)
[error] Expected ID character
[error] Not a valid command: lib (similar: alias, plugin, client)
[error] Expected project ID
[error] Expected configuration
[error] Expected ':'
[error] Expected key
[error] Not a valid key: lib (similar: ivySbt)
[error] lib/runMain spinal.lib.com.usb.ohci.UsbOhciWishbone --port-count=4 --phy-frequency=60000000 --dma-width=32 --netlist-name=UsbOhciWishbone_Dw32_Pc4_Pf60000000 --netlist-directory=/home/andymc/projects/TI375_Debian/build/tools/litex/pythondata-misc-usb_ohci/pythondata_misc_usb_ohci/verilog
[error] ^

@Dolu1990
Copy link
Member Author

Can you check in /home/andymc/projects/TI375_Debian/build/tools/litex/pythondata-misc-usb_ohci/pythondata_misc_usb_ohci/verilog/ext/SpinalHDL/project/build.properties

?
It the file existing ?
You can update it to sbt.version=1.10.0
To see if it fixes it ?

@sitestudio
Copy link

No verilog/ext/SpinalHDL/ folder tree below the pythondata_misc_usb_ohci folder so it looks like it is not setting up.

Will investigate, I should learn the Litex ecosystem :)

@sitestudio
Copy link

Took out the --with-ohci and gets a bit futher to here.

CC bios.elf
/usr/lib/gcc-cross/riscv64-linux-gnu/11/../../../../riscv64-linux-gnu/bin/ld: ../libc/libc.a(libc_ssp_chk_fail.c.o): in function __chk_fail': /home/andymc/projects/TI375_Debian/build/work/build/efinix_ti375_c529_dev_kit/software/libc/../../../../../tools/litex/pythondata-software-picolibc/pythondata_software_picolibc/data/newlib/libc/ssp/chk_fail.c:13: undefined reference to write'
collect2: error: ld returned 1 exit status
make: *** [/home/andymc/projects/TI375_Debian/build/tools/litex/litex/litex/soc/software/bios/Makefile:72: bios.elf] Error 1
rm crt0.o
make: Leaving directory '/home/andymc/projects/TI375_Debian/build/work/build/efinix_ti375_c529_dev_kit/software/bios'
Traceback (most recent call last):
File "/usr/lib/python3.10/runpy.py", line 196, in _run_module_as_main
return _run_code(code, main_globals, None,
File "/usr/lib/python3.10/runpy.py", line 86, in _run_code
exec(code, run_globals)
File "/home/andymc/projects/TI375_Debian/build/tools/litex/litex-boards/litex_boards/targets/efinix_ti375_c529_dev_kit.py", line 735, in

Will keep playing around with it.

@Dolu1990
Copy link
Member Author

The OHCI thing should be fixed via this PR :
enjoy-digital/litex#2135

Basicaly, the repo wasn't cloned recursively XD

@Dolu1990
Copy link
Member Author

/usr/lib/gcc-cross/riscv64-linux-gnu/11/../../../../riscv64-linux-gnu/bin/ld: ../libc/libc.a(libc_ssp_chk_fail.c.o): in function __chk_fail':

Ahhh i would say this is related to the RISC-V GCC you have installed.

Looking at litex, i can see a few ways to get the RISC-V gcc :
enjoy-digital/litex@e148650#diff-0b495d6b6e69eaf0a0657f8daa6a92c8f838a6329ad7d378db7183d96e0f759dR357

So for instance on debian : apt install gcc-riscv64-unknown-elf

@sitestudio
Copy link

All building now, a bit of a tricky path to get it working. Will write up the steps needed in my case and post here.

Thanks for your help @Dolu1990

@Dolu1990
Copy link
Member Author

Nice ^^
Yes please, let me know anything which isn't fixed that you had to workaround

Cheers

@esyvjlomh
Copy link

Hello @Dolu1990
I am just try to run the commands which could generate an SoC (both in this issue and in the online documentation -- SoC -- LiteX), but seems like the commit ("ca10ab58") that the python commands use has some problems like this screenshot below:
image

Then I try to change the commit to the newest ("7f7c754") in core.py, and the response is like:
image

Maybe something in the python script should be changed?

Appreciate it if some guidance can be given!

@Dolu1990
Copy link
Member Author

Dolu1990 commented Jan 3, 2025

ca10ab5

It seems like you have a old version of litex. It should be b4269dd :
https://github.com/enjoy-digital/litex/blob/e3dcfbde60ee5965f4365cfdfe22cf9c7552a53a/litex/soc/cores/cpu/vexiiriscv/core.py#L159

Note there is this vexii litex argument you can use to force the repo :
--update-repo {latest,wipe+latest,recommended,wipe+recommended,no}
Specify how the VexiiRiscv & SpinalHDL repo should be updated (latest: update to HEAD, recommended: Update to
known compatible version, no: Don't update, wipe+*: Do clean&reset before checkout) (default: recommended)

@esyvjlomh
Copy link

ca10ab5

It seems like you have a old version of litex. It should be b4269dd : https://github.com/enjoy-digital/litex/blob/e3dcfbde60ee5965f4365cfdfe22cf9c7552a53a/litex/soc/cores/cpu/vexiiriscv/core.py#L159

Note there is this vexii litex argument you can use to force the repo : --update-repo {latest,wipe+latest,recommended,wipe+recommended,no} Specify how the VexiiRiscv & SpinalHDL repo should be updated (latest: update to HEAD, recommended: Update to known compatible version, no: Don't update, wipe+*: Do clean&reset before checkout) (default: recommended)

That works well. Thank you so much!

@Dolu1990 Dolu1990 closed this as completed Jan 6, 2025
@Dolu1990 Dolu1990 reopened this Jan 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants