Skip to content

Using the Register System

Georgina Kalogeridou edited this page Jan 15, 2015 · 8 revisions

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

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

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

  1. In the project/Makefile verify that the exporttosdk flag exists under the all target.

For example in contrib-projects/flash/Makefile:

all:
	$(MAKE) -C $(HW) init_bram exporttosdk
	$(MAKE) -C $(SW)
	mkdir -p bitfiles
	cp $(HW)/implementation/download.bit bitfiles/

or in the contrib-projects/openflowswitch/Makefile:

all:
	$(MAKE) -C $(HW) exporttosdk
	$(MAKE) -C $(SW)
	mkdir -p bitfiles
	cp $(SW)/result/download.bit bitfiles/

The exporttosdk flag is used to inform EDK tool-chain to generate software repositories for a given project.

  1. In the project/hw/Makefile add the following (if not already present):

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/
	@rm -rf $(SDK_EXPORT_DIR)/../empty_application
	@rm -rf $(SDK_EXPORT_DIR)/../libs

regsclean target:

regsclean:
	rm -rf $(SDK_EXPORT_DIR)/../../../host/include/

Make sure that regsclean is listed in the clean target.

clean: hwclean regsclean simclean
...

After updating the makefiles, start the build process by running make under the project's top level directory.

Using C/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. It provides register offset definitions and 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 functional examples provided with the NetFPGA-10G platform:

  1. Contributed Flash

  2. Flash Configuration

Clone this wiki locally
You can’t perform that action at this time.