Part 1
요약·해설
Zephyr의 image/slot naming, 상태 flag와 TLV hash, 첫 upload packet의 field, sha 기반 재개 및 MCUboot rollback 흐름을 설명합니다.
1
Primary · secondary
Upload · test · confirm · erase
Part 2
접을 수 있는 영어 원문 전체
영어 원문 전체 펼치기
226D6F87FE80A275225D1A96E27BAD6C9E26CAE1739CC9CB48A5B0B2ACD70620
.. _mcumgr_smp_group_1:
Application/software image management group
###########################################
Application/software image management group defines following commands:
.. table::
:align: center
+-------------------+-----------------------------------------------+
| ``Command ID`` | Command description |
+===================+===============================================+
| ``0`` | State of images |
+-------------------+-----------------------------------------------+
| ``1`` | Image upload |
+-------------------+-----------------------------------------------+
| ``2`` | File |
| | (reserved but not supported by Zephyr) |
+-------------------+-----------------------------------------------+
| ``3`` | Corelist |
| | (reserved but not supported by Zephyr) |
+-------------------+-----------------------------------------------+
| ``4`` | Coreload |
| | (reserved but not supported by Zephyr) |
+-------------------+-----------------------------------------------+
| ``5`` | Image erase |
+-------------------+-----------------------------------------------+
Notion of "slots" and "images" in Zephyr
****************************************
The "slot" and "image" definition comes from mcuboot where "image" would
consist of two "slots", further named "primary" and "secondary"; the application
is supposed to run from the "primary slot" and update is supposed to be
uploaded to the "secondary slot"; the mcuboot is responsible in swapping
slots on boot.
This means that pair of slots is dedicated to single upgradable application.
In case of Zephyr this gets a little bit confusing because DTS will use
"slot0_partition" and "slot1_partition", as label of ``fixed-partition`` dedicated
to single application, but will name them as "image-0" and "image-1" respectively.
Currently Zephyr supports at most two images, in which case mapping is as follows:
.. table::
:align: center
+-------------+-------------------+---------------+
| Image | Slot labels | Slot Names |
+=============+===================+===============+
| 1 | "slot0_partition" | "image-0" |
| | "slot1_partition" | "image-1" |
+-------------+-------------------+---------------+
| 2 | "slot2_partition" | "image-2" |
| | "slot3_partition" | "image-3" |
+-------------+-------------------+---------------+
State of images
***************
The command is used to set state of images and obtain list of images
with their current state.
Get state of images request
===========================
Get state of images request header fields:
.. table::
:align: center
+--------+--------------+----------------+
| ``OP`` | ``Group ID`` | ``Command ID`` |
+========+==============+================+
| ``0`` | ``1`` | ``0`` |
+--------+--------------+----------------+
The command sends an empty CBOR map as data.
.. _mcumgr_smp_protocol_op_1_grp_1_cmd_0:
Get state of images response
============================
Get state of images response header fields:
.. table::
:align: center
+--------+--------------+----------------+
| ``OP`` | ``Group ID`` | ``Command ID`` |
+========+==============+================+
| ``1`` | ``1`` | ``0`` |
+--------+--------------+----------------+
.. note::
Below definition of the response contains "image" field that has been marked
as optional(opt): the field may not appear in response when target application
does not support more than one image. The field is mandatory when application
supports more than one application image to allow identifying which image
information is listed.
A response will only contain information for valid images, if an image can not
be identified as valid it is simply skipped.
CBOR data of successful response:
.. code-block:: none
{
(str)"images" : [
{
(str,opt)"image" : (uint)
(str)"slot" : (uint)
(str)"version" : (str)
(str,opt*)"hash" : (byte str)
(str,opt)"bootable" : (bool)
(str,opt)"pending" : (bool)
(str,opt)"confirmed" : (bool)
(str,opt)"active" : (bool)
(str,opt)"permanent" : (bool)
}
...
]
(str,opt)"splitStatus" : (int)
}
In case of error the CBOR data takes the form:
.. tabs::
.. group-tab:: SMP version 2
.. code-block:: none
{
(str)"err" : {
(str)"group" : (uint)
(str)"rc" : (uint)
}
}
.. group-tab:: SMP version 1 (and non-group SMP version 2)
.. code-block:: none
{
(str)"rc" : (int)
(str,opt)"rsn" : (str)
}
where:
.. table::
:align: center
+------------------+-------------------------------------------------------------------------+
| "image" | semi-optional image number; the field is not required when only one |
| | image is supported by the running application. |
+------------------+-------------------------------------------------------------------------+
| "slot" | slot number within "image"; each image has two slots : primary (running |
| | one) = 0 and secondary (for DFU dual-bank purposes) = 1. |
+------------------+-------------------------------------------------------------------------+
| "version" | string representing image version, as set with ``imgtool``. |
+------------------+-------------------------------------------------------------------------+
| "hash" | SHA256 hash of the image header and body. Note that this will not be |
| | the same as the SHA256 of the whole file, it is the field in the |
| | MCUboot TLV section that contains a hash of the data which is used for |
| | signature verification purposes. This field is optional but only |
| | optional when using MCUboot's serial recovery feature with one pair of |
| | image slots, Kconfig :kconfig:option:`CONFIG_BOOT_SERIAL_IMG_GRP_HASH` |
| | can be disabled to remove support for hashes in this configuration. |
| | MCUmgr in applications must support sending hashes. |
| | |
| | .. note:: |
| | See ``IMAGE_TLV_SHA256`` in the MCUboot image format documentation |
| | link below. |
+------------------+-------------------------------------------------------------------------+
| "bootable" | true if image has bootable flag set; this field does not have to be |
| | present if false. |
+------------------+-------------------------------------------------------------------------+
| "pending" | true if image is set for next swap; this field does not have to be |
| | present if false. |
+------------------+-------------------------------------------------------------------------+
| "confirmed" | true if image has been confirmed; this field does not have to be |
| | present if false. |
+------------------+-------------------------------------------------------------------------+
| "active" | true if image is currently active application; this field does not have |
| | to be present if false. |
+------------------+-------------------------------------------------------------------------+
| "permanent" | true if image is to stay in primary slot after the next boot; this |
| | does not have to be present if false. |
+------------------+-------------------------------------------------------------------------+
| "splitStatus" | states whether loader of split image is compatible with application |
| | part; this is unused by Zephyr. |
+------------------+-------------------------------------------------------------------------+
| "err" -> "group" | :c:enum:`mcumgr_group_t` group of the group-based error code. Only |
| | appears if an error is returned when using SMP version 2. |
+------------------+-------------------------------------------------------------------------+
| "err" -> "rc" | contains the index of the group-based error code. Only appears if |
| | non-zero (error condition) when using SMP version 2. |
+------------------+-------------------------------------------------------------------------+
| "rc" | :c:enum:`mcumgr_err_t` only appears if non-zero (error condition) when |
| | using SMP version 1 or for SMP errors when using SMP version 2. |
+------------------+-------------------------------------------------------------------------+
| "rsn" | optional string that clarifies reason for an error; specifically useful |
| | when ``rc`` is :c:enumerator:`MGMT_ERR_EUNKNOWN`. |
+------------------+-------------------------------------------------------------------------+
.. note::
For more information on how does image/slots function, please refer to
the MCUBoot documentation
https://docs.mcuboot.com/design.html#image-slots
For information on MCUboot image format, please reset to the MCUboot
documentation https://docs.mcuboot.com/design.html#image-format
Set state of image request
==========================
Set state of image request header fields:
.. table::
:align: center
+--------+--------------+----------------+
| ``OP`` | ``Group ID`` | ``Command ID`` |
+========+==============+================+
| ``2`` | ``1`` | ``0`` |
+--------+--------------+----------------+
CBOR data of request:
.. code-block:: none
{
(str,opt)"hash" : (str)
(str)"confirm" : (bool)
}
If "confirm" is false or not provided, an image with the "hash" will be set for
test, which means that it will not be marked as permanent and upon hard reset
the previous application will be restored to the primary slot.
In case when "confirm" is true, the "hash" is optional as the currently running
application will be assumed as target for confirmation.
Set state of image response
============================
The response takes the same format as :ref:`mcumgr_smp_protocol_op_1_grp_1_cmd_0`
Image upload
************
The image upload command allows to update application image.
Image upload request
====================
The image upload request is sent for each chunk of image that is uploaded, until
complete image gets uploaded to a device.
Image upload request header fields:
.. table::
:align: center
+--------+--------------+----------------+
| ``OP`` | ``Group ID`` | ``Command ID`` |
+========+==============+================+
| ``2`` | ``1`` | ``1`` |
+--------+--------------+----------------+
CBOR data of request:
.. code-block:: none
{
(str,opt)"image" : (uint)
(str,opt)"len" : (uint)
(str)"off" : (uint)
(str,opt)"sha" : (byte str)
(str)"data" : (byte str)
(str,opt)"upgrade" : (bool)
}
where:
.. table::
:align: center
+-----------+--------------------------------------------------------------------------------+
| "image" | optional image number, it does not have to appear in request at all, in which |
| | case it is assumed to be 0. Should only be present when "off" is 0. |
+-----------+--------------------------------------------------------------------------------+
| "len" | optional length of an image. Must appear when "off" is 0. |
+-----------+--------------------------------------------------------------------------------+
| "off" | offset of image chunk the request carries. |
+-----------+--------------------------------------------------------------------------------+
| "sha" | SHA256 hash of an upload; this is used to identify an upload session (e.g. to |
| | allow MCUmgr to continue a broken session), and for image verification |
| | purposes. This must be a full SHA256 hash of the whole image being uploaded, |
| | or not included if the hash is not available (in which case, upload session |
| | continuation and image verification functionality will be unavailable). Should |
| | only be present when "off" is 0. |
+-----------+--------------------------------------------------------------------------------+
| "data" | image data to write at provided offset. |
+-----------+--------------------------------------------------------------------------------+
| "upgrade" | optional flag that states that only upgrade should be allowed, so if the |
| | version of uploaded software is not higher then already on a device, the image |
| | upload will be rejected. Zephyr compares major, minor and revision (x.y.z) by |
| | default unless |
| | :kconfig:option:`CONFIG_MCUMGR_GRP_IMG_VERSION_CMP_USE_BUILD_NUMBER` is set, |
| | whereby it will compare build numbers too. Should only be present when "off" |
| | is 0. |
+-----------+--------------------------------------------------------------------------------+
.. note::
There is no field representing size of chunk that is carried as "data" because
that information is embedded within "data" field itself.
.. note::
It is possible that a server will respond to an upload with "off" of 0, this
may happen if an upload on another transport (or outside of MCUmgr entirely)
is started, if the device has rebooted or if a packet has been lost. If this
happens, a client must re-send all the required and optional fields that it
sent in the original first packet so that the upload state can be re-created
by the server. If the original fields are not included, the upload will be
unable to continue.
The MCUmgr library uses "sha" field to tag ongoing update session, to be able
to continue it in case when it gets broken, and for upload verification
purposes.
If library gets request with "off" equal zero it checks stored "sha" within its
state and if it matches it will respond to update client application with
offset that it should continue with.
If this hash is not available (e.g. because a file is being streamed) then it
must not be provided, image verification and upload session continuation
features will be unavailable in this case.
Image upload response
=====================
Image upload response header fields:
.. table::
:align: center
+--------+--------------+----------------+
| ``OP`` | ``Group ID`` | ``Command ID`` |
+========+==============+================+
| ``3`` | ``1`` | ``1`` |
+--------+--------------+----------------+
CBOR data of successful response:
.. code-block:: none
{
(str,opt)"off" : (uint)
(str,opt)"match" : (bool)
}
In case of error the CBOR data takes the form:
.. tabs::
.. group-tab:: SMP version 2
.. code-block:: none
{
(str)"err" : {
(str)"group" : (uint)
(str)"rc" : (uint)
}
}
.. group-tab:: SMP version 1 (and non-group SMP version 2)
.. code-block:: none
{
(str)"rc" : (int)
(str,opt)"rsn" : (str)
}
where:
.. table::
:align: center
+------------------+-------------------------------------------------------------------------+
| "off" | offset of last successfully written byte of update. |
+------------------+-------------------------------------------------------------------------+
| "match" | indicates if the uploaded data successfully matches the provided SHA256 |
| | hash or not, only sent in the final packet if |
| | :kconfig:option:`CONFIG_IMG_ENABLE_IMAGE_CHECK` is enabled. |
+------------------+-------------------------------------------------------------------------+
| "err" -> "group" | :c:enum:`mcumgr_group_t` group of the group-based error code. Only |
| | appears if an error is returned when using SMP version 2. |
+------------------+-------------------------------------------------------------------------+
| "err" -> "rc" | contains the index of the group-based error code. Only appears if |
| | non-zero (error condition) when using SMP version 2. |
+------------------+-------------------------------------------------------------------------+
| "rc" | :c:enum:`mcumgr_err_t` only appears if non-zero (error condition) when |
| | using SMP version 1 or for SMP errors when using SMP version 2. |
+------------------+-------------------------------------------------------------------------+
| "rsn" | optional string that clarifies reason for an error; specifically useful |
| | when ``rc`` is :c:enumerator:`MGMT_ERR_EUNKNOWN`. |
+------------------+-------------------------------------------------------------------------+
The "off" field is only included in responses to successfully processed requests;
if "rc" is negative then "off" may not appear.
Image erase
***********
The command is used for erasing image slot on a target device.
.. note::
This is synchronous command which means that a sender of request will not
receive response until the command completes, which can take a long time.
Image erase request
===================
Image erase request header fields:
.. table::
:align: center
+--------+--------------+----------------+
| ``OP`` | ``Group ID`` | ``Command ID`` |
+========+==============+================+
| ``2`` | ``1`` | ``5`` |
+--------+--------------+----------------+
CBOR data of request:
.. code-block:: none
{
(str,opt)"slot" : (uint)
}
where:
.. table::
:align: center
+---------+-----------------------------------------------------------------+
| "slot" | optional slot number, it does not have to appear in the request |
| | at all, in which case it is assumed to be 1. |
+---------+-----------------------------------------------------------------+
Image erase response
====================
Image erase response header fields:
.. table::
:align: center
+--------+--------------+----------------+
| ``OP`` | ``Group ID`` | ``Command ID`` |
+========+==============+================+
| ``3`` | ``1`` | ``5`` |
+--------+--------------+----------------+
The command sends an empty CBOR map as data if successful. In case of error the
CBOR data takes the form:
.. tabs::
.. group-tab:: SMP version 2
.. code-block:: none
{
(str)"err" : {
(str)"group" : (uint)
(str)"rc" : (uint)
}
}
.. group-tab:: SMP version 1 (and non-group SMP version 2)
.. code-block:: none
{
(str)"rc" : (int)
(str,opt)"rsn" : (str)
}
where:
.. table::
:align: center
+------------------+-------------------------------------------------------------------------+
| "err" -> "group" | :c:enum:`mcumgr_group_t` group of the group-based error code. Only |
| | appears if an error is returned when using SMP version 2. |
+------------------+-------------------------------------------------------------------------+
| "err" -> "rc" | contains the index of the group-based error code. Only appears if |
| | non-zero (error condition) when using SMP version 2. |
+------------------+-------------------------------------------------------------------------+
| "rc" | :c:enum:`mcumgr_err_t` only appears if non-zero (error condition) when |
| | using SMP version 1 or for SMP errors when using SMP version 2. |
+------------------+-------------------------------------------------------------------------+
| "rsn" | optional string that clarifies reason for an error; specifically useful |
| | when ``rc`` is :c:enumerator:`MGMT_ERR_EUNKNOWN`. |
+------------------+-------------------------------------------------------------------------+
.. note::
Response from Zephyr running device may have "rc" value of
:c:enumerator:`MGMT_ERR_EBADSTATE`, which means that the secondary
image has been marked for next boot already and may not be erased.
Part 3
한국어 전문 번역
Application/software image management group은 다음 command를 정의합니다.
| Command ID | Command description |
|---|---|
| 0 | Image 상태 |
| 1 | Image upload |
| 2 | File (예약됐지만 Zephyr에서는 지원하지 않음) |
| 3 | Corelist (예약됐지만 Zephyr에서는 지원하지 않음) |
| 4 | Coreload (예약됐지만 Zephyr에서는 지원하지 않음) |
| 5 | Image erase |
Zephyr의 “slot”과 “image” 개념
slot과 image의 정의는 MCUboot에서 왔습니다. 하나의 image는 primary와 secondary라는 slot 2개로 구성됩니다. Application은 primary slot에서 실행하고 update는 secondary slot에 upload합니다. MCUboot는 boot할 때 slot swap을 담당합니다.
따라서 slot 한 쌍은 upgrade 가능한 application 하나에 전용됩니다. Zephyr에서는 DTS가 application 하나에 할당된 fixed-partition label로 slot0_partition과 slot1_partition을 사용하면서, 각각을 image-0과 image-1이라고도 부르므로 조금 혼동될 수 있습니다.
현재 Zephyr는 image를 최대 2개 지원하며 mapping은 다음과 같습니다.
| Image | Slot labels | Slot names |
|---|---|---|
| 1 | slot0_partitionslot1_partition | image-0image-1 |
| 2 | slot2_partitionslot3_partition | image-2image-3 |
Image 상태
이 command는 image 상태를 설정하고 각 image의 현재 상태 목록을 가져오는 데 사용합니다.
Image 상태 조회 request
Image 상태 조회 request header field는 다음과 같습니다.
| OP | Group ID | Command ID |
|---|---|---|
| 0 | 1 | 0 |
이 command는 data로 빈 CBOR map을 보냅니다.
Image 상태 조회 response
Image 상태 조회 response header field는 다음과 같습니다.
| OP | Group ID | Command ID |
|---|---|---|
| 1 | 1 | 0 |
Response에는 valid image의 정보만 들어갑니다. Image가 valid하다고 식별되지 않으면 단순히 건너뜁니다.
성공한 response의 CBOR data는 다음과 같습니다.
{
(str)"images" : [
{
(str,opt)"image" : (uint)
(str)"slot" : (uint)
(str)"version" : (str)
(str,opt*)"hash" : (byte str)
(str,opt)"bootable" : (bool)
(str,opt)"pending" : (bool)
(str,opt)"confirmed" : (bool)
(str,opt)"active" : (bool)
(str,opt)"permanent" : (bool)
}
...
]
(str,opt)"splitStatus" : (int)
}
Error가 발생하면 CBOR data는 다음 형식입니다.
{
(str)"err" : {
(str)"group" : (uint)
(str)"rc" : (uint)
}
}{
(str)"rc" : (int)
(str,opt)"rsn" : (str)
}Response field의 의미는 다음과 같습니다.
image | 준선택적인 image 번호입니다. 실행 중인 application이 image 하나만 지원할 때는 필요하지 않습니다. |
slot | image 안의 slot 번호입니다. Image마다 primary(running) slot 0과 DFU dual-bank용 secondary slot 1이 있습니다. |
version | imgtool로 설정한 image version string입니다. |
hash | Image header와 body의 SHA256 hash입니다. 전체 file의 SHA256과 같지 않으며, signature 검증에 쓰는 data hash를 담은 MCUboot TLV field입니다. MCUboot serial recovery를 image slot 한 쌍으로 사용할 때만 선택 사항이며, 이 구성에서는 CONFIG_BOOT_SERIAL_IMG_GRP_HASH를 끄면 hash 지원을 제거할 수 있습니다. Application의 MCUmgr는 hash 전송을 지원해야 합니다. MCUboot image format의 IMAGE_TLV_SHA256도 참고합니다. |
bootable | Image에 bootable flag가 설정됐으면 true입니다. false이면 field를 생략할 수 있습니다. |
pending | Image가 다음 swap 대상으로 설정됐으면 true입니다. false이면 생략할 수 있습니다. |
confirmed | Image가 confirm됐으면 true입니다. false이면 생략할 수 있습니다. |
active | Image가 현재 active application이면 true입니다. false이면 생략할 수 있습니다. |
permanent | 다음 boot 뒤에도 image를 primary slot에 유지할 것이면 true입니다. false이면 생략할 수 있습니다. |
splitStatus | Split image loader와 application part가 호환되는지를 나타냅니다. Zephyr에서는 사용하지 않습니다. |
err → group | Group 기반 error code의 mcumgr_group_t group입니다. SMP version 2를 사용하며 error가 반환될 때만 나타납니다. |
err → rc | Group 기반 error code의 index입니다. SMP version 2에서 값이 0이 아닌 error condition일 때만 나타납니다. |
rc | mcumgr_err_t입니다. SMP version 1에서 값이 0이 아닌 error condition일 때, 또는 SMP version 2에서 SMP error가 발생할 때만 나타납니다. |
rsn | Error 원인을 분명히 하는 선택적 string입니다. rc가 MGMT_ERR_EUNKNOWN일 때 특히 유용합니다. |
Image 상태 설정 request
Image 상태 설정 request header field는 다음과 같습니다.
| OP | Group ID | Command ID |
|---|---|---|
| 2 | 1 | 0 |
Request의 CBOR data는 다음과 같습니다.
{
(str,opt)"hash" : (str)
(str)"confirm" : (bool)
}
confirm이 false이거나 제공되지 않으면 hash로 지정한 image를 test 대상으로 설정합니다. 이 image는 permanent로 표시되지 않으므로 hard reset 뒤에는 이전 application이 primary slot으로 복원됩니다.
confirm이 true이면 현재 실행 중인 application을 confirm 대상으로 간주하므로 hash는 선택 사항입니다.
Image 상태 설정 response
Response는 앞의 Image 상태 조회 response와 같은 형식을 사용합니다.
Image upload
Image upload command를 사용하면 application image를 update할 수 있습니다.
Image upload request
완전한 image가 device에 upload될 때까지 각 image chunk마다 image upload request를 보냅니다.
Image upload request header field는 다음과 같습니다.
| OP | Group ID | Command ID |
|---|---|---|
| 2 | 1 | 1 |
Request의 CBOR data는 다음과 같습니다.
{
(str,opt)"image" : (uint)
(str,opt)"len" : (uint)
(str)"off" : (uint)
(str,opt)"sha" : (byte str)
(str)"data" : (byte str)
(str,opt)"upgrade" : (bool)
}
Request field의 의미는 다음과 같습니다.
image | 선택적인 image 번호입니다. Request에 없으면 0으로 간주합니다. off가 0일 때만 넣어야 합니다. |
len | 선택적인 image 길이입니다. off가 0이면 반드시 넣어야 합니다. |
off | Request가 운반하는 image chunk의 offset입니다. |
sha | Upload 전체 image의 완전한 SHA256 hash입니다. Upload session 식별, 끊어진 session 재개와 image 검증에 사용합니다. Hash를 구할 수 없으면 생략할 수 있지만 session 재개와 image 검증 기능도 사용할 수 없습니다. off가 0일 때만 넣어야 합니다. |
data | 지정한 offset에 쓸 image data입니다. |
upgrade | Upgrade만 허용하도록 지정하는 선택 flag입니다. Upload software version이 device의 기존 version보다 높지 않으면 거부합니다. 기본적으로 Zephyr는 major, minor, revision(x.y.z)을 비교하며 CONFIG_MCUMGR_GRP_IMG_VERSION_CMP_USE_BUILD_NUMBER를 설정하면 build number도 비교합니다. off가 0일 때만 넣어야 합니다. |
MCUmgr library는 진행 중인 update session을 표시하고 중단 시 재개하며 upload를 검증하기 위해 sha field를 사용합니다. off가 0인 request를 받으면 저장된 sha와 비교하고, 일치하면 update client application에 계속할 offset을 응답합니다.
File streaming처럼 hash를 구할 수 없다면 sha를 제공하지 않아야 하며, 이 경우 image 검증과 upload session 재개 기능을 사용할 수 없습니다.
Image upload response
Image upload response header field는 다음과 같습니다.
| OP | Group ID | Command ID |
|---|---|---|
| 3 | 1 | 1 |
성공한 response의 CBOR data는 다음과 같습니다.
{
(str,opt)"off" : (uint)
(str,opt)"match" : (bool)
}
Error가 발생하면 CBOR data는 다음 형식입니다.
{
(str)"err" : {
(str)"group" : (uint)
(str)"rc" : (uint)
}
}{
(str)"rc" : (int)
(str,opt)"rsn" : (str)
}Response field의 의미는 다음과 같습니다.
off | 마지막으로 성공적으로 쓴 update byte의 offset입니다. |
match | Upload data가 제공한 SHA256 hash와 일치하는지를 나타냅니다. CONFIG_IMG_ENABLE_IMAGE_CHECK가 활성화됐을 때 마지막 packet에서만 보냅니다. |
err → group | Group 기반 error code의 mcumgr_group_t group입니다. SMP version 2를 사용하며 error가 반환될 때만 나타납니다. |
err → rc | Group 기반 error code의 index입니다. SMP version 2에서 값이 0이 아닌 error condition일 때만 나타납니다. |
rc | mcumgr_err_t입니다. SMP version 1에서 값이 0이 아닌 error condition일 때, 또는 SMP version 2에서 SMP error가 발생할 때만 나타납니다. |
rsn | Error 원인을 분명히 하는 선택적 string입니다. rc가 MGMT_ERR_EUNKNOWN일 때 특히 유용합니다. |
off field는 성공적으로 처리한 request의 response에만 포함됩니다. rc가 음수이면 off가 나타나지 않을 수 있습니다.
Image erase
이 command는 target device의 image slot을 지우는 데 사용합니다.
Image erase request
Image erase request header field는 다음과 같습니다.
| OP | Group ID | Command ID |
|---|---|---|
| 2 | 1 | 5 |
Request의 CBOR data는 다음과 같습니다.
{
(str,opt)"slot" : (uint)
}
Request field의 의미는 다음과 같습니다.
slot | 선택적인 slot 번호입니다. Request에 없으면 1로 간주합니다. |
Image erase response
Image erase response header field는 다음과 같습니다.
| OP | Group ID | Command ID |
|---|---|---|
| 3 | 1 | 5 |
성공하면 command는 data로 빈 CBOR map을 보냅니다.
Error가 발생하면 CBOR data는 다음 형식입니다.
{
(str)"err" : {
(str)"group" : (uint)
(str)"rc" : (uint)
}
}{
(str)"rc" : (int)
(str,opt)"rsn" : (str)
}Error field의 의미는 다음과 같습니다.
err → group | Group 기반 error code의 mcumgr_group_t group입니다. SMP version 2를 사용하며 error가 반환될 때만 나타납니다. |
err → rc | Group 기반 error code의 index입니다. SMP version 2에서 값이 0이 아닌 error condition일 때만 나타납니다. |
rc | mcumgr_err_t입니다. SMP version 1에서 값이 0이 아닌 error condition일 때, 또는 SMP version 2에서 SMP error가 발생할 때만 나타납니다. |
rsn | Error 원인을 분명히 하는 선택적 string입니다. rc가 MGMT_ERR_EUNKNOWN일 때 특히 유용합니다. |
Source
출처
영어 원문에는 문단, 문서 지시문, 표, 코드, 코드 심벌, 경로를 그대로 보존했습니다.