UPGRADE YOUR BROWSER

We have detected your current browser version is not the latest one. Xilinx.com uses the latest web technologies to bring you the best online experience possible. Please upgrade to a Xilinx.com supported browser:Chrome, Firefox, Internet Explorer 11, Safari. Thank you!

cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Adventurer
Adventurer
111 Views
Registered: ‎08-16-2017

Comon code for different BSPs

Hi,

In my application, I have several variants of HW designs which are synthesized with Vivado. All of these designs are small variations of each other.

The SW consists therefore of a lot of comon code and other code handling the "variations". I would like to be able to "know"/"tag" which BSP/HWDEF is being used and specialize my code something like:

#if HW_VARIANT == VARIANT_1

/* do some stuff specific to this BSP */

#else 

/* do something else */

#endif

I wonder if others have had a similar situation and how they would have solved it?

Is this even a good idea ? 

 

 

 

 

 

1 Reply
Moderator
Moderator
67 Views
Registered: ‎03-25-2019

Re: Comon code for different BSPs

Hi @ziladdev,

There is no a special macro that identifies the BSP.
For your case, you could simply define your own macro within the BSP code and give it a different value for each BSP. I would recommend to define this macro in the xparameters.h file under the include folder of your BSP project.

Best regards,
Abdallah
-------------------------------------------------------------------------------
Please don't forget to reply, kudo and accept as a solution
0 Kudos