Showing results for 
Search instead for 
Did you mean: 
Registered: ‎12-07-2012

Create a C project with abstraction of underlying BSP and H/W

Our group is trying to create a C project without any direct refernce to a H/W project and BSP project.  Is this possible?


Let me describe the process I'm trying to work through to make this happen:

In a separate workspace and project, we create a set of APIs that interface with a particular H/W project (e.g. XML file) and BSP and it generates a lib file that we will then link into an application C project which is H/W and BSP agnostic.  For now this is 2 lib files ("our" libhal.a to interface with specific FPGA logic plus CPU peripherals and a generated libxilkernel.a for the OS).


When I create a new C project, I get prompted for the XML file on which to base the project.  So I can give a dummy one and then later remove the references to it.  The project will build (by linking to the libs mentioned above) but then the debugger doesn't launch because it wants a BSP to reference.  So, I will give it reference to a BSP that is not in the build.  That is, the xilkernel and hal libs contain all the APIs in the application, nothing in this referenced BSP is in the actual code (to my knowledge).


Our goal is to have an application program that can be independent of (abstracted from) the underlying FPGA logic and generated BSP C code files.  The idea is the FPGA engineer can change the  H/W, resulting in a new BSP package, but that this will not affect the application code - it just uses the APIs in the libraries built outside the application workspace.  It only needs header file(s) and lib file(s).


My question is, will this strategy work?  Am I progressing in the right fashion?  Is there a better method to use to obtain this abstraction?




0 Kudos
1 Reply
Not applicable

Re: Create a C project with abstraction of underlying BSP and H/W

So you are correct in your understanding of how the Libgen will work. It will take in the XML file to tell the libgen what driver source files to pull in. Libgen will not compile without the XML file.


So you are limited here. Surely, your HW designers can give you an outline of what IP they will be using so you can at

least build a framework around this. If you know what IP you will be using, I would create a dummy EDK project, and create

EDK project with these IP present, then simply export to SDK and let the tools pull in all the driver sources for these.


The other way, you will need to get creative with the XML file and some tcl, or PERL scripting and start hacking!!

0 Kudos