26
26
27
27
#include "shared-bindings/ota/__init__.h"
28
28
29
- //| """ota module
29
+ //| """OTA Module
30
+ //|
31
+ //| The `ota` module implements over-the-air update.
32
+ //|
33
+ //| There are two identical ota partitions ota_0/1, these
34
+ //| contain different firmware versions.
35
+ //| Having two partitions enables rollback functionality.
36
+ //|
37
+ //| The two partitions are defined as boot partition and
38
+ //| next-update partition. Calling `ota.flash()` writes the
39
+ //| next-update partition.
40
+ //|
41
+ //| After the next-update partition is written a validation
42
+ //| check is performed and on a successful validation this
43
+ //| partition is set as the boot partition. On next reset,
44
+ //| firmware will be loaded from this partition"""
30
45
//|
31
- //| The `ota` module implements over-the-air update."""
32
46
33
47
//| def switch() -> None:
34
- //| """Switches the boot partition.
48
+ //| """Switches the boot partition."""
35
49
//| ...
36
50
//|
37
51
STATIC mp_obj_t ota_switch (void ) {
@@ -42,7 +56,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_0(ota_switch_obj, ota_switch);
42
56
43
57
//| def finish() -> None:
44
58
//| """Validates flashed firmware, sets next boot partition.
45
- //| **Must be called after** `ota.flash()`
59
+ //| **Must be called after** `ota.flash()`"""
46
60
//| ...
47
61
//|
48
62
STATIC mp_obj_t ota_finish (void ) {
@@ -52,7 +66,10 @@ STATIC mp_obj_t ota_finish(void) {
52
66
STATIC MP_DEFINE_CONST_FUN_OBJ_0 (ota_finish_obj , ota_finish );
53
67
54
68
//| def flash(*buffer: WriteableBuffer, offset: int=0) -> None:
55
- //| """Writes one of two OTA partition at the given offset.
69
+ //| """Writes one of two OTA partitions at the given offset.
70
+ //|
71
+ //| The default offset is 0. It is necessary to provide the
72
+ //| offset when writing in discontinous chunks."""
56
73
//| ...
57
74
//|
58
75
STATIC mp_obj_t ota_flash (size_t n_args , const mp_obj_t * pos_args , mp_map_t * kw_args ) {
0 commit comments