Skip to content

Using the Register System

mshahbaz edited this page Jul 16, 2012 · 8 revisions

As a user of the register system, one only requires to update the makefile of the project and use the generated C/C++ code files in the user-space application.

Updating project makefile to generate and collate C header/code files

To enable the register system, user must ensure that following exists:

  1. In the project/Makefile add the exporttosdk flag under the all target. For example:
all:
$(MAKE) -C $(HW) init_bram exporttosdk
mkdir -p bitfiles
cp $(HW)/implementation/download.bit bitfiles/ 
  1. In the project/hw/Makefile add the following under the exporttosdk target:
exporttosdk: $(SYSTEM_HW_HANDOFF_DEP)
appguru -hw $(SDK_EXPORT_DIR)/$(SYSTEM).xml -app empty_application $(PROJECT_SEARCHPATHOPT)../sw/ -od $(SDK_EXPORT_DIR)/../empty_application
@mkdir -p $(SDK_EXPORT_DIR)/../libs
libgen -mhs $(MHSFILE) -p $(DEVICE) $(PROJECT_SEARCHPATHOPT) $(PROJECT_SEARCHPATHOPT)../sw/ -lib -od $(SDK_EXPORT_DIR)/../libs $(SDK_EXPORT_DIR)/../empty_application/$(SYSTEM).mss
@mkdir -p $(SDK_EXPORT_DIR)/../../../host/include/
@cp -rf $(SDK_EXPORT_DIR)/../libs/microblaze_0/include/* $(SDK_EXPORT_DIR)/../../../host/include/
@cp -rf $(SDK_EXPORT_DIR)/../libs/microblaze_0/libsrc $(SDK_EXPORT_DIR)/../../../host/include/

After updating the makefiles, start the build process by running make under the project directory.

Using C header/code files in a user-space application

Upon successful build, following code structure will be created under the project/sw/host/include directory:

|-- include
|  |-- libsrc
|  |  |-- emc_v4_00_a
|  |  |  |-- src
|  |  |  |  `-- emc_flash_lib.h
|  |  |  |  `-- emc_flash_lib.c
|  ...
|  `-- xparameters.h

This is an example taken from the Contributed Flash project. The xparameters.h is the global defines file containing project specific definitions like base addresses and some other core specific parameter definitions. The emc_v4_00_a driver, in the above example, operates with the axi_emc_v1_01_a core and provides register offset definitions and embedded functions for flash read(s)/write(s) and programming operations. The nf10_configure utility provided with the Contributed Flash project, utilises these header/code files and provides a user-space flash application for configuring and programming on-board flash devices.

Examples

Following are some of the functional examples provided with the NetFPGA-10G platform:

  1. Contributed Flash

  2. Flash Configuration

Clone this wiki locally