-
Notifications
You must be signed in to change notification settings - Fork 936
Pico 2 W OTA Update Example #559
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
Merged
Merged
Changes from all commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
4961b6e
Initial commit of OTA update example
will-v-pi a6f217d
Speedup and add hashing
will-v-pi 5ed933b
Tidy up
will-v-pi 26268ce
Tidy up and use pico_use_partition_firmware function
will-v-pi 21f76ea
Little extra fixes
will-v-pi 55872e0
Remove bootrom structs dependency
will-v-pi 837f950
Update to work with latest SDK version
will-v-pi cdcca2f
Move private.pem back to separate directories
will-v-pi 2458bf4
Fix Risc-V alignment & stack issues
will-v-pi 897b914
Increase partition sizes
will-v-pi 5b04862
Improve poll performance
will-v-pi 68af5f4
Use CYW43_FIRMWARE_FAMILY_ID
will-v-pi f540764
Add example to readme
will-v-pi fbcc887
Remove poll version
will-v-pi afc988e
Add separate README, move the python script, and add note about no_fl…
will-v-pi aed45b2
firmware -> wifi_firmware
will-v-pi aa5f92d
tweak cmake guard
kilograham 6d02d76
oops
kilograham 7a5b07f
add comment
kilograham File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
add_executable(picow_ota_update | ||
picow_ota_update.c | ||
) | ||
target_compile_definitions(picow_ota_update PRIVATE | ||
WIFI_SSID=\"${WIFI_SSID}\" | ||
WIFI_PASSWORD=\"${WIFI_PASSWORD}\" | ||
PICO_CRT0_IMAGE_TYPE_TBYB=1 | ||
) | ||
target_include_directories(picow_ota_update PRIVATE | ||
${CMAKE_CURRENT_LIST_DIR} | ||
${CMAKE_CURRENT_LIST_DIR}/.. # for our common lwipopts | ||
) | ||
target_link_libraries(picow_ota_update | ||
pico_cyw43_arch_lwip_threadsafe_background | ||
pico_stdlib | ||
pico_sha256 | ||
boot_uf2_headers | ||
) | ||
|
||
pico_use_wifi_firmware_partition(picow_ota_update) | ||
|
||
pico_hash_binary(picow_ota_update) | ||
pico_sign_binary(picow_ota_update ${CMAKE_CURRENT_LIST_DIR}/private.pem) | ||
|
||
# By default this example requires a partition table in flash, and will | ||
# update the partition that is not currently in use. To use it without | ||
# a partition table in flash, uncomment the following lines to make it | ||
# a no_flash binary, so it can update the currently running program. | ||
|
||
# pico_set_binary_type(picow_ota_update no_flash) | ||
# pico_package_uf2_output(picow_ota_update 0x10000000) | ||
|
||
pico_add_extra_outputs(picow_ota_update) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
This example requires a partition table in flash. This can be loaded by creating a UF2 from the partition table JSON in this folder: | ||
``` | ||
picotool partition create main.json pt.uf2 | ||
``` | ||
then dragging & dropping this UF2 onto the device, or loading it using `picotool` and rebooting: | ||
``` | ||
picotool load pt.uf2 | ||
picotool reboot -u | ||
``` | ||
|
||
Once the partition table is loaded, you first need to load the Wi-Fi firmware UF2 (`picow_ota_update_wifi_firmware.uf2`) followed by loading & executing the main program (`picow_ota_update.uf2`) - either by dragging and dropping them in order, or using `picotool`: | ||
``` | ||
picotool load picow_ota_update_wifi_firmware.uf2 | ||
picotool load -x picow_ota_update.uf2 | ||
``` | ||
|
||
Once running, you can use [python_ota_update.py](python_ota_update.py) to upload new UF2s to it using it's IP address: | ||
``` | ||
python python_ota_update.py 192.168.0.103 picow_ota_update.uf2 | ||
``` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#ifndef _LWIPOPTS_H | ||
#define _LWIPOPTS_H | ||
|
||
// Generally you would define your own explicit list of lwIP options | ||
// (see https://www.nongnu.org/lwip/2_1_x/group__lwip__opts.html) | ||
// | ||
// This example uses a common include to avoid repetition | ||
#include "lwipopts_examples_common.h" | ||
|
||
#endif |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
{ | ||
"version": [1, 0], | ||
"unpartitioned": { | ||
"families": ["absolute"], | ||
"permissions": { | ||
"secure": "rw", | ||
"nonsecure": "rw", | ||
"bootloader": "rw" | ||
} | ||
}, | ||
"partitions": [ | ||
{ | ||
"name": "Main A", | ||
"id": 0, | ||
"size": "1744K", | ||
"families": ["rp2350-arm-s", "rp2350-riscv"], | ||
"permissions": { | ||
"secure": "rw", | ||
"nonsecure": "rw", | ||
"bootloader": "rw" | ||
} | ||
}, | ||
{ | ||
"name": "Main B", | ||
"id": 0, | ||
"size": "1744K", | ||
"families": ["rp2350-arm-s", "rp2350-riscv"], | ||
"permissions": { | ||
"secure": "rw", | ||
"nonsecure": "rw", | ||
"bootloader": "rw" | ||
}, | ||
"link": ["a", 0] | ||
}, | ||
{ | ||
"name": "Firmware A", | ||
"id": "0x776966696669726d", | ||
"start": "3500k", | ||
"size": "256K", | ||
"families": ["cyw43-firmware"], | ||
"permissions": { | ||
"secure": "rw", | ||
"nonsecure": "rw", | ||
"bootloader": "rw" | ||
}, | ||
"ignored_during_riscv_boot": true, | ||
"no_reboot_on_uf2_download": true | ||
}, | ||
{ | ||
"name": "Firmware B", | ||
"id": 12345, | ||
"size": "256K", | ||
"families": ["cyw43-firmware"], | ||
"permissions": { | ||
"secure": "rw", | ||
"nonsecure": "rw", | ||
"bootloader": "rw" | ||
}, | ||
"link": ["a", 2], | ||
"ignored_during_riscv_boot": true, | ||
"no_reboot_on_uf2_download": true | ||
} | ||
] | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.