Skip to content

Commit b2d3dde

Browse files
committed
app: Add build version to #XSMVER
Add Git describe string as the <build_version> parameter in AT#XSMVER response. Signed-off-by: Markus Lassila <markus.lassila@nordicsemi.no>
1 parent a9e396b commit b2d3dde

5 files changed

Lines changed: 22 additions & 13 deletions

File tree

app/src/sm_at_commands.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,12 +75,13 @@ STATIC int handle_at_smver(enum at_parser_cmd_type cmd_type, struct at_parser *,
7575

7676
if (cmd_type == AT_PARSER_CMD_TYPE_SET) {
7777
if (strlen(CONFIG_SM_CUSTOMER_VERSION) > 0) {
78-
rsp_send("\r\n#XSMVER: \"%s\",\"%s\",\"%s\"\r\n",
78+
rsp_send("\r\n#XSMVER: \"%s\",\"%s\",\"%s\",\"%s\"\r\n",
7979
APP_VERSION_TWEAK_STRING, NCS_VERSION_STRING,
80-
CONFIG_SM_CUSTOMER_VERSION);
80+
CONFIG_SM_CUSTOMER_VERSION, STRINGIFY(APP_BUILD_VERSION));
8181
} else {
82-
rsp_send("\r\n#XSMVER: \"%s\",\"%s\"\r\n",
83-
APP_VERSION_TWEAK_STRING, NCS_VERSION_STRING);
82+
rsp_send("\r\n#XSMVER: \"%s\",\"%s\",\"%s\"\r\n",
83+
APP_VERSION_TWEAK_STRING, NCS_VERSION_STRING,
84+
STRINGIFY(APP_BUILD_VERSION));
8485
}
8586
ret = 0;
8687
}

doc/app/at_generic.rst

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ Response syntax
179179

180180
::
181181

182-
#XSMVER: "<sm_version>","<ncs_version>"[,"<customer_version>"]
182+
#XSMVER: "<sm_version>","<ncs_version>"[,"<customer_version>"],"<build_version>"
183183

184184
The ``<sm_version>`` parameter is the version of the |SM| application.
185185
It comes from :file:`app/VERSION` (``APP_VERSION_TWEAK_STRING``) and matches the MCUboot sign version.
@@ -189,6 +189,8 @@ The ``<ncs_version>`` parameter is a string containing the version of the |NCS|.
189189

190190
The ``<customer_version>`` parameter is the :ref:`CONFIG_SM_CUSTOMER_VERSION <CONFIG_SM_CUSTOMER_VERSION>` string, if defined.
191191

192+
The ``<build_version>`` parameter is the Git describe string from the application tree (``APP_BUILD_VERSION``).
193+
192194
Example
193195
~~~~~~~
194196

@@ -198,22 +200,22 @@ The following command example reads the versions:
198200

199201
// First shipped 2.0 pre-release
200202
AT#XSMVER
201-
#XSMVER: "1.99.0+1","3.3.99"
203+
#XSMVER: "1.99.0+1","3.3.99","v2.0.0-preview1-67-ga9e396bc3d58"
202204
OK
203205

204206
// Next shipped pre-release
205207
AT#XSMVER
206-
#XSMVER: "1.99.0+2","3.3.99"
208+
#XSMVER: "1.99.0+2","3.3.99","v2.0.0-preview2-102-gace23a3d582"
207209
OK
208210

209211
// 2.0.0 release
210212
AT#XSMVER
211-
#XSMVER: "2.0.0+0","3.4.0"
213+
#XSMVER: "2.0.0+0","3.4.0","v2.0.0"
212214
OK
213215

214216
// Shipped pre-release with customer version
215217
AT#XSMVER
216-
#XSMVER: "1.99.0+2","3.1.99","Onomondo 2.1.0"
218+
#XSMVER: "1.99.0+1","3.3.99","Onomondo 2.1.0","v2.0.0-preview1-67-ga9e396bc3d58"
217219
OK
218220

219221
Read command

doc/app/sm_releasing.rst

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ Each published image must carry a higher value than the previous one on the same
99
Application — :file:`app/VERSION`
1010
=================================
1111

12-
Sets ``AT#XSMVER`` and the MCUboot application sign version (``CONFIG_MCUBOOT_IMGTOOL_SIGN_VERSION``), which is used for application downgrade prevention.
12+
Sets the ``<sm_version>`` field in ``AT#XSMVER`` and the MCUboot application sign version (``CONFIG_MCUBOOT_IMGTOOL_SIGN_VERSION``), which is used for application downgrade prevention.
1313
Format: ``major.minor.patchlevel+VERSION_TWEAK``. See `Zephyr application VERSION`_.
1414

1515
Pre-releases
@@ -25,6 +25,10 @@ Example for 2.0.0 GA — line ``1.99.0``, images ``1.99.0+1``, ``1.99.0+2``, …
2525
PATCHLEVEL = 0
2626
VERSION_TWEAK = 1
2727
28+
.. note::
29+
30+
The ``VERSION_TWEAK`` is not taken into account for downgrade prevention, so pre-release images which differ only in ``VERSION_TWEAK`` are interchangeable in terms of downgrade prevention.
31+
2832
General Availability (GA)
2933
-------------------------
3034

doc/app/sm_testing.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ Complete the following steps to test the functionality provided by the :ref:`SM_
2626
:class: highlight
2727
2828
**AT#XSMVER**
29-
#XSMVER: "1.99.0+0","3.1.99"
29+
#XSMVER: "1.99.0+0","3.3.99","v2.0.0-preview1-67-ga9e396bc3d58"
3030
OK
3131
3232
#. Retrieve a list of all supported proprietary AT commands.

doc/releases/migration_notes_v2.0.0.rst

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,11 @@ Informational changes
2828

2929
The following changes are listed for informational purposes, and many hosts will work without any changes.
3030

31-
* ``AT#XSMVER`` response format — In v1.x.x, the first field was a Git describe string (for example ``"v1.0.0"`` or ``"v1.0.0-3-g1a2b3c4"``).
32-
From v2.0.0, it is the numeric version from :file:`app/VERSION` in the form ``"major.minor.patch+tweak"`` (for example ``"2.0.0+0"``).
31+
* ``AT#XSMVER`` response format — In v1.x.x, the first field (``<sm_version>``) was a Git describe string (for example ``"v1.0.0"`` or ``"v1.0.0-3-g1a2b3c4"``).
32+
From v2.0.0, the first field is the numeric version from :file:`app/VERSION` in the form ``"major.minor.patch+tweak"`` (for example ``"2.0.0+0"``).
3333
It is aligned with the MCUboot application sign version which is used for application rollback prevention.
34+
A Git describe string is appended as the last field (``<build_version>``).
35+
See :ref:`sm_releasing` for how to set :file:`app/VERSION`.
3436

3537
* Ring Indication (RI) - Change RI from pulse (100 ms) to level triggered, meaning RI stays asserted until the host asserts DTR.
3638
After the Serial Modem has enabled UART, RI will be deasserted.

0 commit comments

Comments
 (0)