Skip to content

Commit 20200ee

Browse files
authored
[Bouffalo Lab] Add littlefs to access flash storage (#35169)
* [feat] Add littlefs to access flash storage * fix restyle * update ci build job and remove regex in BLConfig_littlefs.cpp * fix restyle * fix compile error * fix restyle * fix compile error after restyle * fix restyle with include order
1 parent 6c4f94b commit 20200ee

File tree

12 files changed

+526
-24
lines changed

12 files changed

+526
-24
lines changed

.github/workflows/examples-bouffalolab.yaml

+20-20
Original file line numberDiff line numberDiff line change
@@ -57,25 +57,25 @@ jobs:
5757
run: |
5858
./scripts/run_in_build_env.sh \
5959
"./scripts/build/build_examples.py \
60-
--target bouffalolab-bl602-night-light-light \
61-
--target bouffalolab-bl602-night-light-light-mfd \
62-
--target bouffalolab-bl602-iot-matter-v1-light-115200-rpc \
60+
--target bouffalolab-bl602dk-light-easyflash \
61+
--target bouffalolab-bl602dk-light-mfd-littlefs \
62+
--target bouffalolab-bl602dk-light-rpc-115200-littlefs \
6363
build \
6464
--copy-artifacts-to out/artifacts \
6565
"
6666
- name: Prepare some bloat report from the previous builds
6767
run: |
6868
.environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \
6969
bl602 bl602 lighting-app \
70-
out/artifacts/bouffalolab-bl602-night-light-light/chip-bl602-lighting-example.out \
70+
out/artifacts/bouffalolab-bl602dk-light-easyflash/chip-bl602-lighting-example.out \
7171
/tmp/bloat_reports/
7272
.environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \
7373
bl602 bl602+mfd lighting-app \
74-
out/artifacts/bouffalolab-bl602-night-light-light-mfd/chip-bl602-lighting-example.out \
74+
out/artifacts/bouffalolab-bl602dk-light-mfd-littlefs/chip-bl602-lighting-example.out \
7575
/tmp/bloat_reports/
7676
.environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \
7777
bl602 bl602+rpc lighting-app \
78-
out/artifacts/bouffalolab-bl602-iot-matter-v1-light-115200-rpc/chip-bl602-lighting-example.out \
78+
out/artifacts/bouffalolab-bl602dk-light-rpc-115200-littlefs/chip-bl602-lighting-example.out \
7979
/tmp/bloat_reports/
8080
- name: Clean out build output
8181
run: rm -rf ./out
@@ -84,35 +84,35 @@ jobs:
8484
run: |
8585
./scripts/run_in_build_env.sh \
8686
"./scripts/build/build_examples.py \
87-
--target bouffalolab-bl706-night-light-light \
88-
--target bouffalolab-bl706-night-light-light-mfd \
89-
--target bouffalolab-bl706dk-light-ethernet \
90-
--target bouffalolab-bl706dk-light-wifi-fp \
91-
--target bouffalolab-xt-zb6-devkit-light-115200-rpc \
87+
--target bouffalolab-bl706dk-light-easyflash \
88+
--target bouffalolab-bl706dk-light-mfd-littlefs \
89+
--target bouffalolab-bl706dk-light-ethernet-littlefs \
90+
--target bouffalolab-bl706dk-light-wifi-littlefs \
91+
--target bouffalolab-bl706dk-light-rpc-115200-littlefs \
9292
build \
9393
--copy-artifacts-to out/artifacts \
9494
"
9595
- name: Prepare some bloat report from the previous builds
9696
run: |
9797
.environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \
9898
bl702 bl702 lighting-app \
99-
out/artifacts/bouffalolab-bl706-night-light-light/chip-bl702-lighting-example.out \
99+
out/artifacts/bouffalolab-bl706dk-light-easyflash/chip-bl702-lighting-example.out \
100100
/tmp/bloat_reports/
101101
.environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \
102102
bl702 bl702+mfd lighting-app \
103-
out/artifacts/bouffalolab-bl706-night-light-light-mfd/chip-bl702-lighting-example.out \
103+
out/artifacts/bouffalolab-bl706dk-light-mfd-littlefs/chip-bl702-lighting-example.out \
104104
/tmp/bloat_reports/
105105
.environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \
106106
bl702 bl706-eth lighting-app \
107-
out/artifacts/bouffalolab-bl706dk-light-ethernet/chip-bl702-lighting-example.out \
107+
out/artifacts/bouffalolab-bl706dk-light-ethernet-littlefs/chip-bl702-lighting-example.out \
108108
/tmp/bloat_reports/
109109
.environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \
110110
bl702 bl706-wifi lighting-app \
111-
out/artifacts/bouffalolab-bl706dk-light-wifi-fp/chip-bl702-lighting-example.out \
111+
out/artifacts/bouffalolab-bl706dk-light-wifi-littlefs/chip-bl702-lighting-example.out \
112112
/tmp/bloat_reports/
113113
.environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \
114114
bl702 bl702+rpc lighting-app \
115-
out/artifacts/bouffalolab-xt-zb6-devkit-light-115200-rpc/chip-bl702-lighting-example.out \
115+
out/artifacts/bouffalolab-bl706dk-light-rpc-115200-littlefs/chip-bl702-lighting-example.out \
116116
/tmp/bloat_reports/
117117
- name: Clean out build output
118118
run: rm -rf ./out
@@ -122,20 +122,20 @@ jobs:
122122
run: |
123123
./scripts/run_in_build_env.sh \
124124
"./scripts/build/build_examples.py \
125-
--target bouffalolab-bl704ldk-light \
126-
--target bouffalolab-bl704ldk-light-mfd \
125+
--target bouffalolab-bl704ldk-light-easyflash \
126+
--target bouffalolab-bl704ldk-light-mfd-littlefs \
127127
build \
128128
--copy-artifacts-to out/artifacts \
129129
"
130130
- name: Prepare some bloat report from the previous builds
131131
run: |
132132
.environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \
133133
bl702l bl702l lighting-app \
134-
out/artifacts/bouffalolab-bl704ldk-light/chip-bl702l-lighting-example.out \
134+
out/artifacts/bouffalolab-bl704ldk-light-easyflash/chip-bl702l-lighting-example.out \
135135
/tmp/bloat_reports/
136136
.environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \
137137
bl702l bl702l+mfd lighting-app \
138-
out/artifacts/bouffalolab-bl704ldk-light-mfd/chip-bl702l-lighting-example.out \
138+
out/artifacts/bouffalolab-bl704ldk-light-mfd-littlefs/chip-bl702l-lighting-example.out \
139139
/tmp/bloat_reports/
140140
- name: Clean out build output
141141
run: rm -rf ./out

examples/lighting-app/bouffalolab/common/AppTask.cpp

-2
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,6 @@
4646
#include <LEDWidget.h>
4747
#include <plat.h>
4848

49-
#include <easyflash.h>
50-
5149
extern "C" {
5250
#include <bl_gpio.h>
5351
#include <hal_gpio.h>

scripts/build/build/targets.py

+1
Original file line numberDiff line numberDiff line change
@@ -712,6 +712,7 @@ def BuildBouffalolabTarget():
712712
target.AppendModifier('wifi', enable_wifi=True)
713713
target.AppendModifier('thread', enable_thread=True)
714714
target.AppendModifier('easyflash', enable_easyflash=True)
715+
target.AppendModifier('littlefs', enable_littlefs=True)
715716
target.AppendModifier('shell', enable_shell=True)
716717
target.AppendModifier('mfd', enable_mfd=True)
717718
target.AppendModifier('rotating_device_id', enable_rotating_device_id=True)

scripts/build/builders/bouffalolab.py

+11-1
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ def __init__(self,
8989
enable_heap_monitoring: bool = False,
9090
use_matter_openthread: bool = False,
9191
enable_easyflash: bool = False,
92+
enable_littlefs: bool = False
9293
):
9394

9495
if 'BL602' == module_type:
@@ -162,7 +163,16 @@ def __init__(self,
162163
self.argsOpt.append(f'chip_mdns="{chip_mdns}"')
163164
self.argsOpt.append(f'chip_inet_config_enable_ipv4={str(enable_ethernet or enable_wifi).lower()}')
164165

165-
self.argsOpt.append(f'bouffalo_sdk_component_easyflash_enabled=true')
166+
if enable_easyflash and enable_littlefs:
167+
raise Exception("Only one of easyflash and littlefs can be enabled.")
168+
169+
if not enable_easyflash and not enable_littlefs:
170+
logging.fatal('*' * 80)
171+
logging.fatal('littlefs is added to support for flash storage access.')
172+
logging.fatal('Please consider and select one of easyflash and littlefs to use.')
173+
logging.fatal('*' * 80)
174+
raise Exception("None of easyflash and littlefs select to build.")
175+
self.argsOpt.append(f'bouffalo_sdk_component_easyflash_enabled={"false" if enable_littlefs else "true"}')
166176

167177
if enable_thread:
168178
self.argsOpt.append('chip_system_config_use_open_thread_inet_endpoints=true')

scripts/build/testdata/all_targets_linux_x64.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
ameba-amebad-{all-clusters,all-clusters-minimal,light,light-switch,pigweed}
22
asr-{asr582x,asr595x,asr550x}-{all-clusters,all-clusters-minimal,lighting,light-switch,lock,bridge,temperature-measurement,thermostat,ota-requestor,dishwasher,refrigerator}[-ota][-shell][-no_logging][-factory][-rotating_id][-rio]
33
android-{arm,arm64,x86,x64,androidstudio-arm,androidstudio-arm64,androidstudio-x86,androidstudio-x64}-{chip-tool,chip-test,tv-server,tv-casting-app,java-matter-controller,kotlin-matter-controller,virtual-device-app}[-no-debug]
4-
bouffalolab-{bl602dk,bl704ldk,bl706dk,bl602-night-light,bl706-night-light,bl602-iot-matter-v1,xt-zb6-devkit}-light[-ethernet][-wifi][-thread][-easyflash][-shell][-mfd][-rotating_device_id][-rpc][-cdc][-mot][-resetcnt][-memmonitor][-115200][-fp]
4+
bouffalolab-{bl602dk,bl704ldk,bl706dk,bl602-night-light,bl706-night-light,bl602-iot-matter-v1,xt-zb6-devkit}-light[-ethernet][-wifi][-thread][-easyflash][-littlefs][-shell][-mfd][-rotating_device_id][-rpc][-cdc][-mot][-resetcnt][-memmonitor][-115200][-fp]
55
cc32xx-{lock,air-purifier}
66
ti-cc13x4_26x4-{lighting,lock,pump,pump-controller}[-mtd][-ftd]
77
cyw30739-{cyw30739b2_p5_evk_01,cyw30739b2_p5_evk_02,cyw30739b2_p5_evk_03,cyw930739m2evb_01,cyw930739m2evb_02}-{light,light-switch,lock,thermostat}

src/platform/bouffalolab/BL602/BUILD.gn

+2
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,8 @@ static_library("BL602") {
6464

6565
if (bouffalo_sdk_component_easyflash_enabled) {
6666
sources += [ "../common/BLConfig.cpp" ]
67+
} else {
68+
sources += [ "../common/BLConfig_littlefs.cpp" ]
6769
}
6870

6971
deps = [

src/platform/bouffalolab/BL702/BUILD.gn

+2
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,8 @@ static_library("BL702") {
6868

6969
if (bouffalo_sdk_component_easyflash_enabled) {
7070
sources += [ "../common/BLConfig.cpp" ]
71+
} else {
72+
sources += [ "../common/BLConfig_littlefs.cpp" ]
7173
}
7274

7375
if (chip_enable_wifi) {

src/platform/bouffalolab/BL702L/BUILD.gn

+2
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,8 @@ static_library("BL702L") {
6666

6767
if (bouffalo_sdk_component_easyflash_enabled) {
6868
sources += [ "../common/BLConfig.cpp" ]
69+
} else {
70+
sources += [ "../common/BLConfig_littlefs.cpp" ]
6971
}
7072

7173
if (chip_enable_openthread) {

0 commit comments

Comments
 (0)