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

Linux boot stuck at bootcmd execution #95

Open
1 task done
Heomere opened this issue Jun 4, 2024 · 0 comments
Open
1 task done

Linux boot stuck at bootcmd execution #95

Heomere opened this issue Jun 4, 2024 · 0 comments
Labels
task A project task

Comments

@Heomere
Copy link

Heomere commented Jun 4, 2024

Is there an existing CVA6-SDK task for this?

  • I have searched the existing task issues

Task Description

Hello,

I am trying to boot Linux on the cv32a6 running on the Nexys video target which has been recently added to the cva6 support. I followed the instructions from the Readme to build my image using make images and flashing the results on a 4Gb SD card using sudo -E make flash-sdcard SDDEVICE=<my_device>.
The OpenSBI firmware and the u-boot seem to execute properly but the boot process gets stuck at the execution of the bootcmd of u-boot to get the kernel. Here is what I get when booting :

Hello World!
init SPI
status: 0x0000000000000025
status: 0x0000000000000025
SPI initialized!
initializing SD...
SD command cmd0         response : 01
SD command cmd55        response : 01
SD command cmd41        response : 01
SD command cmd55        response : 01
SD command cmd41        response : 01
SD command cmd55        response : 01
SD command cmd41        response : 01
SD command cmd55        response : 01
SD command cmd41        response : 01
SD command cmd55        response : 01
SD command cmd41        response : 00
sd initialized!
gpt partition table header:
        signature:      5452415020494645
        revision:       00010000
        size:           0000005C
        crc_header:     A1C813DD
        reserved:       00000000
        current lba:    0000000000000001
        backup lda:     0000000000747FFF
        partition entries lba:          0000000000000002
        number partition entries:       00000080
        size partition entries:         00000080
gpt partition entry 00
        partition type guid:    D5F7127456A1134B81DC867174929325
        partition guid:         EE9DD9C1C20E7C4689F3DD39521A8723
        first lba:      0000000000000800
        last lba:       0000000000002B6B
        attributes:     0000000000000000
        name:   000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
gpt partition entry 01
        partition type guid:    AF3DC60F838472478E793D69D8477DE4
        partition guid:         37BB12CA47E46A4C9406CE014A04194E
        first lba:      0000000000100000
        last lba:       0000000000747FDE
        attributes:     0000000000000000
        name:   000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
gpt partition entry 02
        partition type guid:    00000000000000000000000000000000
        partition guid:         00000000000000000000000000000000
        first lba:      0000000000000000
        last lba:       0000000000000000
        attributes:     0000000000000000
        name:   000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
gpt partition entry 03
        partition type guid:    00000000000000000000000000000000
        partition guid:         00000000000000000000000000000000
        first lba:      0000000000000000
        last lba:       0000000000000000
        attributes:     0000000000000000
        name:   000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
copying boot image ......... done!

OpenSBI v0.9
   ____                    _____ ____ _____
  / __ \                  / ____|  _ \_   _|
 | |  | |_ __   ___ _ __ | (___ | |_) || |
 | |  | | '_ \ / _ \ '_ \ \___ \|  _ < | |
 | |__| | |_) |  __/ | | |____) | |_) || |_
  \____/| .__/ \___|_| |_|_____/|____/_____|
        | |
        |_|

Platform Name             : ARIANE RISC-V
Platform Features         : medeleg
Platform HART Count       : 1
Platform IPI Device       : aclint-mswi
Platform Timer Device     : aclint-mtimer @ 1000000Hz
Platform Console Device   : uart8250
Platform HSM Device       : ---
Platform Reboot Device    : ---
Platform Shutdown Device  : ---
Firmware Base             : 0x80000000
Firmware Size             : 196 KB
Runtime SBI Version       : 0.3

Domain0 Name              : root
Domain0 Boot HART         : 0
Domain0 HARTs             : 0*
Domain0 Region00          : 0x02008000-0x0200bfff (I)
Domain0 Region01          : 0x02000000-0x02007fff (I)
Domain0 Region02          : 0x80000000-0x8003ffff ()
Domain0 Region03          : 0x00000000-0xffffffff (R,W,X)
Domain0 Next Address      : 0x80400000
Domain0 Next Arg1         : 0x82200000
Domain0 Next Mode         : S-mode
Domain0 SysReset          : yes

Boot HART ID              : 0
Boot HART Domain          : root
Boot HART ISA             : rv32imasu
Boot HART Features        : scounteren,mcounteren
Boot HART PMP Count       : 0
Boot HART PMP Granularity : 0
Boot HART PMP Address Bits: 0
Boot HART MHPM Count      : 0
Boot HART MIDELEG         : 0x00000222
Boot HART MEDELEG         : 0x0000b109


