Skip to content

Commit 931d6db

Browse files
committed
Initial commit of OTA update example
1 parent da4e50d commit 931d6db

File tree

6 files changed

+563
-0
lines changed

6 files changed

+563
-0
lines changed

pico_w/wifi/CMakeLists.txt

+2
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ else()
1818
add_subdirectory_exclude_platforms(tcp_server)
1919
add_subdirectory_exclude_platforms(udp_beacon)
2020

21+
add_subdirectory_exclude_platforms(ota_update rp2040)
22+
2123
if (NOT PICO_MBEDTLS_PATH)
2224
message("Skipping tls examples as PICO_MBEDTLS_PATH is not defined")
2325
else()

pico_w/wifi/ota_update/CMakeLists.txt

+46
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
add_executable(picow_ota_update_background
2+
picow_ota_update.c
3+
)
4+
target_compile_definitions(picow_ota_update_background PRIVATE
5+
WIFI_SSID=\"${WIFI_SSID}\"
6+
WIFI_PASSWORD=\"${WIFI_PASSWORD}\"
7+
PICO_CRT0_IMAGE_TYPE_TBYB=1
8+
)
9+
target_include_directories(picow_ota_update_background PRIVATE
10+
${CMAKE_CURRENT_LIST_DIR}
11+
${CMAKE_CURRENT_LIST_DIR}/.. # for our common lwipopts
12+
)
13+
target_link_libraries(picow_ota_update_background
14+
pico_cyw43_arch_lwip_threadsafe_background
15+
pico_stdlib
16+
boot_uf2_headers
17+
)
18+
19+
pico_sign_binary(picow_ota_update_background)
20+
# pico_set_binary_type(picow_ota_update_background no_flash)
21+
# pico_package_uf2_output(picow_ota_update_background 0x10000000)
22+
23+
pico_add_extra_outputs(picow_ota_update_background)
24+
25+
add_executable(picow_ota_update_poll
26+
picow_ota_update.c
27+
)
28+
target_compile_definitions(picow_ota_update_poll PRIVATE
29+
WIFI_SSID=\"${WIFI_SSID}\"
30+
WIFI_PASSWORD=\"${WIFI_PASSWORD}\"
31+
PICO_CRT0_IMAGE_TYPE_TBYB=1
32+
)
33+
target_include_directories(picow_ota_update_poll PRIVATE
34+
${CMAKE_CURRENT_LIST_DIR}
35+
${CMAKE_CURRENT_LIST_DIR}/.. # for our common lwipopts
36+
)
37+
target_link_libraries(picow_ota_update_poll
38+
pico_cyw43_arch_lwip_poll
39+
pico_stdlib
40+
boot_uf2_headers
41+
)
42+
43+
# pico_set_binary_type(picow_ota_update_background no_flash)
44+
# pico_package_uf2_output(picow_ota_update_background 0x10000000)
45+
46+
pico_add_extra_outputs(picow_ota_update_poll)

pico_w/wifi/ota_update/lwipopts.h

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#ifndef _LWIPOPTS_H
2+
#define _LWIPOPTS_H
3+
4+
// Generally you would define your own explicit list of lwIP options
5+
// (see https://www.nongnu.org/lwip/2_1_x/group__lwip__opts.html)
6+
//
7+
// This example uses a common include to avoid repetition
8+
#include "lwipopts_examples_common.h"
9+
10+
#endif

pico_w/wifi/ota_update/main.json

+61
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
{
2+
"version": [1, 0],
3+
"unpartitioned": {
4+
"families": ["absolute"],
5+
"permissions": {
6+
"secure": "rw",
7+
"nonsecure": "rw",
8+
"bootloader": "rw"
9+
}
10+
},
11+
"partitions": [
12+
{
13+
"name": "Main A",
14+
"id": 0,
15+
"size": "500K",
16+
"families": ["rp2350-arm-s", "rp2350-riscv"],
17+
"permissions": {
18+
"secure": "rw",
19+
"nonsecure": "rw",
20+
"bootloader": "rw"
21+
}
22+
},
23+
{
24+
"name": "Main B",
25+
"id": 0,
26+
"size": "500K",
27+
"families": ["rp2350-arm-s", "rp2350-riscv"],
28+
"permissions": {
29+
"secure": "rw",
30+
"nonsecure": "rw",
31+
"bootloader": "rw"
32+
},
33+
"link": ["a", 0]
34+
},
35+
{
36+
"name": "Firmware A",
37+
"id": "0x123456789abcdef0",
38+
"size": "240K",
39+
"families": ["0x12345678"],
40+
"permissions": {
41+
"secure": "rw",
42+
"nonsecure": "rw",
43+
"bootloader": "rw"
44+
},
45+
"ignored_during_riscv_boot": true
46+
},
47+
{
48+
"name": "Firmware B",
49+
"id": 12345,
50+
"size": "240K",
51+
"families": ["0x12345678"],
52+
"permissions": {
53+
"secure": "rw",
54+
"nonsecure": "rw",
55+
"bootloader": "rw"
56+
},
57+
"link": ["a", 2],
58+
"ignored_during_riscv_boot": true
59+
}
60+
]
61+
}

0 commit comments

Comments
 (0)