Configuration for driver project

Directory structure of the full system

.
├── drivers
│   ├── fn-inc                        : link to the FN include library (`../HyperVisor/fn/Inc/`)
│   ├── gsoap                         : link to the gsoap library (`../HyperVisor/fn/gsoap/`)
│   ├── driver1
│   │   ├── docs                      : Documentation of the driver
│   │   ├── res                       : Resources of the driver
│   │   │   ├── build.sh              : script called by eclipse
│   │   │   ├── mklib.sh              : script used by build.sh script
│   │   │   ├── "fpga configurations"
│   │   │   └── "uKernels"
│   │   └── "Source files of the driver"
│   ├── driver2
│   ├── "...."
│   └── "...."
├── tools                         : directories with various useful scripts and tools
├── HyperVisor                    : Source of hypervisor.
└── FPGA                          : All the FPGA projects
    ├── fn-fpga-lib               : Library with common components
    ├── drivers                   : all the FPGA drivers
    │   ├── pod-template          : standard implementation common to all drivers
    │   ├── driver1
    │   │   ├── doc               : Documentation of the driver
    │   │   ├── src               : source code
    │   │   ├── testbench         : source code for the testbench
    │   │   └── modelsim          : modelsim files
    │   ├── driver2
    │   ├── "..."
    ├── soc_fl1-21                : source code for the FL2 hw board
    │   ├── src                   : source code
    │   └── Vivado                : projects file of all the drivers
    ├── fn-pod                    : surce code for the TOP of the legacy POD FPGA
    └── com-core                  : com_core module used by legacy Master and POD FPGA

Eclipse project configuration

NOTE: Before launching the Eclipse IDE you must source the SDK environment file (example: "source {sdk install dir}/environment-setup-cortexa9t2hf-neon-xilinx-linux-gnueabi")

For new driver projects:

  • create a new C Managed Build
  • Select Shared Library->Empty Project
  • Toolchain: Cross GCC

For every eclipse driver project perform the following configuration. All these settings need to be done for both Debug and Release configurations.

  • C/C++ General->Paths and Symbols
  • Includes (GNU C)
    • ../fn-inc
    • ../gsoap
  • Symbols
    • __FN_ALGO__
    • _FILE_OFFSET_BITS = 64
    • Only for debug configuration: DEBUG
  • Library Path
    • Res
  • C/C++ Build -> Settings -> Tool Settings
  • Cross GCC Compiler
    • Command: ${CC}
    • Other dialect flags: -std=gnu11
    • Optimization: Debug-> -O1 | Relase -> -O3
  • Warnings
    • All warnings
    • Extra Warnings
    • Warnings as Error
  • Miscellaneous
    • Position Independent Code
  • Cross GCC Linker
    • Command: ${CC}
    • Miscellaneous (In this exact order)
    • --whole-archive
    • -lres
    • --no-whole-archive
    • -z
    • noexecstack
  • Cross GCC Assembler
    • Command: ${AS}
  • C/C++ Build -> Settings -> Build Steps
  • Pre-build steps
    • Command: ../Res/build.sh
  • Post-build steps
    • Command: ../../../tools/dllCrypt -i drv_${ProjName}.so -o drv_${ProjName}.dll.so
  • C/C++ Build -> Settings -> Build Artifact
  • Artifact name: ${ProjName}
  • Artifact extension: so
  • Output Prefix: drv_

If the driver uses uKernels, select the uKernels subdirectory in the Project Explorer and set it as Exclude from build

Start a new driver using the Template

One of the project on Bitbucket along the driver is called template, this is a template ready to be used to start developing a new driver.

To start a new drive just download this repository alongside the other driver, from the shell enter into this directory and execute the script newDriver.sh.

Usage: ./newDriver.sh \<driverName> \<protocolName>

The first argument to the script is the name of the new driver to be created, the second argument is the comunication protocol used by this driver.

for example:

./newDriver stm32 swd

This command create a directory stm32 at the same level of the template directory and initialize all the files required for this driver to compile.