U-Boot 2021.07-rc4-g920075ecfa-dirty (Jun 04 2024 - 10:01:34 +0200)

CPU:   rv32ima
Model: eth,ariane-bare
DRAM:  128 MiB
MMC:   xps-spi@20000000:mmc@0: 0
Loading Environment from nowhere... OK
In:    uart@10000000
Out:   uart@10000000
Err:   uart@10000000
Net:   No ethernet found.
Hit any key to stop autoboot:  0

When the countdown hits 0, it then hang there without output message. This corresponds to the execution of the boot command configured in u-boot : CONFIG_BOOTCOMMAND="mmc info; mmc read 90000000 100000 7000; setenv fdt_high 0xffffffff; bootm 90000000 - $(fdtcontroladdr)". I observe the same behavior if I manually run mmc command which try to access the mmc device (e.g mmc info, mmc dev, mmc read, ...) : the system gets stuck without error message.

In order to run on the new target, I had to add/modify a few files in the configuration :

  • added u-boot/configs/openhwgroup_cv32a6_nexys_defconfig :
CONFIG_RISCV=y
CONFIG_DEFAULT_DEVICE_TREE="cv32a6_nexys"
CONFIG_TARGET_OPENHWGROUP_CVA6_GENESYSII=y
CONFIG_RISCV_SMODE=y
# CONFIG_RISCV_ISA_C is not set
CONFIG_OF_BOARD_SETUP=y
CONFIG_BOOTDELAY=5
CONFIG_USE_BOOTCOMMAND=y
CONFIG_BOOTCOMMAND="mmc info; mmc read 90000000 100000 7000; setenv fdt_high 0xffffffff; bootm 90000000 - $(fdtcontroladdr)"
CONFIG_DISPLAY_CPUINFO=y
CONFIG_SPL_SPI_FLASH_MTD=y
CONFIG_CMD_GPT=y
# CONFIG_RANDOM_UUID is not set
CONFIG_CMD_MMC=y
CONFIG_CMD_MTD=y
CONFIG_CMD_PART=y
CONFIG_OF_EMBED=y
CONFIG_MMC=y
# CONFIG_MMC_WRITE is not set
CONFIG_MMC_SPI=y
CONFIG_DM_MTD=y
CONFIG_MTD_SPI_NAND=y
CONFIG_SPI_FLASH_ATMEL=y
CONFIG_SPI_FLASH_EON=y
CONFIG_SPI_FLASH_GIGADEVICE=y
CONFIG_SPI_FLASH_ISSI=y
CONFIG_SPI_FLASH_MACRONIX=y
CONFIG_SPI_FLASH_SPANSION=y
CONFIG_SPI_FLASH_STMICRO=y
CONFIG_SPI_FLASH_SST=y
CONFIG_SPI_FLASH_WINBOND=y
CONFIG_SPI_FLASH_XMC=y
# CONFIG_SPI_FLASH_USE_4K_SECTORS is not set
CONFIG_SPI_FLASH_MTD=y
CONFIG_SYS_NS16550=y
CONFIG_SPI=y
CONFIG_XILINX_SPI=y

CONFIG_BAUDRATE=57600

CONFIG_DISPLAY_BOARDINFO=y

Changed uboot baudrate to match the baudrate required by the nexys uart.
Changed device tree target (see next point)

  • added u-boot/arch/riscv/dts/cv32a6_nexys.dts :
/dts-v1/;

