Creating the OFDM ref design SDK project
The goal of this flow is to create an SDK workspace which:
- References the OFDM ref design XPS project for the hw specification
- Includes a single BSP referring to the XPS project, including drivers for custom pcores
- Includes multiple software projects (one per MAC) which refer to a common WARPMAC codebase
SDK Workspace, hardware and BSP projects
- Copy the fully-built XPS project to a folder with the desired name (like OFDM_RefDesign_FPGAv2_v17.0). I'll call this name <xps_proj> below.
- Delete the <xps_proj>/SDK/SDK_Export folder, if it exists (this will force XPS to create a hardware spec using your chosen <xps_proj> folder name).
- Create the folder <xps_proj>/SDK_Workspace
- Launch SDK and choose <xps_proj>/SDK_Workspace as the workspace
- Open Xilinx Tools->Repositories and add <xps_proj> as a Local Repository. Unfortunately it will be recorded as an absolute path. This is unavoidable in 13.4.
- Close SDK
- In the workspace folder (<xps_proj>/SDK_Workspace) create the folder structure below. If you're prepping a to-be-distributed public project, be sure to svn export (not svn checkout) the source to avoid .svn metadata folders.
{{{<xps_proj>/SDK_Workspace}}}/ |- .metadata/ <-Created by SDK; don't touch |- src/ |- WARPMAC/ |- warpmac.{c,h} |- warpphy.{c,h} |- warpnet.{c,h} |- util/ |- *.h (various reg macro headers) |- MAC/ |- NOMAC/ |- nomac.{c,h} |- CSMAMAC/ |- csmamac.{c,h}
- Close SDK
- In XPS, Export Design, and Export & Launch SDK
- SDK will launch; choose <xps_proj>/SDK_Workspace as your workspace
- Run File->New Xilinx BSP
- Give the BSP a useful name (like OFDM_RefDesign_FPGAv2_bsp). For better portability of software projects, avoid encoding any version numbers in the BSP project name.
- Check that the right Hardware Platform is selected (the one XPS just created should be pre-selected).
- Choose standalone for the OS
- Click Finish
- The BSP settings dialog will then show. Apply these settings:
- Overview: Enable WARP_FPGA_BOARD_LIB, change to version 2.20.a
- standalone: Choose the desired UART for stdin/stdout (rs232_db9 by default)
- drivers: Confirm correct driver and driver version is assigned for all custom pcores (ofdm_txrx, ofdm_agc, etc.). Double-check the versions- the defaults are often wrong. For Sysgen-created pcores the driver version should match the hardware version specified in the XPS project MHS file.
- Click OK
- The BSP software should automatically build. If it works the log will show 'Finished building libraries'.
Software Projects
If your BSP project name is the same as in an existing OFDM ref design SDK project, you can import the NoMAC/CSMAMAC software projects into the new SDK workspace (either copy the projects manually or import+copy from the other workspace directory).
Otherwise follow the steps below to create the MAC software projects from scratch. Both projects will refer to code in the src folder described above.
NOMAC
- Create an empty Xilinx C project named NoMAC; target the existing BSP
- In the new project, delete src/README.txt
- In the new project, right-click, New->Folder
- Choose the NoMAC C project as parent
- Name the folder WARPMAC
- Under Advanced:
- Set type to Linked Folder
- Set path to WORKSPACE_LOC/src/WARPMAC
- Click Resource Filters, Add
- Filter Type = Include only, Applies to = Files, Recursive = checked
- Attributes: Name matches *.c
- Click Resource Filters, Add
- Filter Type = Include only, Applies to = Files, Recursive = checked
- Attributes: Name matches *.h
- OK/Finish back to workspace
- The project will build, terminating in an error undefined reference to 'main'
- In the new project, right-click, New->Folder
- Choose the NoMAC C project as parent
- Name the folder NOMAC
- Under Advanced:
- Set type to Linked Folder
- Set path to WORKSPACE_LOC/src/MAC/NOMAC
- OK/Finish back to workspace
- The project will re-build, terminating in errors for missing includes/defines
- Right click the project, choose Properties
- Expand C/C++ General->Paths and Symbols
- Add a new Include path
- Check "Add to all configurations"
- Click Workspace
- Choose NOMAC->WARPMAC
- OK back to workspace
- Click Yes if prompted to re-index the source code
- The project will now build to completion, printing elfcheck passed.
- Right click on the project, choose Generate Linker Script
- WARP v2: Assign Code Sections to iocm, Data sections to docm, Heap/Stack to xps_bram_if_cntlr_1
- WARP v3: Assign Code Sections to xps_bram_if_cntlr_0, Data sections to xps_bram_if_cntlr_1, Heap/Stack to xps_bram_if_cntlr_1
- Confirm nothing is assigned to xps_bram_if_cntlr_2 (this memory maps to the PHY packet buffers)
- Change Heap/Stack sizes to 4096 (4K)
- Click Generate; click Yes to overwrite existing linker script
- Open project properties again, expand Run/Debug Settings
- Click New, choose "Xilinx C/C++ ELF"
- Name = NoMAC
- Main: Leave defaults
- Device Initialization: Uncheck "Verify ELF"
- WARP v2 Only: Debugger Options: Set the ISOCM field to:
0x00000000 isocmsize 65536 isocmdcrstartadr 0x100
- Common:
- Under "Display in favorites menu" check "Run" and "Debug"
- Under "Standard Input/Output" uncheck "Allocate Console"
- OK back to workspace
- Click New, choose "Xilinx C/C++ ELF"
- Project should now re-build, succeeding with elfcheck passed.
Adding Additional MAC Projects
- Create an empty Xilinx C project named TheMAC; target the existing BSP
- Ctrl-drag WARPMAC folder from NoMAC project to TheMAC project
- Repeat the new linked NOMAC folder steps above for TheMAC source
- Repeat the linker script and project options steps from NoMAC above
Wrapping Up
At this point you have a fully working OFDM reference design XPS + SDK project. But it's not quite ready to distribute.
Export launch configs
- In SDK choose File->Export, Run/Debug->Launch Configurations
- Click Next
- Expand Xilinx C/C++ ELF
- Check NOMAC and CSMAMAC (and any other MACs you're bundling with the ref design)
- Set location to <xps_proj>/SDK_Workspace/__import-then-delete
- Click Finish
At this point I suggest copying the full XPS project (<xps_proj>/ to a new directory. Be sure to keep the name of the XPS project folder the same (XPS uses this name when generating the hardware spec during SDK export). This way you'll have an un-cleaned project to revert back to later.
Cleaning up
- Close XPS and SDK
- In the new copy of the XPS project, delete these files and folders:
__xps implementation/ hdl/ synthesis/ *.log *.log.bak
- Delete the folder SDK_Workspace/.metadata/
- You should be left with an XPS project folder containing:
data/ etc/ pcores/ SDK/ |- SDK_Export/ SDK_Workspace/ platgen.opt system.make system.mhs system.xmp system_incl.make
- From the XPS project root folder, select all and Send To Compressed Folder; name it per our usual scheme OFDM_RefDesign_FPGAvX_vY.Z.zip (i.e. OFDM_RefDesign_FPGAv2_v17.0.zip)
- Post that .zip file
Using the OFDM ref design .zip
Before using a WARP reference design XPS or SDK project you must setup the environment (link to wiki page with tools versions requirements, svn checkout instructions, XPS/SDK edk_user_repository setting).
Getting the project files
- Download the reference design .zip file
- Expand its contents to a path with no spaces; C:\work\WARP\OFDM_RefDesign_FPGAv2_v17.0 is a good example
Using the XPS project The ref design XPS project is at the root of the expanded .zip file, in the directory with the system.xmp and system.mhs files. Open system.xmp in XPS to explore or modify the XPS project.
Using the SDK project Using the SDK requires configuring a workspace. Unfortunately workspaces are not portable. The ref design .zip file contains all the necessary project files to populate a workspace, but you must initialize your workspace first and import these project files manually.
In the instructions below we'll use <xps_proj> to represent the path where you expanded the ref design .zip. If the XPS project file is in C:\work\WARP\OFDM_RefDesign_FPGAv2_v17.0\system.xmp, then you should use C:\work\WARP\OFDM_RefDesign_FPGAv2_v17.0\ in place of <xps_proj> below.
- Launch the Xilinx SDK
- If prompted to select a workspace, choose <xps_proj>/SDK_Workspace
- If not, choose File->Switch Workspace, then choose <xps_proj>/SDK_Workspace
- Choose Xilinx Tools->Repositories
- Verify the WARP edk_user_repository is listed in the Global Repositories section
- In Local Repositories, click New, then navigate to <xps_proj>. Be sure to select the XPS project folder, not any of the folders above/below that.
- Click OK
- Choose File->Import; expand General; choose Existing Projects into Workspace; click Next