Making use of system Build Variable in C source

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

Making use of system Build Variable in C source

ソリューションへジャンプ
884件の閲覧回数
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

ラベル(1)
0 件の賞賛
1 解決策
684件の閲覧回数
bobpaddock
Senior Contributor III
2 返答(返信)
685件の閲覧回数
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

684件の閲覧回数
etidemand
Contributor II

This was the trick I was looking for. Thanks!

-Erik

0 件の賞賛