/ {
  #address-cells = <1>;
  #size-cells = <1>;
  compatible = "eth,ariane-bare-dev";
  model = "eth,ariane-bare";
  chosen {
    stdout-path = "/soc/uart@10000000:57600";
  };
  cpus {
    #address-cells = <1>;
    #size-cells = <0>;
    timebase-frequency = <12500000 >;
    CPU0: cpu@0 {
      clock-frequency = <25000000 >;
      device_type = "cpu";
      reg = <0>;
      status = "okay";
      compatible = "eth, ariane", "riscv";
      riscv,isa = "rv32ima";
      mmu-type = "riscv,sv32";
      tlb-split;
      // HLIC - hart local interrupt controller
      CPU0_intc: interrupt-controller {
        #interrupt-cells = <1>;
        interrupt-controller;
        compatible = "riscv,cpu-intc";
      };
    };
  };
  memory@80000000 {
    device_type = "memory";
    reg = <0x80000000 0x08000000 >;
  };
  leds {
    compatible = "gpio-leds";
    heartbeat-led {
      gpios = <&xlnx_gpio 1 0>;
      linux,default-trigger = "heartbeat";
      retain-state-suspended;
    };
  };
  L26: soc {
    #address-cells = <1>;
    #size-cells = <1>;
    compatible = "eth,ariane-bare-soc", "simple-bus";
    ranges;
    clint@2000000 {
      compatible = "riscv,clint0";
      interrupts-extended = <&CPU0_intc 3 &CPU0_intc 7>;
      reg = <0x2000000 0xc0000>;
      reg-names = "control";
    };
    PLIC0: interrupt-controller@c000000 {
      #address-cells = <0>;
      #interrupt-cells = <1>;
      compatible = "riscv,plic0";
      interrupt-controller;
      interrupts-extended = <&CPU0_intc 11 &CPU0_intc 9>;
      reg = <0xc000000 0x4000000>;
      riscv,max-priority = <7>;
      riscv,ndev = <30>;
    };
    // Specifying the interrupt controller in the devicetree is not necessary.
    // Furthermore, the IRQ 65535 will cause a `hwirq 0xffff is too large` during
    // Linux boot (occured with mainline linux 5.14.0).
    // debug-controller@0 {
    //   compatible = "riscv,debug-013";
    //   interrupts-extended = <&CPU0_intc 65535>;
    //   reg = <0x0 0x1000>;
    //   reg-names = "control";
    // };
    uart@10000000 {
      compatible = "ns16550a";
      reg = < 0x10000000 0x1000>;
      clock-frequency = <25000000 >;
      current-speed = <57600>;
      interrupt-parent = <&PLIC0>;
      interrupts = <1>;
      reg-shift = <2>; // regs are spaced on 32 bit boundary
      reg-io-width = <4>; // only 32-bit access are supported
    };
    timer@18000000 {
      compatible = "pulp,apb_timer";
      interrupts = <0x00000004 0x00000005 0x00000006 0x00000007>;
      reg = <0x18000000 0x00001000>;
      interrupt-parent = <&PLIC0>;
      reg-names = "control";
    };
    xps-spi@20000000 {
      compatible = "xlnx,xps-spi-2.00.b", "xlnx,xps-spi-2.00.a";
      #address-cells = <1>;
      #size-cells = <0>;
      interrupt-parent = <&PLIC0>;
      interrupts = < 2 2 >;
      reg = < 0x20000000 0x1000 >;
      xlnx,family = "kintex7";
      xlnx,fifo-exist = <0x1>;
      xlnx,num-ss-bits = <0x1>;
      xlnx,num-transfer-bits = <0x8>;
      xlnx,sck-ratio = <0x4>;

      mmc@0 {
        compatible = "mmc-spi-slot";
        reg = <0>;
        spi-max-frequency = <12500000>;
        voltage-ranges = <3300 3300>;
        disable-wp;
      };

      // mmc-slot@0 {
      //   compatible = "fsl,mpc8323rdb-mmc-slot", "mmc-spi-slot";
      //   reg = <0>;  //Chip select 0
      //   spi-max-frequency = <12500000>;
      //   voltage-ranges = <3300 3300>;
      //   //interrupts = < 2 2 >;
      //   //interrupt-parent = <&PLIC0>;
      // };
    };
    eth: lowrisc-eth@30000000 {
      compatible = "lowrisc-eth";
      device_type = "network";
      interrupt-parent = <&PLIC0>;
      interrupts = <3 0>;
      local-mac-address = [00 18 3e 02 e3 7f]; // This needs to change if more than one GenesysII on a VLAN
      reg = <0x30000000 0x8000>;
    };
    xlnx_gpio: gpio@40000000 {
      #gpio-cells = <2>;
      compatible = "xlnx,xps-gpio-1.00.a";
      gpio-controller ;
      reg = <0x40000000 0x10000 >;
      xlnx,all-inputs = <0x0>;
      xlnx,all-inputs-2 = <0x0>;
      xlnx,dout-default = <0x0>;
      xlnx,dout-default-2 = <0x0>;
      xlnx,gpio-width = <0x8>;
      xlnx,gpio2-width = <0x8>;
      xlnx,interrupt-present = <0x0>;
      xlnx,is-dual = <0x1>;
      xlnx,tri-default = <0xffffffff>;
      xlnx,tri-default-2 = <0xffffffff>;
    };
  };
};
// delete ethernet device if disabled
/delete-node/ &eth; // DELETE_ETH

Device tree built from https://github.com/openhwgroup/cva6/tree/master/corev_apu/fpga/src/bootrom

I wonder what may be the issue? Where should I look at?

Thank a lot in advance !

Description of Done

I am sorry, I used the "task" template where I should have used of a blank issue.

@Heomere Heomere added the task A project task label Jun 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
task A project task
Projects
None yet
Development

No branches or pull requests

1 participant