<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://devzone.nordicsemi.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>How do I access VERSION file parameters from prj.conf?</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/111690/how-do-i-access-version-file-parameters-from-prj-conf</link><description>Hi, basically I want to expose my firmware&amp;#39;s version through the GATT DIS (Device Information Service) to client applications. 
 I have gone through: 
 
 the VERSION file documentation 
 the peripheral_dis sample 
 
 And they were both useful: I have</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 06 Jun 2024 13:16:49 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/111690/how-do-i-access-version-file-parameters-from-prj-conf" /><item><title>RE: How do I access VERSION file parameters from prj.conf?</title><link>https://devzone.nordicsemi.com/thread/487743?ContentTypeID=1</link><pubDate>Thu, 06 Jun 2024 13:16:49 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2697b466-7a0b-48d1-9be7-e44620948104</guid><dc:creator>nik2k</dc:creator><description>&lt;p&gt;Thanks Simon. &lt;a href="https://www.youtube.com/watch?v=kRqkIdKOkkg"&gt;Here&lt;/a&gt;&amp;#39;s a video I found on YouTube that addresses using git tags for what I need. I&amp;#39;m going to leave this for anyone reading this thread in the future as a reference, if they&amp;#39;re interested.&lt;/p&gt;
&lt;p&gt;That&amp;#39;s all for now, you can close the case. Really appreciate your time.&lt;/p&gt;
&lt;p&gt;Regards,&lt;/p&gt;
&lt;p&gt;Shovnik&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How do I access VERSION file parameters from prj.conf?</title><link>https://devzone.nordicsemi.com/thread/487654?ContentTypeID=1</link><pubDate>Thu, 06 Jun 2024 08:36:06 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5d1b5b7a-572d-4c13-ba6f-088dfcba4c36</guid><dc:creator>Simonr</dc:creator><description>&lt;p&gt;Hi&lt;/p&gt;
&lt;p&gt;The APP_BUILD_VERSION is a string that&amp;nbsp;&lt;strong&gt;can&amp;nbsp;&lt;/strong&gt;refer to the git description, but you choose yourself in reality. It&amp;#39;s usually used for the git tag, but can be used as whatever to describe your build version.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Simon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How do I access VERSION file parameters from prj.conf?</title><link>https://devzone.nordicsemi.com/thread/487580?ContentTypeID=1</link><pubDate>Wed, 05 Jun 2024 21:25:20 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:226aba37-562f-4c1c-a1f6-de6bc525fbfb</guid><dc:creator>nik2k</dc:creator><description>&lt;p&gt;one last follow up: does the VERSION file have anything to do with&amp;nbsp;&lt;strong&gt;&lt;span style="font-family:&amp;#39;courier new&amp;#39;, courier;"&gt;git tags&lt;/span&gt;&lt;/strong&gt;&amp;nbsp;? What I mean for example is: is it common practice to somehow derive the VERSION file&amp;#39;s contents from the latest tag like &amp;quot;&lt;strong&gt;v1.0.0&lt;/strong&gt;&amp;quot; (using a script or a git hook perhaps leveraging &lt;span style="font-family:&amp;#39;courier new&amp;#39;, courier;"&gt;&lt;strong&gt;git describe&lt;/strong&gt;&lt;/span&gt;)? It would be nice to use git tags to mark stable releases in my repo but if it&amp;#39;s too much of a hassle I won&amp;#39;t bother.&lt;/p&gt;
&lt;p&gt;Currently, it seems that there is a macro APP_BUILD_VERSION but it does not use anything from the VERSION file and only uses the output from a &lt;strong&gt;&lt;span style="font-family:&amp;#39;courier new&amp;#39;, courier;"&gt;git describe&lt;/span&gt; &lt;/strong&gt;command.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How do I access VERSION file parameters from prj.conf?</title><link>https://devzone.nordicsemi.com/thread/487494?ContentTypeID=1</link><pubDate>Wed, 05 Jun 2024 11:35:06 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f021399b-56b6-4393-bd2e-607cdef87763</guid><dc:creator>Simonr</dc:creator><description>&lt;p&gt;Hi&lt;/p&gt;
&lt;p&gt;Correct! Let me know if any follow-ups come up or if we can close this case now.&lt;/p&gt;
&lt;p&gt;Best of luck and regards,&lt;/p&gt;
&lt;p&gt;Simon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How do I access VERSION file parameters from prj.conf?</title><link>https://devzone.nordicsemi.com/thread/487376?ContentTypeID=1</link><pubDate>Tue, 04 Jun 2024 17:28:47 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b830fa9f-a71d-4d23-a3a3-dc1344f43a0f</guid><dc:creator>nik2k</dc:creator><description>&lt;p&gt;Hi Simon, thanks a lot. I missed the Kconfig file in my project directory completely, or maybe I thought it would be best to not mess with it. In the meantime, I found a workaround by loading the version string at runtime using:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;#include &amp;quot;app_version.h&amp;quot;

