41
41
//| After the next-update partition is written a validation
42
42
//| check is performed and on a successful validation this
43
43
//| partition is set as the boot partition. On next reset,
44
- //| firmware will be loaded from this partition"""
44
+ //| firmware will be loaded from this partition.
45
+ //|
46
+ //| Here is the sequence of commands to follow:
47
+ //|
48
+ //| .. code-block:: python
49
+ //|
50
+ //| import ota
51
+ //|
52
+ //| ota.flash(buffer, offset)
53
+ //| ota.finish()
54
+ //| """
55
+ //| ...
45
56
//|
46
57
47
58
//| def switch() -> None:
48
- //| """Switches the boot partition."""
59
+ //| """Switches the boot partition. On next reset,
60
+ //| firmware will be loaded from the partition
61
+ //| just switched over to."""
49
62
//| ...
50
63
//|
51
64
STATIC mp_obj_t ota_switch (void ) {
@@ -56,7 +69,10 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_0(ota_switch_obj, ota_switch);
56
69
57
70
//| def finish() -> None:
58
71
//| """Validates flashed firmware, sets next boot partition.
59
- //| **Must be called after** `ota.flash()`"""
72
+ //| **Must be called** after the firmware has been
73
+ //| completely written into the flash using `ota.flash()`.
74
+ //|
75
+ //| This is to be called only once per update."""
60
76
//| ...
61
77
//|
62
78
STATIC mp_obj_t ota_finish (void ) {
@@ -65,11 +81,14 @@ STATIC mp_obj_t ota_finish(void) {
65
81
}
66
82
STATIC MP_DEFINE_CONST_FUN_OBJ_0 (ota_finish_obj , ota_finish );
67
83
68
- //| def flash(*buffer: WriteableBuffer , offset: int=0) -> None:
84
+ //| def flash(*buffer: ReadableBuffer , offset: int=0) -> None:
69
85
//| """Writes one of two OTA partitions at the given offset.
70
86
//|
71
87
//| The default offset is 0. It is necessary to provide the
72
- //| offset when writing in discontinous chunks."""
88
+ //| offset when writing in discontinous chunks.
89
+ //|
90
+ //| This can be called multiple times when flashing the firmware
91
+ //| in small chunks."""
73
92
//| ...
74
93
//|
75
94
STATIC mp_obj_t ota_flash (size_t n_args , const mp_obj_t * pos_args , mp_map_t * kw_args ) {
0 commit comments