sifive / freedom

Source files for SiFive's Freedom platforms
Apache License 2.0
1.11k stars 286 forks source link

Need Assistance to Make U500-VC707 to Run Liunx #131

Closed notusedanymore2 closed 5 years ago

notusedanymore2 commented 5 years ago

Currently I have VC707 board only, without any FMC-PCIe board and PCIe switch/device. I'm trying to program VC707 with U500 .mcs file and boot Linux, but I'm not sure I'm doing right.

  1. Generate .mcs/.prm for Programming VC707

    $ git clone https://github.com/sifive/freedom.git
    $ cd freedom
    $ git submodule update --init --recursive
    $ export RISCV=/where/riscv_tools/located
    $ source /where/Xilinx/Vivado/located/settings64.sh
    $ make -f Makefile.vc707-u500devkit mcs
  2. Generate SD Boot Image

    $ git clone https://github.com/sifive/freedom-u-sdk.git
    $ cd freedom-u-sdk
    $ git submodule update --recursive --init
    $ make
    $ sudo make DISK=/dev/sd_card_location format-boot-loader
  3. Programming FPGA with .mcs/.prm

  4. Plug USB Type-A to mini-USB cable to JTAG port on VC707's backplate

  5. Setting SW11 to 11010 on VC707

  6. Power-up VC707

  7. Open Vivado 2016.4

  8. Open Hardware Manager

  9. Create Configuration Memory Device(mt28gu01gaaxle-bpi-x16)

  10. select .mcs/.prm

  11. State of non-config mem I/O pins: Pull-none

  12. Address Range: Configuration File Only

  13. RS Pins: 25:24

  14. Erase: Yes

  15. Blank Check: No

  16. Program: Yes

  17. Verify: Yes

  18. Verify Checksum: No

  19. Prepare to Boot Linux

  20. Insert programmed 16GB SDHC card to VC707 board

  21. Plug USB Type-A to micro-USB cable to UART port on VC707's backplate

  22. $ sudo minicom /dev/ttyUSB0

But I don't have anything printed on minicom screen, also everytime I turn VC707 off the FPGA returns to unprogrammed state or the configuration memory gets deleted.

Any help I would be thankful for.

tmagik commented 5 years ago

The vc707 'rom' bootloader needs to be updated to support GPT partitions before the master branch freedom-u-sdk branch will work.

notusedanymore2 commented 5 years ago

The vc707 'rom' bootloader needs to be updated to support GPT partitions before the master branch freedom-u-sdk branch will work.

Then what should I do? linux_u500vc707devkit_config branch of freedom-u-sdk is broken due to broken buildroot/m4. Should I just patch the resoultion to linux_u500vc707devkit_config branch?

erikdanie commented 5 years ago

If you don't have the PCIe module, you should comment out the PCIe line as follows before generating the bitstream (note, a target to make this directly with no code edits is being worked on and will be merged in the next few days)

fpga-shells/src/main/scala/shell/xilinx/VC707NewShell.scala line 213 should change from val pcie = Overlay(PCIeOverlayKey) (new PCIeVC707Overlay (_, _, _)) to // val pcie = Overlay(PCIeOverlayKey) (new PCIeVC707Overlay (_, _, _))

This is because with this option, the build assumes you will have the pcie, and will use the clock from the oscillator on that board as the main clock, thus, without it the core will remain stuck in reset.

mcd500 commented 5 years ago

Hi @minmossi. I have been doing the same as making the vc707 boot linux with and without FMC-PCIe board. I am middle up upstreaming with the help from @erikdanie, in these discussion. https://github.com/sifive/freedom/issues/116 https://github.com/sifive/fpga-shells/pull/64 https://github.com/sifive/freedom/pull/118 In the mean time you could try my repo. First download riscv64-elf-gcc-8.2 from here and untar it some place in your home directory.

  1. Generate .mcs/.prm for Programming VC707

    $ git clone https://github.com/mcd500/freedom.git
    $ cd freedom
    $ git checkout vc707-nopcie-switchable-mcd500
    $ git submodule update --init --recursive
    $ export RISCV=/home/where_is_gcc/riscv64-elf-gcc-8.2
    $ export PATH=/where_is_Vivado/2016.4/bin/:/home/where_is_gcc/riscv64-elf-gcc-8.2/bin/:${PATH}
    $ make MODEL=VC707BaseShell -f Makefile.vc707-u500devkit verilog -j `nproc`
    $ make MODEL=VC707BaseShell -f Makefile.vc707-u500devkit mcs -j `nproc`

    And then write the bitstream to vc707.

  2. Generate SD Boot Image

    $ git clone https://github.com/mcd500/freedom.git
    $ cd freedom-u-sdk
    $ git checkout linux_u500vc707devkit_config
    $ git submodule update --init --recursive
    $ make BOARD=vc707devkit_nopci -j `nproc`
    $ sudo make DISK=/dev/sd_card_location  vc707-sd-write

    Then turn on vc707 with the sd card and see the serial console. It should show up boot message. Please let me know if anything does not work.

notusedanymore2 commented 5 years ago

I was able to fully synthesizing U500 for VC707 and boot Linux.

If you don't have HMC-PCIe daughter board, like me, you can use mcd500's repository following above, thanks Tsukamoto!

Those who using glibc > 2,28(like the ones who using latest Ubuntu), you need to patch this to work/build_initramfs/build/host-m4-1.4.17 in freedom-u-sdk local repository.

Closing this issue now.

mcd500 commented 5 years ago

Hi @minmossi, you are most welcome! I have a lot to upstream. I also made freedom-u-sdk on vc707 to read gpt partition of SD card and then making debian rootfs to boot from SD card on vc707. Need to cleanup and finish upstreaming.

manox commented 4 years ago

Hi @mcd500 , I am very interested in reading GPT partitions and booting debian on VCU118. Did you publish your work for VC707 in the meantime?

mcd500 commented 4 years ago

Hi @manox, seems like I completely forgotten to upstream to here. But I upstream the sd card partitioning part at here. Reading the GPT partitions and booting on the vcu118 is probably the same. https://github.com/keystone-enclave/keystone/blob/master/KEYSTONE-FPGA.md#prepare-keystone-bootable-sd-card