/* Runtime settings override. */
static int settings_runtime_load(void)
{
#if defined(CONFIG_BT_DIS_FW_REV)
	settings_runtime_set(&amp;quot;bt/dis/fw&amp;quot;, APP_VERSION_STRING , sizeof(APP_VERSION_STRING));
#endif
	return 0;
}

...
settings_runtime_load(); /* call later inside main() */

&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;But I will definitely be considering the solution you have provided (best to keep configuration stuff like this outside of app code I believe).&lt;/p&gt;
&lt;p&gt;I believe I don&amp;#39;t need to do anything involving the macros:&amp;nbsp;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;a class="reference external" title="(in Kconfig reference v&amp;amp;nbsp;)" href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/kconfig/index.html#CONFIG_FW_INFO_FIRMWARE_VERSION"&gt;&lt;code class="xref kconfig kconfig-option docutils literal notranslate"&gt;&lt;span class="pre"&gt;CONFIG_FW_INFO_FIRMWARE_VERSION&lt;/span&gt;&lt;/code&gt;&lt;/a&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;span&gt;and&amp;nbsp;&lt;/span&gt;&lt;a class="reference external" title="(in Kconfig reference v&amp;amp;nbsp;)" href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/kconfig/index.html#CONFIG_MCUBOOT_IMGTOOL_SIGN_VERSION"&gt;&lt;code class="xref kconfig kconfig-option docutils literal notranslate"&gt;&lt;span class="pre"&gt;CONFIG_MCUBOOT_IMGTOOL_SIGN_VERSION&lt;/span&gt;&lt;/code&gt;&lt;/a&gt;&amp;nbsp;for this right?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How do I access VERSION file parameters from prj.conf?</title><link>https://devzone.nordicsemi.com/thread/487232?ContentTypeID=1</link><pubDate>Tue, 04 Jun 2024 08:03:45 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d9d22bc8-992f-41d7-ac35-4c9a2b049598</guid><dc:creator>Simonr</dc:creator><description>&lt;p&gt;Hi&lt;/p&gt;
&lt;p&gt;So, this won&amp;#39;t be possible to set in the prj.conf file, as it&amp;#39;s not able to do this kind of stuff, but you can do it either in the Kconfig file or the CMakeLists.txt file I assume. Here&amp;#39;s a .zip file showing the bare bones of what to do to add something like what you are requesting. Check the main.c, Kconfig and VERSION file.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/versionname.zip"&gt;devzone.nordicsemi.com/.../versionname.zip&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Simon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How do I access VERSION file parameters from prj.conf?</title><link>https://devzone.nordicsemi.com/thread/486958?ContentTypeID=1</link><pubDate>Fri, 31 May 2024 18:36:58 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:bb28743f-1e83-47b8-b69a-c11e9b9bd9e1</guid><dc:creator>nik2k</dc:creator><description>&lt;p&gt;Hi Simon. Thanks for your time. Your example shows a hardcoded string&amp;nbsp;&lt;strong&gt;&amp;quot;0.0.1&lt;/strong&gt;&amp;quot; but I want to substitute the values of the&amp;nbsp;&lt;strong&gt;$(VERSION_MAJOR)&lt;/strong&gt; and&amp;nbsp;&lt;strong&gt;$(VERSION_MINOR)&lt;/strong&gt;&amp;nbsp;variables into the&amp;nbsp;&lt;strong&gt;CONFIG_BT_DIS_FW_REV_STR&lt;/strong&gt; macro.&lt;br /&gt;If I do something like&amp;nbsp;&lt;strong&gt;CONFIG_BT_DIS_FW_REV_STR=&amp;quot;$(VERSION_MAJOR).$(VERSION_MINOR)&amp;quot;&lt;/strong&gt;, it will be treated literally:&lt;/p&gt;
&lt;p&gt;&lt;img style="max-height:240px;max-width:320px;" alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/Screenshot_5F00_20240531_2D00_235455_5F00_nRF-Connect.jpg" /&gt;&lt;/p&gt;
&lt;p&gt;so I was wondering, if there&amp;#39;s some special syntax for using&amp;nbsp;&lt;strong&gt;$(variables)&lt;/strong&gt; in prj.conf. I searched online but unfortunately couldn&amp;#39;t find anything concrete on this, other than the &lt;a href="https://www.kernel.org/doc/html/next/kbuild/kconfig-language.html"&gt;Kconfig language reference&lt;/a&gt; which details the syntax for Kconfig, not prj.conf.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;When I try using the unquoted variables like in my original post:&amp;nbsp;&lt;strong&gt;CONFIG_BT_DIS_FW_REV_STR=$(VERSION_MAJOR).$(VERSION_MINOR),&amp;nbsp;&lt;/strong&gt;I get the below logs on build failure:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;c:/Users/91833/Documents/NordicSemiconductor/myApps/RedSOS-Touch/prj.conf:70: warning: malformed string literal in assignment to BT_DIS_FW_REV_STR (defined at C:/ncs/v2.6.0__/nrf\subsys\bluetooth\services\fast_pair/Kconfig.fast_pair:36, C:/ncs/v2.6.0__/zephyr/subsys/bluetooth/services\Kconfig.dis:117, C:/ncs/v2.6.0__/zephyr/subsys/bluetooth/host\../services\Kconfig.dis:117, subsys/bluetooth\host\../services\Kconfig.dis:117). Assignment ignored.

