-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added exercise 5 firmware update implementation #190
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@malw4 reviewed. Remember to NOT merge this before the newest pico-client
is released.
docs/academy/exercise5.md
Outdated
@@ -1,20 +1,446 @@ | |||
# Graduation Project | |||
# Exercise 5: Implement Firmware Update | |||
In this exercise, we implement Object 5 - Firmware Update. It utilizes the pico_fota_bootloader to swap the flash partitions after downloading the appropriate binary file from Coiote IoT DM. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In this exercise, we implement Object 5 - Firmware Update. It utilizes the pico_fota_bootloader to swap the flash partitions after downloading the appropriate binary file from Coiote IoT DM. | |
In this exercise, we implement Object 5 - Firmware Update. It utilizes the [pico_fota_bootloader](https://github.com/JZimnol/pico_fota_bootloader) to swap the flash partitions after downloading the appropriate binary file from Coiote IoT DM. |
docs/academy/exercise5.md
Outdated
|
||
Your graduation project involves building an application that utilizes the LwM2M standard and the {{ coiote_long_name }}. Whether you choose the Raspberry Pi Pico W or any other IoT device, your task is to effectively gather sensor data and establish a cloud connection. | ||
* A Raspberry Pi Pico W board with a USB cable | ||
* A LM35 temperature sensor |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it really needed in this exercise?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sorry, copy and paste gone wrong
docs/academy/exercise5.md
Outdated
* [Getting Started guides](https://iotdevzone.avsystem.com/docs/LwM2M_Client/Getting_started/) containing detailed documentation on using different IoT development kits | ||
* [AVSystem Discord](https://discord.avsystem.com/) for support and for submitting your graduation project | ||
!!! Note | ||
This part only describes functions that are in the code. The user doesn’t have to modify the code. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It doesn't say where the code can be found.
docs/academy/exercise5.md
Outdated
|
||
!!! important "Provide your feedback" | ||
<p style="text-align: center;">firmware_update.h</p> | ||
``` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All code snippets should start with "```c", this way the syntax can be colored.
docs/academy/exercise5.md
Outdated
<p style="text-align: center;">main.c</p> | ||
``` | ||
#include "lwip/sockets.h" | ||
#include <anjay/anjay.h> | ||
#include <anjay/core.h> | ||
#include <anjay/security.h> | ||
#include <anjay/server.h> | ||
#include <avsystem/commons/avs_list.h> | ||
#include <avsystem/commons/avs_log.h> | ||
#include <avsystem/commons/avs_prng.h> | ||
#include <avsystem/commons/avs_time.h> | ||
|
||
#include "firmware_update.h" | ||
``` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the user doesn't need to modify the code, this code snippet that shows the #include "firmware_update.h"
is useless and can be removed.
docs/academy/exercise5.md
Outdated
1. Click **Schedule Update** to trigger the Firmware Update process. | ||
|
||
!!! Note | ||
After doing so, a Firmware Update process will begin. Check the serial output logs - `the INFO [fw_update] [/anjay-pico-client/firmware_update/firmware_update.c]: Downloaded X bytes` logs should appear. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After doing so, a Firmware Update process will begin. Check the serial output logs - `the INFO [fw_update] [/anjay-pico-client/firmware_update/firmware_update.c]: Downloaded X bytes` logs should appear. | |
After doing so, a Firmware Update process will begin. Check the serial output logs - the `INFO [fw_update] [/anjay-pico-client/firmware_update/firmware_update.c]: Downloaded X bytes` logs should appear. |
![Successful update](images/success.png) | ||
|
||
!!! note | ||
While the device is updating its firmware, it will deregister and reboot using the new firmware. This process may time several minutes. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
reboot using the new firmware
sounds... strange
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
look at this https://iotdevzone.avsystem.com/docs/Coiote_IoT_DM/Single_update/#download-upgrade-process. There is also this note
docs/academy/exercise5.md
Outdated
|
||
### Monitoring the update process | ||
|
||
During the update process, the status of the firmware update can be monitored by reviewing the Resources **State** `/5/*/3` and **Update Results** `/5/*/5`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/5
is a single instance object, so no *
.
docs/academy/exercise5.md
Outdated
4. **Updated** `state 0` & `update result 1` | ||
|
||
!!! important "Update successful?" | ||
Does the **State** `/5/*/3` report `0` and the **Update Results** `/5/*/5` report `1`? Congratulations! You've successfully updated the firmware of your device. 🎉 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does the **State** `/5/*/3` report `0` and the **Update Results** `/5/*/5` report `1`? Congratulations! You've successfully updated the firmware of your device. 🎉 | |
Does the **State** `/5/*/3` report `0` and the **Update Result** `/5/*/5` report `1`? Congratulations! You've successfully updated the firmware of your device 🎉 |
|
||
We're constantly working on improving the LwM2M Academy. Please share with us your feedback about this module so we can create an even better learning experience. | ||
|
||
[Feedback form](https://forms.gle/UAFLJs9LJocAeger9){: .md-button .md-button--big } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The feedback form does not include the Module 5 Exercise
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@malw4 re-reviewed.
docs/academy/exercise5.md
Outdated
* [Getting Started guides](https://iotdevzone.avsystem.com/docs/LwM2M_Client/Getting_started/) containing detailed documentation on using different IoT development kits | ||
* [AVSystem Discord](https://discord.avsystem.com/) for support and for submitting your graduation project | ||
!!! Note | ||
This part only describes functions that are in the code in **Anjay-pico-client/firmware_update** folder. The user doesn’t have to modify the code. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This part only describes functions that are in the code in **Anjay-pico-client/firmware_update** folder. The user doesn’t have to modify the code. | |
This part only describes functions that are in the code in **Anjay-pico-client/firmware_update** directory. The user doesn’t have to modify the code. |
|
||
<p style="text-align: center;">flash_aligned_writer.c</p> | ||
``` c | ||
#include <assert.h> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You've indented the code, but not the whole section. It renders badly. Applies for other code snippets.
docs/academy/module5.md
Outdated
@@ -73,6 +73,11 @@ Learn more about the Firmware Update Object on the [OMA LwM2M Object and Resourc | |||
| `update result 10` | **Firmware update cancelled** | | |||
| `update result 11` | **Firmware update deferred** | | |||
|
|||
|
|||
## What is Bootloader and why do I need this here? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No no no, this place is z dupy
for that in my opinion. THis hsould be in Exercise 5, before Implement Firmware Update
for example.
docs/academy/exercise5.md
Outdated
Does the **State** `/5/*/3` report `0` and the **Update Result** `/5/*/5` report `1`? Congratulations! You've successfully updated the firmware of your device. 🎉 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is single instance, so no *
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The code snippets in firmware_update.c
are still not up to date or are incorrect.
out_writer->writer_cb = writer_cb; | ||
} | ||
<p style="text-align: center;">flash_aligned_writer.c</p> | ||
``` c |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The whole code is still indented not the way it should be. The "code section" is OK itself, the code inside is indented unnecessarily.
docs/academy/exercise5.md
Outdated
void flash_aligned_writer_new(uint8_t *batch_buf, | ||
size_t batch_buf_max_len_bytes, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
void flash_aligned_writer_new(uint8_t *batch_buf, | |
size_t batch_buf_max_len_bytes, | |
void flash_aligned_writer_new(uint8_t *batch_buf, | |
size_t batch_buf_max_len_bytes, |
And everywhere else, the code is not aligned after copy-paste.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@malw4 approving in advance, but please make any necessary changes discussed privately
No description provided.