<?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>App version usage in code and configuration</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/110472/app-version-usage-in-code-and-configuration</link><description>Hi there, 
 
 Zephyr has ability for an Application version management . Based on this, I have created a &amp;quot;Version&amp;quot; file, without any file name extension (like .txt). 
 
 Now I would like to display the version in the &amp;quot;Device Information Service&amp;quot; defined</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 23 Apr 2024 12:22:47 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/110472/app-version-usage-in-code-and-configuration" /><item><title>RE: App version usage in code and configuration</title><link>https://devzone.nordicsemi.com/thread/480204?ContentTypeID=1</link><pubDate>Tue, 23 Apr 2024 12:22:47 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4866f960-33f2-4fb2-9176-5d394aa29502</guid><dc:creator>H&amp;#229;kon Alseth</dc:creator><description>&lt;p&gt;Dear Patrick,&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Try to create a Kconfig file in your project, containing this:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;config BT_DIS_FW_REV_STR
    default &amp;quot;$(APP_VERSION_TWEAK_STRING)&amp;quot; if &amp;quot;$(APP_VERSION_EXTENDED_STRING)&amp;quot; != &amp;quot;&amp;quot;

source &amp;quot;Kconfig.zephyr&amp;quot;&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;And see if this configures things as expected now?&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Please note that any settings in your prj.conf / $board.conf that also sets CONFIG_BT_DIS_FW_REV_STR must be removed.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Kind regards,&lt;/p&gt;
&lt;p&gt;Håkon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: App version usage in code and configuration</title><link>https://devzone.nordicsemi.com/thread/480121?ContentTypeID=1</link><pubDate>Tue, 23 Apr 2024 07:55:17 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e0ce1986-25ed-4b33-a688-f72edeb3eb33</guid><dc:creator>SirBuhi</dc:creator><description>&lt;p&gt;&lt;span&gt;Dear&amp;nbsp;&lt;/span&gt;&lt;span&gt;H&amp;aring;kon,&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;The VERSION file looks like this:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;VERSION_MAJOR = 5
VERSION_MINOR = 9
PATCHLEVEL = 8
VERSION_TWEAK = 7
EXTRAVERSION = dev&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;The folder structure looks like this:&lt;/p&gt;
&lt;p&gt;&lt;img style="max-height:240px;max-width:320px;" src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/pastedimage1713858725918v1.png" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;It seems that the version can be read, as tried to do some DFU&amp;#39;s yesterday, where the version was displayed in the Android application as I defined it in the file.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Kind regards,&lt;/p&gt;
&lt;p&gt;Patrick&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: App version usage in code and configuration</title><link>https://devzone.nordicsemi.com/thread/480119?ContentTypeID=1</link><pubDate>Tue, 23 Apr 2024 07:46:23 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a87f6b3f-6fbe-41e2-9ffe-38fda22409d1</guid><dc:creator>H&amp;#229;kon Alseth</dc:creator><description>&lt;p&gt;Dear Patrick,&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;What is the content of your VERSION file?&lt;/p&gt;
&lt;p&gt;edit: I see what you mean, one is set after the other, so ordering of when the CONFIG_BT_DIS_FW_REV_STR is set will make it either to be &amp;#39;&amp;#39; or the content of the prj.conf. I&amp;#39;ll see if I can find another way around.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Kind regards,&lt;/p&gt;
&lt;p&gt;Håkon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: App version usage in code and configuration</title><link>https://devzone.nordicsemi.com/thread/480111?ContentTypeID=1</link><pubDate>Tue, 23 Apr 2024 07:24:03 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b8298fef-0dd2-4c0c-9f2d-7600c95b7e3f</guid><dc:creator>SirBuhi</dc:creator><description>&lt;p&gt;&lt;span&gt;Dear&amp;nbsp;&lt;/span&gt;&lt;span&gt;H&amp;aring;kon,&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;I have the following in the cmake:&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;pre class="ui-code" data-mode="text"&gt;# SPDX-License-Identifier: Apache-2.0

cmake_minimum_required(VERSION 3.20.0)

include(CMakePrintHelpers)
cmake_print_variables(APP_VERSION_TWEAK_STRING)

set(CONFIG_BT_DIS_FW_REV_STR \&amp;quot;${APP_VERSION_TWEAK_STRING}\&amp;quot; CACHE INTERNAL &amp;quot;&amp;quot;)

find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
project(new)

zephyr_include_directories(include)

target_sources(app PRIVATE include/main_init.c)
target_sources(app PRIVATE include/bluetooth.c)

target_sources(app PRIVATE src/main.c)&lt;/pre&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;The build output in the terminal is:&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;pre class="ui-code" data-mode="text"&gt;-- APP_VERSION_TWEAK_STRING=&amp;quot;&amp;quot;&lt;/pre&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Therefore the same as in the app.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Kind regards,&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Patrick&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: App version usage in code and configuration</title><link>https://devzone.nordicsemi.com/thread/480109?ContentTypeID=1</link><pubDate>Tue, 23 Apr 2024 07:14:09 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:89d00a5f-cda6-46c0-9660-fd8b69f5668c</guid><dc:creator>H&amp;#229;kon Alseth</dc:creator><description>&lt;p&gt;Hi Patrick,&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;You do not need to check with the android app, you can just go into build-folder/zephyr/.config and search for the CONFIG_.&lt;/p&gt;
&lt;p&gt;Or even easier; add a message in cmake:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;include(CMakePrintHelpers)
cmake_print_variables(APP_VERSION_TWEAK_STRING)&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;This will not print unless my_project/VERSION file is present. Here&amp;#39;s an example of the content of such file:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;VERSION_MAJOR = 2
VERSION_MINOR = 6
PATCHLEVEL = 0
VERSION_TWEAK = 99
EXTRAVERSION =
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Which will print:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;-- APP_VERSION_TWEAK_STRING=&amp;quot;2.6.0+99&amp;quot;&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Kind regards,&lt;/p&gt;
&lt;p&gt;Håkon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: App version usage in code and configuration</title><link>https://devzone.nordicsemi.com/thread/480107?ContentTypeID=1</link><pubDate>Tue, 23 Apr 2024 07:05:09 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:793256fc-7c6e-4a0a-b49c-560de6dfa596</guid><dc:creator>SirBuhi</dc:creator><description>&lt;p&gt;Dear &lt;span&gt;H&amp;aring;kon,&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;While testing with nRF Connect Android application, the value of the Firmware Revision String remains empty.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Any other ideas?&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Kind regards,&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Patrick&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: App version usage in code and configuration</title><link>https://devzone.nordicsemi.com/thread/480008?ContentTypeID=1</link><pubDate>Mon, 22 Apr 2024 13:18:06 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7012b832-42c0-4233-9580-099f210fd52a</guid><dc:creator>H&amp;#229;kon Alseth</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;You need to set this in your CMakeLists.txt file. Kconfig cannot take in variables.&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;set(CONFIG_SOME_CONFIG \&amp;quot;${APP_VERSION_TWEAK_STRING}\&amp;quot; CACHE INTERNAL &amp;quot;&amp;quot;)&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Make sure to set this &lt;span style="text-decoration:underline;"&gt;before&lt;/span&gt; the find_package line.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Could you try this and see if that works as expected?&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Kind regards,&lt;/p&gt;
&lt;p&gt;Håkon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>