Part 1
요약·해설
Image list 초기화, Composition page 전환, start·end·verify·apply lifecycle을 설명합니다.
Target
BLOB Server
Application
0~2 · 128~130
Part 2
접을 수 있는 영어 원문 전체
영어 원문 전체 펼치기
37709771BBEAAC210CBEC768B8154A84F9253781E7777455FFF5014AEA4D068B
.. _bluetooth_mesh_dfu_srv:
Firmware Update Server
######################
The Firmware Update Server model implements the Target node functionality of the
:ref:`bluetooth_mesh_dfu` subsystem. It extends the :ref:`bluetooth_mesh_blob_srv`, which it uses to
receive the firmware image binary from the Distributor node.
Together with the extended BLOB Transfer Server model, the Firmware Update Server model implements
all the required functionality for receiving firmware updates over the mesh network, but does not
provide any functionality for storing, applying or verifying the images.
Firmware images
***************
The Firmware Update Server holds a list of all the updatable firmware images on the device. The full
list shall be passed to the server through the ``_imgs`` parameter in
:c:macro:`BT_MESH_DFU_SRV_INIT`, and must be populated before the Bluetooth Mesh subsystem is
started. Each firmware image in the image list must be independently updatable, and should have its
own firmware ID.
For instance, a device with an upgradable bootloader, an application and a peripheral chip with
firmware update capabilities could have three entries in the firmware image list, each with their
own separate firmware ID.
Receiving transfers
*******************
The Firmware Update Server model uses a BLOB Transfer Server model on the same element to transfer
the binary image. The interaction between the Firmware Update Server, BLOB Transfer Server and
application is described below:
.. figure:: ../../../../../../connectivity/bluetooth/api/mesh/images/dfu_srv.svg
:align: center
:alt: Bluetooth Mesh Firmware Update Server transfer
Bluetooth Mesh Firmware Update Server transfer
Transfer check
==============
The transfer check is an optional pre-transfer check the application can perform on incoming
firmware image metadata. The Firmware Update Server performs the transfer check by calling the
:c:member:`check <bt_mesh_dfu_srv_cb.check>` callback.
The result of the transfer check is a pass/fail status return and the expected
:c:enum:`bt_mesh_dfu_effect`. The DFU effect return parameter will be communicated back to the
Distributor, and should indicate what effect the firmware update will have on the mesh state of the
device.
.. _bluetooth_mesh_dfu_srv_comp_data_and_models_metadata:
Composition Data and Models Metadata
------------------------------------
If the transfer will cause the device to change its Composition Data or become
unprovisioned, this should be communicated through the effect parameter of the metadata check.
When the transfer will cause the Composition Data to change, and the
:ref:`bluetooth_mesh_models_rpr_srv` is supported, the Composition Data of the new firmware image
will be represented by Composition Data Pages 128, 129, and 130. The Models Metadata of the new
firmware image will be represented by Models Metadata Page 128. Composition Data Pages 0, 1 and 2,
and Models Metadata Page 0, will represent the Composition Data and the Models Metadata of the old
firmware image until the device is reprovisioned with Node Provisioning Protocol Interface (NPPI)
procedures using the :ref:`bluetooth_mesh_models_rpr_cli`.
The application must call functions :c:func:`bt_mesh_comp_change_prepare` and
:c:func:`bt_mesh_models_metadata_change_prepare` to store the existing Composition Data and Models
Metadata pages before booting into the firmware with the updated Composition Data and Models
Metadata. The old Composition Data will then be loaded into Composition Data Pages 0, 1 and 2,
while the Composition Data in the new firmware will be loaded into Composition Data Pages 128, 129
and 130. The Models Metadata for the old image will be loaded into Models Metadata Page 0, and the
Models Metadata for the new image will be loaded into Models Metadata Page 128.
Limitation:
* It is not possible to change the Composition Data of the device and keep the device provisioned
and working with the old firmware after the new firmware image is applied.
Start
=====
The Start procedure prepares the application for the incoming transfer. It'll contain information
about which image is being updated, as well as the update metadata.
The Firmware Update Server :c:member:`start <bt_mesh_dfu_srv_cb.start>` callback must return a
pointer to the BLOB Writer the BLOB Transfer Server will send the BLOB to.
BLOB transfer
=============
After the setup stage, the Firmware Update Server prepares the BLOB Transfer Server for the incoming
transfer. The entire firmware image is transferred to the BLOB Transfer Server, which passes the
image to its assigned BLOB Writer.
At the end of the BLOB transfer, the Firmware Update Server calls its
:c:member:`end <bt_mesh_dfu_srv_cb.end>` callback.
Image verification
==================
After the BLOB transfer has finished, the application should verify the image in any way it can to
ensure that it is ready for being applied. Once the image has been verified, the application calls
:c:func:`bt_mesh_dfu_srv_verified`.
If the image can't be verified, the application calls :c:func:`bt_mesh_dfu_srv_rejected`.
Applying the image
==================
Finally, if the image was verified, the Distributor may instruct the Firmware Update Server to apply
the transfer. This is communicated to the application through the :c:member:`apply
<bt_mesh_dfu_srv_cb.apply>` callback. The application should swap the image and start running with
the new firmware. The firmware image table should be updated to reflect the new firmware ID of the
updated image.
When the transfer applies to the mesh application itself, the device might have to reboot as part of
the swap. This restart can be performed from inside the apply callback, or done asynchronously.
After booting up with the new firmware, the firmware image table should be updated before the
Bluetooth Mesh subsystem is started.
The Distributor will read out the firmware image table to confirm that the transfer was successfully
applied. If the metadata check indicated that the device would become unprovisioned, the Target node
is not required to respond to this check.
API reference
*************
.. doxygengroup:: bt_mesh_dfu_srv
:project: Zephyr
:members:
Part 3
한국어 전문 번역
Firmware Update Server
Firmware Update Server model은 DFU subsystem의 Target node 기능을 구현합니다. BLOB Transfer Server를 extend해 Distributor에서 firmware image binary를 받습니다.
Extended BLOB Transfer Server와 함께 mesh network에서 firmware update를 받는 데 필요한 기능을 모두 구현하지만 image 저장, 적용 또는 검증 기능은 제공하지 않습니다. 이 책임은 application에 있습니다.
Firmware image list
Server는 device에서 update 가능한 모든 firmware image list를 보유합니다. 전체 list를 BT_MESH_DFU_SRV_INIT의 _imgs parameter로 전달하고 Bluetooth Mesh subsystem을 시작하기 전에 채워야 합니다.
List의 각 image는 독립적으로 update 가능해야 하고 자체 firmware ID를 가져야 합니다. 예를 들어 bootloader, application과 update 가능한 peripheral chip이 있는 device라면 각기 다른 firmware ID를 가진 entry 세 개를 둘 수 있습니다.
Transfer 수신
Firmware Update Server는 같은 element의 BLOB Transfer Server로 binary image를 전송받습니다.
Transfer check
Application이 incoming firmware metadata에 수행할 수 있는 optional pre-transfer check입니다. Server가 bt_mesh_dfu_srv_cb.check callback을 호출합니다.
결과는 pass/fail status와 예상 bt_mesh_dfu_effect입니다. Effect를 Distributor에 돌려보내 update가 device Mesh state에 미칠 영향을 알립니다.
Composition Data와 Models Metadata
Transfer가 Composition Data를 바꾸거나 device를 unprovisioned 상태로 만든다면 metadata check의 effect parameter로 알려야 합니다.
Composition Data가 바뀌고 Remote Provisioning Server를 지원하면 새 firmware의 Composition Data는 Page 128·129·130에, Models Metadata는 Page 128에 나타냅니다. Device를 NPPI procedure로 reprovision하기 전까지 Page 0·1·2와 Models Metadata Page 0은 이전 firmware의 정보를 나타냅니다.
Updated Composition Data와 Models Metadata가 있는 firmware로 boot하기 전에 bt_mesh_comp_change_prepare와 bt_mesh_models_metadata_change_prepare를 호출해 기존 page를 저장해야 합니다.
그 뒤 이전 Composition Data는 Page 0·1·2, 새 Composition Data는 Page 128·129·130에 load합니다. 이전 Models Metadata는 Page 0, 새 image metadata는 Page 128에 load합니다.
제한
새 firmware를 적용한 뒤 device의 Composition Data를 변경하면서 provisioned 상태와 이전 firmware 동작을 동시에 유지할 수는 없습니다.
Start
Start procedure는 incoming transfer를 받을 application을 준비합니다. Update할 image와 metadata 정보가 들어 있습니다. bt_mesh_dfu_srv_cb.start callback은 BLOB Transfer Server가 BLOB을 보낼 BLOB Writer pointer를 반환해야 합니다.
BLOB transfer
Setup 뒤 Server는 incoming transfer를 위해 BLOB Transfer Server를 준비합니다. Firmware image 전체가 전송되고 BLOB Transfer Server가 지정된 BLOB Writer에 전달합니다. 끝나면 bt_mesh_dfu_srv_cb.end callback을 호출합니다.
Image verification
BLOB transfer가 끝나면 application은 가능한 검증을 수행해 image를 적용할 준비가 되었는지 확인해야 합니다. 성공하면 bt_mesh_dfu_srv_verified, 검증할 수 없으면 bt_mesh_dfu_srv_rejected를 호출합니다.
Image 적용
Image가 검증되면 Distributor가 Server에 적용을 지시할 수 있습니다. bt_mesh_dfu_srv_cb.apply callback으로 application에 알리며 application은 image를 교체하고 새 firmware 실행을 시작해야 합니다. Firmware image table도 새 firmware ID로 갱신해야 합니다.
Mesh application 자체를 update하면 교체 과정에서 reboot해야 할 수 있습니다. Apply callback 안에서 즉시 restart하거나 비동기로 수행할 수 있습니다. 새 firmware로 boot한 뒤 Bluetooth Mesh subsystem을 시작하기 전에 image table을 갱신해야 합니다.
Distributor는 firmware image table을 읽어 적용 성공 여부를 확인합니다. Metadata check에서 device가 unprovisioned 상태가 된다고 알렸다면 Target은 이 확인 요청에 응답할 필요가 없습니다.
API Reference
공식 bt_mesh_dfu_srv Doxygen group이 Firmware Update Server callback과 state API를 생성합니다.
Source
출처
영어 원문에는 문단, 문서 지시문, 표, 코드, 코드 심벌, 경로를 그대로 보존했습니다.