AN 923: Routing Intel® Stratix® 10 HPS Peripherals to FPGA Fabric

ID 683838
Date 10/12/2020
Public

1.2.11. Building spidev Test Program

The test application is very simple, it creates a single SPI transfer composed of two buffers:
  • One 1-byte TX buffer containing the flash Read ID command
  • One 6-byte RX buffer containing the response from the flash to the Read ID command
  1. Go to the Accessing SPI Devices in Linux web page and scroll to the bottom of the page to the demo application that shows how to read the Flash ID from a SPI Flash device.
  2. Copy-paste the contents and save it as: spidev_flash_test.c.
  3. Compile the above C source code file:
    cd ~/s10_spim_fpga
    ${CROSS_COMPILE}gcc -static spidev_flash_test.c -o spidev_flash_test