Skip to content

Commit 7f6d013

Browse files
committed
variants/common/arduino_flash_fs.dtsi: Add common FS config.
Provides a common file system configuration and partitions that can just be included by overlays. Signed-off-by: iabdalkader <i.abdalkader@gmail.com>
1 parent df2f2b8 commit 7f6d013

File tree

1 file changed

+111
-0
lines changed

1 file changed

+111
-0
lines changed
Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
/*
2+
* Common filesystem configuration
3+
*
4+
* This overlay 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+
* Usage in board overlay:
19+
*
20+
* #define FLASH_FILESYSTEM_NODE flash_node
21+
* #include "../common/arduino_flash_fs.dtsi"
22+
*
23+
* Replace flash_node with your board's flash node (e.g., at25sf128a).
24+
*/
25+
flash_partitions: &FLASH_FILESYSTEM_NODE {
26+
/delete-node/ partitions;
27+
partitions {
28+
compatible = "fixed-partitions";
29+
#address-cells = <1>;
30+
#size-cells = <1>;
31+
32+
mbr_partition: partition@0 {
33+
label = "mbr";
34+
reg = <0x000000 DT_SIZE_K(4)>;
35+
};
36+
37+
/* Partition 1: Network certificates 1MB - 4KB (MBR reserved at 0x0) */
38+
wlan_partition: partition@1000 {
39+
label = "wlan";
40+
reg = <0x001000 (DT_SIZE_M(1) - DT_SIZE_K(4))>;
41+
};
42+
43+
/* Partition 2: OTA 5MB */
44+
ota_partition: partition@100000 {
45+
label = "ota";
46+
reg = <0x100000 DT_SIZE_M(5)>;
47+
};
48+
49+
/* Partition 3: Provisioning KVStore 1MB */
50+
kvs_partition: partition@600000 {
51+
label = "kvs";
52+
reg = <0x600000 DT_SIZE_M(1)>;
53+
};
54+
55+
/* Partition 4: User data 7MB */
56+
storage_partition: partition@700000 {
57+
label = "storage";
58+
reg = <0x700000 DT_SIZE_M(7)>;
59+
};
60+
};
61+
};
62+
63+
/ {
64+
flash_disk0 {
65+
status = "okay";
66+
compatible = "zephyr,flash-disk";
67+
partition = <&wlan_partition>;
68+
disk-name = "wlan";
69+
sector-size = <4096>;
70+
cache-size = <4096>;
71+
};
72+
73+
flash_disk1 {
74+
status = "okay";
75+
compatible = "zephyr,flash-disk";
76+
partition = <&ota_partition>;
77+
disk-name = "ota";
78+
sector-size = <4096>;
79+
cache-size = <4096>;
80+
};
81+
82+
fstab {
83+
compatible = "zephyr,fstab";
84+
85+
wlan_fs: wlan_fs {
86+
compatible = "zephyr,fstab,fatfs";
87+
automount;
88+
disk-access;
89+
mount-point = "/wlan:";
90+
};
91+
92+
ota_fs: ota_fs {
93+
compatible = "zephyr,fstab,fatfs";
94+
automount;
95+
disk-access;
96+
mount-point = "/ota:";
97+
};
98+
99+
storage_fs: storage_fs {
100+
compatible = "zephyr,fstab,littlefs";
101+
automount;
102+
mount-point = "/storage";
103+
partition = <&storage_partition>;
104+
read-size = <16>;
105+
prog-size = <4096>;
106+
cache-size = <4096>;
107+
lookahead-size = <32>;
108+
block-cycles = <512>;
109+
};
110+
};
111+
};

0 commit comments

Comments
 (0)