2.1 SPI-DirectC Code Integration

The following figure shows the SPI-DirectC integration use flow.

Figure 2-1. Importing SPI-DirectC Files

To use SPI-DirectC code integration:

  1. Import the SPI-DirectC files into your development environment as shown in the following figure.
    Figure 2-2. SPI-DirectC Files to Import into your Development Environment
  2. Modify the SPI-DirectC code.
    • Add the SPI driver (available with the processor used to run SPI-DirectC).
    • Modify the hardware interface functions (do_SPI_SCAN_in and do_SPI_SCAN_out) to use the hardware API functions designed to control the SPI port.
    • Modify memory access functions to access the data blocks within the image file programmed into the system memory. See Data File Bit Orientation for more details.
    • Call dp_top with the action code desired.
  3. Compile the source code. This creates a binary executable that is downloaded to the system for execution.