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

litex_sim hangs when adding a call to a function in libliteeth #2110

Open
jersey99 opened this issue Oct 30, 2024 · 1 comment
Open

litex_sim hangs when adding a call to a function in libliteeth #2110

jersey99 opened this issue Oct 30, 2024 · 1 comment

Comments

@jersey99
Copy link
Collaborator

jersey99 commented Oct 30, 2024

To reproduce:

litex_sim.py --with-ethernet --local-ip 192.168.2.50 --remote-ip 192.168.2.100 --integrated-main-ram-size=0x10000 --cpu-type=vexriscv --no-compile-gateware
BUILD_DIR=../build/sim make -C demo clean all
litex_sim.py --with-ethernet --local-ip 192.168.2.50 --remote-ip 192.168.2.100 --integrated-main-ram-size=0x10000 --cpu-type=vexriscv --ram-init=demo/demo.bin

This needs to be run with the patch below, on main.c

10a11
> #include <libliteeth/udp.h>
204a206,209
> #ifdef CSR_ETHMAC_BASE
>     printf("foo\n");
>     eth_init();
> #endif

This should hang, right after


[clocker] loaded
[jtagremote] loaded (0x555cc8604ef0)
[xgmii_ethernet] loaded (0x555cc8604ef0)
[gmii_ethernet] loaded (0x555cc8604ef0)
[serial2console] loaded (0x555cc8604ef0)
[serial2tcp] loaded (0x555cc8604ef0)
[ethernet] loaded (0x555cc8604ef0)
[spdeeprom] loaded (addr = 0x0)
[clocker] sys_clk: freq_hz=1000000, phase_deg=0

        __   _ __      _  __
       / /  (_) /____ | |/_/
      / /__/ / __/ -_)>  <
     /____/_/\__/\__/_/|_|
   Build your hardware, easily!

 (c) Copyright 2012-2024 Enjoy-Digital
 (c) Copyright 2007-2015 M-Labs

 BIOS built on Oct 29 2024 18:48:01
 BIOS CRC passed (98c60667)

 LiteX git sha1: fd9c636e7

--=============== SoC ==================--
CPU:		VexRiscv @ 1MHz
BUS:		wishbone 32-bit @ 4GiB
CSR:		32-bit data
ROM:		128.0KiB
SRAM:		8.0KiB
MAIN-RAM:	64.0KiB

--========== Initialization ============--


--============== Boot ==================--
Booting from serial...
Press Q or ESC to abort boot completely.
sL5DdSMmkekro
Timeout
Executing booted program at 0x40000000

--============= Liftoff! ===============--

Any thoughts?

@trabucayre
Copy link
Collaborator

Hi,
I'm able to reproduce your issue and in fact its also reproducible with a physical target.
I have tried to use openocd + gdb to see why the CPU hangs.

To do that I have added a breakpoint on printf just before eth_init call:

  • with eth_init commented: execution stop at this specific line, ie to code is fine
  • with eth_init un-commented: CPU never execute this instruction and remains somewhere between trap_entry and isr

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

2 participants