error: Aborting due to Kconfig warnings

Parsing C:/Users/91833/Documents/NordicSemiconductor/myApps/RedSOS-Touch/Kconfig
Loaded configuration &amp;#39;C:/ncs/v2.6.0__/zephyr/boards/arm/nrf52dk_nrf52832/nrf52dk_nrf52832_defconfig&amp;#39;
Merged configuration &amp;#39;c:/Users/91833/Documents/NordicSemiconductor/myApps/RedSOS-Touch/prj.conf&amp;#39;
CMake Error at C:/ncs/v2.6.0__/zephyr/cmake/modules/kconfig.cmake:358 (message):
  command failed with return code: 1
Call Stack (most recent call first):
  C:/ncs/v2.6.0__/nrf/cmake/modules/kconfig.cmake:29 (include)
  C:/ncs/v2.6.0__/zephyr/cmake/modules/zephyr_default.cmake:129 (include)
  C:/ncs/v2.6.0__/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:66 (include)
  C:/ncs/v2.6.0__/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:92 (include_boilerplate)
  CMakeLists.txt:8 (find_package)&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Any thoughts?&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;EDIT:&amp;nbsp;&lt;/strong&gt;A small addendum - I read the &lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrf/config_and_build/dfu/dfu_image_versions.html"&gt;Image Versions&lt;/a&gt;&amp;nbsp;doc and it specifies two related macros:&amp;nbsp;&lt;a class="reference external" title="(in Kconfig reference v&amp;amp;nbsp;)" href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/kconfig/index.html#CONFIG_FW_INFO_FIRMWARE_VERSION"&gt;&lt;code class="xref kconfig kconfig-option docutils literal notranslate"&gt;&lt;span class="pre"&gt;CONFIG_FW_INFO_FIRMWARE_VERSION&lt;/span&gt;&lt;/code&gt;&lt;/a&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;and&amp;nbsp;&lt;a class="reference external" title="(in Kconfig reference v&amp;amp;nbsp;)" href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/kconfig/index.html#CONFIG_MCUBOOT_IMGTOOL_SIGN_VERSION"&gt;&lt;code class="xref kconfig kconfig-option docutils literal notranslate"&gt;&lt;span class="pre"&gt;CONFIG_MCUBOOT_IMGTOOL_SIGN_VERSION&lt;/span&gt;&lt;/code&gt;&lt;/a&gt;. The latter, as the document states, is an alternative to using the &lt;strong&gt;VERSION&lt;/strong&gt; file. So I&amp;#39;m a little confused as to whether I should set these or not if I already have a &lt;strong&gt;VERSION&lt;/strong&gt; file? particularly the first one -&amp;nbsp;&lt;strong&gt;CONFIG_FW_INFO_FIRMWARE_VERSION&lt;/strong&gt;?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How do I access VERSION file parameters from prj.conf?</title><link>https://devzone.nordicsemi.com/thread/486829?ContentTypeID=1</link><pubDate>Fri, 31 May 2024 09:13:43 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:58949621-9b83-4ca4-b93c-f56ae5e2d395</guid><dc:creator>Simonr</dc:creator><description>&lt;p&gt;Yes, this should be possible, but you have to format it as a string, so &lt;strong&gt;CONFIG_BT_DIS_FW_REV_STR=&amp;quot;0.0.1&amp;quot;&lt;/strong&gt; for example.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;What kind of build failures/error messages are you seeing exactly? They usually provide a hint towards what exactly is wrong or a suggestion on what to do, so please follow that, or upload the build log here if you&amp;#39;re confused.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Simon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>