Skip to content

Commit c3b2473

Browse files
committed
samples: siwx917_ota: http/s OTAF application
This application demonstrates the support for OTA firmware upgrade. Signed-off-by: Devika Raju <Devika.Raju@silabs.com>
1 parent 121d6ed commit c3b2473

File tree

6 files changed

+1039
-0
lines changed

6 files changed

+1039
-0
lines changed

samples/siwx91x_ota/CMakeLists.txt

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Copyright (c) 2025 Silicon Laboratories Inc.
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
cmake_minimum_required(VERSION 3.20.0)
5+
6+
find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
7+
project(siwx91x_ota)
8+
9+
target_sources(app PRIVATE src/main.c)
10+
11+
# Ensure the directory for the generated file exists
12+
set(gen_dir ${ZEPHYR_BINARY_DIR}/include/generated/)
13+
file(MAKE_DIRECTORY ${gen_dir})

samples/siwx91x_ota/Kconfig

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# Config options for OTA application
2+
#
3+
# Copyright (c) 2025 Silicon Laboratories Inc.
4+
# SPDX-License-Identifier: Apache-2.0
5+
6+
mainmenu "SiWx91x OTA Configuration"
7+
8+
menu "SiWx91x OTA application options"
9+
10+
config OTA_WIFI_SSID
11+
string "WiFi SSID"
12+
default "your_ssid"
13+
help
14+
WiFi SSID for the network to connect to.
15+
16+
config OTA_WIFI_PSK
17+
string "WiFi PSK"
18+
default "your_psk"
19+
help
20+
WiFi PSK (password) for the network to connect to.
21+
22+
config OTA_UPDATE_URL
23+
string "OTA update URL"
24+
default "http://example.com:8080/firmware.rps"
25+
help
26+
The full URL for the OTA firmware update.
27+
28+
endmenu
29+
30+
source "Kconfig.zephyr"

samples/siwx91x_ota/README.rst

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
# Copyright (c) 2025 Silicon Laboratories Inc.
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
.. zephyr:code-sample:: siwx91x_otas
5+
:name: HTTP OTA Firmware Update on SiWx917
6+
:relevant-api: wifi
7+
8+
Demonstrates HTTP/HTTPS OTA firmware update using SiWx917 on Zephyr.
9+
10+
Overview
11+
********
12+
13+
Application demonstrates how to perform HTTP/HTTPS OTA firmware updates on the
14+
SiWx917 platform using Zephyr RTOS. It connects to a Wi-Fi network, establishes
15+
a secure HTTPS connection using a CA certificate, and downloads firmware
16+
updates from a remote server. The application showcases secure connectivity and
17+
OTA update mechanisms for IoT devices.
18+
19+
Requirements
20+
************
21+
22+
* SiWx917 development board with Wi-Fi support
23+
* HTTP server
24+
25+
Configurations
26+
**************
27+
28+
The following configurations can be modified in ``prj.conf``:
29+
30+
* Wi-Fi Settings
31+
* ``CONFIG_OTA_WIFI_SSID`` - Network name
32+
* ``CONFIG_OTA_WIFI_PSK`` - Network password
33+
* ``CONFIG_OTA_UPDATE_URL`` - OTA update URL
34+
35+
.. _signed image generation:
36+
https://docs.zephyrproject.org/latest/kconfig.html#CONFIG_SIWX91X_SIGN_KEY
37+
38+
Building and Running
39+
********************
40+
41+
1. Configure required settings
42+
2. Build and Flash
43+
44+
.. code-block:: console
45+
46+
west build -b siwx917_rb4338a siwx917_ota -p
47+
west flash
48+
49+
3. Run HTTP/HTTPS server
50+
51+
Test the Application
52+
********************
53+
54+
1. After flashing the SiWx91x, the device will scan for the specified AP and
55+
attempt to connect if found.
56+
2. Once connected, the SiWx91x will initiate an HTTP/S connection to the specified
57+
server and download the firmware binary.
58+
3. The OTA update process will be logged to the serial console.
59+
60+
Note
61+
****
62+
63+
This application is not for production.

