AN 669: Drive-On-Chip Design Example for Cyclone V Devices

ID 683466
Date 5/15/2022
Public
Document Table of Contents

5.5. Creating and Booting a SD Card with both Software Image and Hardware Image

You create a bootable SD card that contains both the software image and hardware image, so you can boot the software automatically without using the Arm Development Studio Debugger and you do not need to program the FPGA every single time.
  1. Create a bootable SD card image using the prebuilt image that the SoC EDS includes.
    1. On Windows, download and install an SD card image writing utility, for example balenaEtcher or win32diskimager.
    2. Find the bootable image for your development board.
      For the Cyclone SoC development board find CycloneV_Linux_SDCard .img in the Intel SoC EDS default installation directory: C:\intelFPGA\17.0\embedded\embeddedsw\socfpga\prebuilt_images\CycloneV_Linux_SDCard.tar.gz
    3. Launch SOC EDS Command Shell as an administrator, and change the current directory to the prebuilt_images directory by typing:
      cd ‘C:\intelFPGA\17.0\embedded\embeddedsw\socfpga\prebuilt_images’
    4. Untar the compressed image file by typing:.
      tar -xf CycloneV_Linux_SDCard.tar.gz
    5. Write the bootable image, CycloneV_Linux_SDCard.img, with your SD card image writing utility on Windows or dd command on Linux onto your SD card.
  2. Update the preloader with the binary image made from the Drive-On-Chip design.
    1. Type cd <project_dir>/software/spl_bsp in the SoC EDS command shell.
    2. Write the preloader image into the proper location in your SD card by typing:
      alt-boot-disk-util -p preloader-mkpimage.bin -a write -d <sdcard_drive_letter> .
      Where <sdcard_drive> is the drive your SD card appears as on your computer.
  3. On the Cyclone V SoC development board, set SW3 (MSEL) to ON-OFF-ON-OFF-ON (0:Up, 1:Down, 2:Up, 3:Down, 4:Up)
  4. Open a Nios II command window, go to <project_dir>\output_files by typing:
    cd <project_dir>\output_files
  5. Generate soc_system.rbf from DOC_TANDEM_CVSX.sof by typing this command in the Nios II command window.
    quartus_cpf -c -o bitstream_compression=on DOC_TANDEM_CVSX.sof soc_system.rbf
  6. Copy soc_system.rbf to the FAT partition on the SD card.
  7. Copy doc_tandem_cvsx.bin from the <project_dir>\software\DOC_TANDEM_CVSX to the FAT partition on the SD card.
  8. Enter U-boot
    1. Unmount the SD card from PC, then insert the SD card in the development board.
    2. Open your Terminal Emulator software and connect to the USB serial port on the development board.
    3. Apply power to the development board.
    4. Press a key in the terminal window when prompted, before the countdown finishes and the operating system boots.
  9. At the U-Boot prompt, edit the U-Boot environment variables and save them by typing:
    setenv fpgaconfig 'fatload mmc 0 $fpgadata $fpgarbffile; fpga load 0 $fpgadata $filesize; run bridge_enable_handoff'
    setenv fpgarbffile soc_system.rbf
    setenv docload 'fatload mmc 0 1000000 doc_tandem_cvsx.bin'
    setenv bootcmd 'run fpgaconfig; run docload; go 1000000'
    saveenv
  10. Power cycle the development board or reset by pushing Cold reset push button (S7). In the terminal window you will see the sequence: U-Boot starts to count down, then FPGA is configured and the DriveOnChip software is downloaded and started.
    Figure 5. Application starts-up
  11. Apply power to the power board when you see this message in terminal console
    ---> DC input voltage error - Check power connection.
    Figure 6. Application is ready for power board powered-up
The motor starts to turn.