Skip to content

Commit 182063b

Browse files
committed
giga_r1: load firmware image from QSPI flash
Reduces flash image size by 400kB.
1 parent 64dcf0b commit 182063b

File tree

5 files changed

+136
-1
lines changed

5 files changed

+136
-1
lines changed

loader/blobs/4343WA1_bin_qspi.c

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
/*
2+
* Copyright 2025 Arduino SA
3+
* SPDX-License-Identifier: Apache-2.0
4+
*/
5+
6+
#include <zephyr/devicetree.h>
7+
#include "wiced_resource.h"
8+
9+
#define QUADSPI_MMAP_BASE DT_REG_ADDR_BY_IDX(DT_NODELABEL(quadspi), 1)
10+
#define FLASH_CHIP_OFFSET DT_REG_ADDR(DT_NODELABEL(qspi_flash))
11+
#define AIROC_PART_OFS DT_REG_ADDR(DT_NODELABEL(airoc_firmware))
12+
13+
#define FW_ADDR (QUADSPI_MMAP_BASE + FLASH_CHIP_OFFSET + AIROC_PART_OFS)
14+
#define FW_SIZE 421098 /* same as the _bin.c file */
15+
16+
const resource_hnd_t wifi_firmware_image = {
17+
RESOURCE_IN_MEMORY,
18+
FW_SIZE,
19+
{ .mem = { (const char *) FW_ADDR } }
20+
};

loader/blobs/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,5 @@ endif()
1414
if(CONFIG_AIROC_WIFI_CUSTOM)
1515
zephyr_include_directories(${CMAKE_CURRENT_LIST_DIR}) # for wifi_nvram_image.h
1616
zephyr_library_sources(4343WA1_clm_blob.c)
17-
zephyr_library_sources(4343WA1_bin.c)
17+
zephyr_library_sources(4343WA1_bin_qspi.c) # use _bin.c for a static build
1818
endif()

variants/arduino_giga_r1_stm32h747xx_m7/arduino_giga_r1_stm32h747xx_m7.conf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ CONFIG_SDIO_STACK=y
7070
CONFIG_SDHC_INIT_PRIORITY=75
7171

7272
CONFIG_AIROC_WIFI_CUSTOM=y
73+
CONFIG_STM32_MEMMAP=y
7374

7475
CONFIG_NETWORKING=y
7576
CONFIG_WIFI=y

variants/arduino_giga_r1_stm32h747xx_m7/arduino_giga_r1_stm32h747xx_m7.overlay

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -529,3 +529,7 @@
529529
dac-resolution = <12>;
530530
};
531531
};
532+
533+
/* Include common flash filesystem configuration */
534+
qspi_flash: &n25q128a1 {};
535+
#include "../common/arduino_flash_fs.dtsi"
Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
/*
2+
* Common filesystem configuration
3+
*
4+
* This file defines the following:
5+
*
6+
* 1- Common partition layout for 16MB flash:
7+
* - mbr: 4KB @ 0x000000 (Master Boot Record - protected)
8+
* - wlan: ~1020KB @ 0x001000 (Network certificates)
9+
* - ota: 5MB @ 0x100000 (OTA updates)
10+
* - kvs: 1MB @ 0x600000 (Key-Value Store)
11+
* - storage: 7MB @ 0x700000 (User data)
12+
*
13+
* 2- fstab entries and flash-disk devices for:
14+
* - /wlan: (FAT) - Network certificates partition
15+
* - /ota: (FAT) - OTA update partition
16+
* - /storage (LittleFS) - User data partition
17+
*/
18+
&qspi_flash {
19+
/delete-node/ partitions;
20+
partitions {
21+
compatible = "fixed-partitions";
22+
#address-cells = <1>;
23+
#size-cells = <1>;
24+
25+
mbr_partition: partition@0 {
26+
label = "mbr";
27+
reg = <0x000000 DT_SIZE_K(4)>;
28+
};
29+
30+
/* Partition 1: Network certificates 1MB - 4KB (MBR reserved at 0x0) */
31+
wlan_partition: partition@1000 {
32+
label = "wlan";
33+
reg = <0x001000 (DT_SIZE_M(1) - DT_SIZE_K(4))>;
34+
};
35+
36+
/* Partition 2: OTA 5MB */
37+
ota_partition: partition@100000 {
38+
label = "ota";
39+
reg = <0x100000 DT_SIZE_M(5)>;
40+
};
41+
42+
/* Partition 3: Provisioning KVStore 1MB */
43+
kvs_partition: partition@600000 {
44+
label = "kvs";
45+
reg = <0x600000 DT_SIZE_M(1)>;
46+
};
47+
48+
/* Partition 4: User data 7MB */
49+
storage_partition: partition@700000 {
50+
label = "storage";
51+
reg = <0x700000 DT_SIZE_M(7)>;
52+
};
53+
54+
/* Partition 5: Binary FW image for the Airoc WLAN */
55+
airoc_firmware: partition@f80000 {
56+
label = "4343WA1.bin";
57+
reg = <0xf80000 DT_SIZE_K(512)>;
58+
};
59+
};
60+
};
61+
62+
/ {
63+
flash_disk0 {
64+
status = "okay";
65+
compatible = "zephyr,flash-disk";
66+
partition = <&wlan_partition>;
67+
disk-name = "wlan";
68+
sector-size = <4096>;
69+
cache-size = <4096>;
70+
};
71+
72+
flash_disk1 {
73+
status = "okay";
74+
compatible = "zephyr,flash-disk";
75+
partition = <&ota_partition>;
76+
disk-name = "ota";
77+
sector-size = <4096>;
78+
cache-size = <4096>;
79+
};
80+
81+
fstab {
82+
compatible = "zephyr,fstab";
83+
84+
wlan_fs: wlan_fs {
85+
compatible = "zephyr,fstab,fatfs";
86+
automount;
87+
disk-access;
88+
mount-point = "/wlan:";
89+
};
90+
91+
ota_fs: ota_fs {
92+
compatible = "zephyr,fstab,fatfs";
93+
automount;
94+
disk-access;
95+
mount-point = "/ota:";
96+
};
97+
98+
storage_fs: storage_fs {
99+
compatible = "zephyr,fstab,littlefs";
100+
automount;
101+
mount-point = "/storage";
102+
partition = <&storage_partition>;
103+
read-size = <16>;
104+
prog-size = <4096>;
105+
cache-size = <4096>;
106+
lookahead-size = <32>;
107+
block-cycles = <512>;
108+
};
109+
};
110+
};

0 commit comments

Comments
 (0)