Skip to content

Commit b58689e

Browse files
authored
Merge branch 'zephyrproject-rtos:main' into board/fobe_quill_nrf52840_mesh
2 parents a4df35a + bfd2ac7 commit b58689e

File tree

6 files changed

+71
-3
lines changed

6 files changed

+71
-3
lines changed

doc/build/version/index.rst

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ multiple scopes, including:
1212
* Code (C/C++)
1313
* Kconfig
1414
* CMake
15+
* Shell
1516

1617
which makes it a very versatile system for lifecycle management of applications. In addition, it
1718
can be used when building applications which target supported bootloaders (e.g. MCUboot) allowing
@@ -195,3 +196,18 @@ Use in MCUboot-supported applications
195196
No additional configuration needs to be done to the target application so long as it is configured
196197
to support MCUboot and a signed image is generated, the version information will be automatically
197198
included in the image data.
199+
200+
Use in Shell
201+
============
202+
203+
When a shell interface is configured, the following commands are available to retrieve application version information:
204+
205+
+----------------------+-----------------------------+-------------------------+
206+
| Command | Variable | Example |
207+
+----------------------+-----------------------------+-------------------------+
208+
| app version | APP_VERSION_STRING | 1.2.3-unstable.5 |
209+
+----------------------+-----------------------------+-------------------------+
210+
| app version-extended | APP_VERSION_EXTENDED_STRING | 1.2.3-unstable.5+4 |
211+
+----------------------+-----------------------------+-------------------------+
212+
| app build-version | APP_BUILD_VERSION | v3.3.0-18-g2c85d9224fca |
213+
+----------------------+-----------------------------+-------------------------+

subsys/bluetooth/host/classic/shell/goep.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,14 +98,14 @@ static bool goep_parse_headers_cb(struct bt_obex_hdr *hdr, void *user_data)
9898
switch (hdr->id) {
9999
case BT_OBEX_HEADER_ID_APP_PARAM:
100100
case BT_OBEX_HEADER_ID_AUTH_CHALLENGE:
101-
case BT_OBEX_HEADER_ID_AUTH_RSP:
101+
case BT_OBEX_HEADER_ID_AUTH_RSP: {
102102
int err;
103103

104104
err = bt_obex_tlv_parse(hdr->len, hdr->data, goep_parse_tlvs_cb, NULL);
105105
if (err) {
106106
bt_shell_error("Fail to parse OBEX TLV triplet");
107107
}
108-
break;
108+
} break;
109109
default:
110110
bt_shell_hexdump(hdr->data, hdr->len);
111111
break;

subsys/shell/modules/CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,7 @@ zephyr_sources_ifdef(
1616
CONFIG_DEVMEM_SHELL
1717
devmem_service.c
1818
)
19+
zephyr_sources_ifdef(
20+
CONFIG_APP_VERSION_SHELL
21+
app_version_service.c
22+
)

subsys/shell/modules/Kconfig

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,11 @@ config DEVMEM_SHELL
2222
help
2323
This shell command provides read/write access to physical memory.
2424

25+
config APP_VERSION_SHELL
26+
bool "Application version information shell"
27+
default y if !SHELL_MINIMAL
28+
depends on "$(APP_VERSION_EXTENDED_STRING)" != ""
29+
help
30+
This shell command provides read access to application version information.
31+
2532
rsource "kernel_service/Kconfig"
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
/*
2+
* Copyright (c) 2025 Alex Fabre
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
#include "app_version.h"
8+
#include <zephyr/shell/shell.h>
9+
10+
static int cmd_app_version_string(const struct shell *sh)
11+
{
12+
shell_print(sh, APP_VERSION_STRING);
13+
return 0;
14+
}
15+
16+
static int cmd_app_version_extended_string(const struct shell *sh)
17+
{
18+
shell_print(sh, APP_VERSION_EXTENDED_STRING);
19+
return 0;
20+
}
21+
22+
static int cmd_app_build_version(const struct shell *sh)
23+
{
24+
shell_print(sh, STRINGIFY(APP_BUILD_VERSION));
25+
return 0;
26+
}
27+
28+
SHELL_STATIC_SUBCMD_SET_CREATE(
29+
sub_app,
30+
SHELL_CMD(version, NULL, "Application version. (ex. \"1.2.3-unstable.5\")",
31+
cmd_app_version_string),
32+
SHELL_CMD(version - extended, NULL,
33+
"Application version extended. (ex. \"1.2.3-unstable.5+4\")",
34+
cmd_app_version_extended_string),
35+
SHELL_CMD(build - version, NULL,
36+
"Application build version. (ex. \"v3.3.0-18-g2c85d9224fca\")",
37+
cmd_app_build_version),
38+
SHELL_SUBCMD_SET_END /* Array terminated. */
39+
);
40+
41+
SHELL_CMD_REGISTER(app, &sub_app, "Application version information commands", NULL);

tests/kernel/mem_protect/mem_map/boards/qemu_x86_tiny.conf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@
55
# Adjust this so that test_k_mem_map_unmap memory exhaustion
66
# test can run without failure, as we may run of free pages
77
# when there are changes in code and data size.
8-
CONFIG_DEMAND_PAGING_PAGE_FRAMES_RESERVE=30
8+
CONFIG_DEMAND_PAGING_PAGE_FRAMES_RESERVE=27

0 commit comments

Comments
 (0)