Nios® V Processor Software Developer Handbook

ID 743810
Date 10/12/2024
Public
Document Table of Contents

13.3.6.2. Integrating Device Drivers with Initialization Manually

You must copy the driver into the BSP directory. Modify the BSP CMakeLists.txt to include the driver files in the BSP build. For instance, to copy the Mailbox Client IP driver into your BSP build, you can use the following instructions after you build your BSP:
  1. Navigate to the <BSP project folder>/drivers.
  2. Separately navigate to <Quartus Prime directory>/<Version>/ip/altera/pgm/altera_s10_mailbox_client/HAL.
  3. Observe that both folder directories are having the same – inc and src files.
  4. Copy the contents of Quartus® Prime HAL folders into the BSP drivers folders respectively.
  5. Navigate to <Quartus Prime directory>/<version>/ip/altera/pgm/altera_s10_mailbox_client/inc.
  6. Copy altera_s10_mailbox_client_regs.h into the BSP drivers/inc folder.
  7. Verify the content of the BSP inc folder contains the files in the following figure.
    Figure 24. BSP inc folder
  8. Verify the content of the BSP src folder contains the files in the following figure.
    Figure 25. BSP src folder
  9. Modify the target_sources in BSP CMakeLists.txt.
    1. Add the following C files in the PRIVATE column:

      drivers/src/altera_s10_mailbox_client.c

      drivers/src/altera_s10_mailbox_client_flash.c

      drivers/src/altera_s10_mailbox_client_flash_rsu.c

      drivers/src/altera_s10_mailbox_client_rsu.c

      drivers/src/librsu.c

      drivers/src/librsu_cb.c

      drivers/src/librsu_cfg.c

      drivers/src/librsu_ll_qspi.c

      drivers/src/librsu_misc.c

      drivers/src/rsu_client.c

    2. Add the header files in the PUBLIC column.

      drivers/inc/altera_s10_mailbox_client.h

      drivers/inc/altera_s10_mailbox_client_flash.h

      drivers/inc/altera_s10_mailbox_client_flash_rsu.h

      drivers/inc/altera_s10_mailbox_client_regs.h

      drivers/inc/altera_s10_mailbox_client_rsu.h

      drivers/inc/librsu.h

      drivers/inc/librsu_cb.h

      drivers/inc/librsu_cfg.h

      drivers/inc/librsu_ll.h

      drivers/inc/librsu_misc.h

      drivers/inc/rsu_client.h

  10. Modify the alt_sys_init.c in the following sections:
    • Device headers.
      • #include "altera_s10_mailbox_client.h"
    • Allocate the device storage.
      • ALTERA_S10_MAILBOX_CLIENT_INSTANCE ( MAILBOX_CLIENT, mailbox_client);
    • Initialize non-interrupt controller device.
      • ALTERA_S10_MAILBOX_CLIENT_INIT ( MAILBOX_CLIENT, mailbox_client);
  11. Proceed to compile the software project.