Making use of system Build Variable in C source

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Making use of system Build Variable in C source

Jump to solution
832 Views
etidemand
Contributor II

Hi,

 

I am attempting to make use of a system build variable in my C source, in this case it is the build number of the SW being built. This value, 'BUILD_NMBER' is defined among the environmental variables of the host system, and I have confirmed that this variable appears in the list of system build variables within KDS.

 

Where I'm not sure how to proceed is in incorporate this variable into my C source code. In this case I wish to capture this number in SW such that it can be reported back at runtime as though it were a #define. My project compiles into a binary image that will be running on an embedded device, if that helps at all.

 

Any advice in how I might do this would be greatly appreciated! Thanks!

 

-Erik Tidemand

Labels (1)
0 Kudos
1 Solution
632 Views
bobpaddock
Senior Contributor III
2 Replies
633 Views
bobpaddock
Senior Contributor III


In Make:

-DBUILDNUMBER=$(your env build_number)

I explain the process here:
Software Safety: Automatic Serial Number for Test Driven Development. Makefile Tip #0

632 Views
etidemand
Contributor II

This was the trick I was looking for. Thanks!

-Erik

0 Kudos