Making use of system Build Variable in C source

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

Making use of system Build Variable in C source

跳至解决方案
911 次查看
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 解答
711 次查看
bobpaddock
Senior Contributor III
2 回复数
712 次查看
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

711 次查看
etidemand
Contributor II

This was the trick I was looking for. Thanks!

-Erik

0 项奖励