samples/siwx91x_ota/prj.conf

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
# Copyright (c) 2025 Silicon Laboratories Inc.
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
# Network Stack Configuration
5+
CONFIG_NETWORKING=y
6+
CONFIG_NET_MGMT=y
7+
CONFIG_NET_TCP=y
8+
CONFIG_NET_CONNECTION_MANAGER=y
9+
10+
# IPv4/IPv6 Support
11+
CONFIG_NET_IPV4=y
12+
CONFIG_NET_IPV6=y
13+
CONFIG_NET_ARP=y
14+
CONFIG_NET_DHCPV4=y
15+
CONFIG_NET_DHCPV6=y
16+
17+
# WiFi Configuration
18+
CONFIG_WIFI=y
19+
20+
# Memory and Threading
21+
CONFIG_MAIN_STACK_SIZE=4098
22+
CONFIG_INIT_STACKS=y
23+
CONFIG_HEAP_MEM_POOL_SIZE=8192
24+
25+
# CMSIS Configuration
26+
CONFIG_CMSIS_V2_MUTEX_MAX_COUNT=10
27+
CONFIG_CMSIS_V2_EVT_FLAGS_MAX_COUNT=10
28+
29+
# Network Parameters
30+
CONFIG_NET_TCP_MAX_RECV_WINDOW_SIZE=10240
31+
32+
# Socket Support
33+
CONFIG_REQUIRES_FULL_LIBC=y
34+
CONFIG_NET_SOCKETS=y
35+
36+
# HTTP Client Configuration
37+
CONFIG_HTTP_CLIENT=y
38+
CONFIG_HTTP_PARSER_URL=y
39+
CONFIG_NET_MGMT_EVENT=y
40+
41+
# TLS Security Configuration
42+
CONFIG_MBEDTLS=y
43+
CONFIG_MBEDTLS_BUILTIN=y
44+
CONFIG_MBEDTLS_ENABLE_HEAP=y
45+
CONFIG_MBEDTLS_HEAP_SIZE=60000
46+
CONFIG_TLS_CREDENTIALS=y
47+
CONFIG_NET_SOCKETS_SOCKOPT_TLS=y
48+
CONFIG_MBEDTLS_SSL_MAX_CONTENT_LEN=8000
49+
50+
# TLS Protocol and Cipher Configuration
51+
CONFIG_MBEDTLS_TLS_VERSION_1_2=y
52+
CONFIG_MBEDTLS_SHA256=y
53+
CONFIG_MBEDTLS_CIPHER_AES_ENABLED=y
54+
CONFIG_MBEDTLS_CIPHER_ALL_ENABLED=y
55+
CONFIG_MBEDTLS_CIPHER_CHACHA20_ENABLED=y
56+
CONFIG_MBEDTLS_POLY1305=y
57+
58+
CONFIG_ASSERT=y
59+
60+
# DNS configuration
61+
CONFIG_DNS_RESOLVER=y
62+
63+
# for SLAAC configuration
64+
CONFIG_NET_IPV6_ND=y
65+
CONFIG_NET_IPV6_RA_RDNSS=y
66+
CONFIG_NET_IPV6_NBR_CACHE=y
67+
CONFIG_NET_IPV6_MLD=y
68+
CONFIG_NET_IPV6_DAD=y
69+
70+
# Wi-Fi configuration
71+
CONFIG_OTA_WIFI_SSID="<AP-SSID>"
72+
CONFIG_OTA_WIFI_PSK="<AP-PASSWORD>"
73+
74+
# OTA Configuration
75+
CONFIG_SIWX91X_FIRMWARE_UPGRADE=y
76+
CONFIG_REBOOT=y

samples/siwx91x_ota/sample.yaml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Copyright (c) 2025 Silicon Laboratories Inc.
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
sample:
5+
name: HTTP/HTTPS OTAF
6+
description: HTTP/HTTPS OTA firmware update application for SiWx917
7+
tests:
8+
sample.net.http_otaf:
9+
harness: net
10+
platform_allow:
11+
- siwx917_rb4338a
12+
tags:
13+
- net
14+
- wifi
15+
- http
16+
- tls
17+
- ota
18+
integration_platforms:
19+
- siwx917_rb4338a

0 commit comments

Comments
 (0)