Skip to content

Commit

Permalink
[Bouffalo Lab] Add littlefs to access flash storage (#35169)
Browse files Browse the repository at this point in the history
* [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
  • Loading branch information
wy-hh authored Oct 2, 2024
1 parent 6c4f94b commit 20200ee
Show file tree
Hide file tree
Showing 12 changed files with 526 additions and 24 deletions.
40 changes: 20 additions & 20 deletions .github/workflows/examples-bouffalolab.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -57,25 +57,25 @@ jobs:
run: |
./scripts/run_in_build_env.sh \
"./scripts/build/build_examples.py \
--target bouffalolab-bl602-night-light-light \
--target bouffalolab-bl602-night-light-light-mfd \
--target bouffalolab-bl602-iot-matter-v1-light-115200-rpc \
--target bouffalolab-bl602dk-light-easyflash \
--target bouffalolab-bl602dk-light-mfd-littlefs \
--target bouffalolab-bl602dk-light-rpc-115200-littlefs \
build \
--copy-artifacts-to out/artifacts \
"
- name: Prepare some bloat report from the previous builds
run: |
.environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \
bl602 bl602 lighting-app \
out/artifacts/bouffalolab-bl602-night-light-light/chip-bl602-lighting-example.out \
out/artifacts/bouffalolab-bl602dk-light-easyflash/chip-bl602-lighting-example.out \
/tmp/bloat_reports/
.environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \
bl602 bl602+mfd lighting-app \
out/artifacts/bouffalolab-bl602-night-light-light-mfd/chip-bl602-lighting-example.out \
out/artifacts/bouffalolab-bl602dk-light-mfd-littlefs/chip-bl602-lighting-example.out \
/tmp/bloat_reports/
.environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \
bl602 bl602+rpc lighting-app \
out/artifacts/bouffalolab-bl602-iot-matter-v1-light-115200-rpc/chip-bl602-lighting-example.out \
out/artifacts/bouffalolab-bl602dk-light-rpc-115200-littlefs/chip-bl602-lighting-example.out \
/tmp/bloat_reports/
- name: Clean out build output
run: rm -rf ./out
Expand All @@ -84,35 +84,35 @@ jobs:
run: |
./scripts/run_in_build_env.sh \
"./scripts/build/build_examples.py \
--target bouffalolab-bl706-night-light-light \
--target bouffalolab-bl706-night-light-light-mfd \
--target bouffalolab-bl706dk-light-ethernet \
--target bouffalolab-bl706dk-light-wifi-fp \
--target bouffalolab-xt-zb6-devkit-light-115200-rpc \
--target bouffalolab-bl706dk-light-easyflash \
--target bouffalolab-bl706dk-light-mfd-littlefs \
--target bouffalolab-bl706dk-light-ethernet-littlefs \
--target bouffalolab-bl706dk-light-wifi-littlefs \
--target bouffalolab-bl706dk-light-rpc-115200-littlefs \
build \
--copy-artifacts-to out/artifacts \
"
- name: Prepare some bloat report from the previous builds
run: |
.environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \
bl702 bl702 lighting-app \
out/artifacts/bouffalolab-bl706-night-light-light/chip-bl702-lighting-example.out \
out/artifacts/bouffalolab-bl706dk-light-easyflash/chip-bl702-lighting-example.out \
/tmp/bloat_reports/
.environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \
bl702 bl702+mfd lighting-app \
out/artifacts/bouffalolab-bl706-night-light-light-mfd/chip-bl702-lighting-example.out \
out/artifacts/bouffalolab-bl706dk-light-mfd-littlefs/chip-bl702-lighting-example.out \
/tmp/bloat_reports/
.environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \
bl702 bl706-eth lighting-app \
out/artifacts/bouffalolab-bl706dk-light-ethernet/chip-bl702-lighting-example.out \
out/artifacts/bouffalolab-bl706dk-light-ethernet-littlefs/chip-bl702-lighting-example.out \
/tmp/bloat_reports/
.environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \
bl702 bl706-wifi lighting-app \
out/artifacts/bouffalolab-bl706dk-light-wifi-fp/chip-bl702-lighting-example.out \
out/artifacts/bouffalolab-bl706dk-light-wifi-littlefs/chip-bl702-lighting-example.out \
/tmp/bloat_reports/
.environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \
bl702 bl702+rpc lighting-app \
out/artifacts/bouffalolab-xt-zb6-devkit-light-115200-rpc/chip-bl702-lighting-example.out \
out/artifacts/bouffalolab-bl706dk-light-rpc-115200-littlefs/chip-bl702-lighting-example.out \
/tmp/bloat_reports/
- name: Clean out build output
run: rm -rf ./out
Expand All @@ -122,20 +122,20 @@ jobs:
run: |
./scripts/run_in_build_env.sh \
"./scripts/build/build_examples.py \
--target bouffalolab-bl704ldk-light \
--target bouffalolab-bl704ldk-light-mfd \
--target bouffalolab-bl704ldk-light-easyflash \
--target bouffalolab-bl704ldk-light-mfd-littlefs \
build \
--copy-artifacts-to out/artifacts \
"
- name: Prepare some bloat report from the previous builds
run: |
.environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \
bl702l bl702l lighting-app \
out/artifacts/bouffalolab-bl704ldk-light/chip-bl702l-lighting-example.out \
out/artifacts/bouffalolab-bl704ldk-light-easyflash/chip-bl702l-lighting-example.out \
/tmp/bloat_reports/
.environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \
bl702l bl702l+mfd lighting-app \
out/artifacts/bouffalolab-bl704ldk-light-mfd/chip-bl702l-lighting-example.out \
out/artifacts/bouffalolab-bl704ldk-light-mfd-littlefs/chip-bl702l-lighting-example.out \
/tmp/bloat_reports/
- name: Clean out build output
run: rm -rf ./out
Expand Down
2 changes: 0 additions & 2 deletions examples/lighting-app/bouffalolab/common/AppTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,6 @@
#include <LEDWidget.h>
#include <plat.h>

#include <easyflash.h>

extern "C" {
#include <bl_gpio.h>
#include <hal_gpio.h>
Expand Down
1 change: 1 addition & 0 deletions scripts/build/build/targets.py
Original file line number Diff line number Diff line change
Expand Up @@ -712,6 +712,7 @@ def BuildBouffalolabTarget():
target.AppendModifier('wifi', enable_wifi=True)
target.AppendModifier('thread', enable_thread=True)
target.AppendModifier('easyflash', enable_easyflash=True)
target.AppendModifier('littlefs', enable_littlefs=True)
target.AppendModifier('shell', enable_shell=True)
target.AppendModifier('mfd', enable_mfd=True)
target.AppendModifier('rotating_device_id', enable_rotating_device_id=True)
Expand Down
12 changes: 11 additions & 1 deletion scripts/build/builders/bouffalolab.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ def __init__(self,
enable_heap_monitoring: bool = False,
use_matter_openthread: bool = False,
enable_easyflash: bool = False,
enable_littlefs: bool = False
):

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

self.argsOpt.append(f'bouffalo_sdk_component_easyflash_enabled=true')
if enable_easyflash and enable_littlefs:
raise Exception("Only one of easyflash and littlefs can be enabled.")

if not enable_easyflash and not enable_littlefs:
logging.fatal('*' * 80)
logging.fatal('littlefs is added to support for flash storage access.')
logging.fatal('Please consider and select one of easyflash and littlefs to use.')
logging.fatal('*' * 80)
raise Exception("None of easyflash and littlefs select to build.")
self.argsOpt.append(f'bouffalo_sdk_component_easyflash_enabled={"false" if enable_littlefs else "true"}')

if enable_thread:
self.argsOpt.append('chip_system_config_use_open_thread_inet_endpoints=true')
Expand Down
2 changes: 1 addition & 1 deletion scripts/build/testdata/all_targets_linux_x64.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
ameba-amebad-{all-clusters,all-clusters-minimal,light,light-switch,pigweed}
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]
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]
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]
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]
cc32xx-{lock,air-purifier}
ti-cc13x4_26x4-{lighting,lock,pump,pump-controller}[-mtd][-ftd]
cyw30739-{cyw30739b2_p5_evk_01,cyw30739b2_p5_evk_02,cyw30739b2_p5_evk_03,cyw930739m2evb_01,cyw930739m2evb_02}-{light,light-switch,lock,thermostat}
Expand Down
2 changes: 2 additions & 0 deletions src/platform/bouffalolab/BL602/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ static_library("BL602") {

if (bouffalo_sdk_component_easyflash_enabled) {
sources += [ "../common/BLConfig.cpp" ]
} else {
sources += [ "../common/BLConfig_littlefs.cpp" ]
}

deps = [
Expand Down
2 changes: 2 additions & 0 deletions src/platform/bouffalolab/BL702/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ static_library("BL702") {

if (bouffalo_sdk_component_easyflash_enabled) {
sources += [ "../common/BLConfig.cpp" ]
} else {
sources += [ "../common/BLConfig_littlefs.cpp" ]
}

if (chip_enable_wifi) {
Expand Down
2 changes: 2 additions & 0 deletions src/platform/bouffalolab/BL702L/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ static_library("BL702L") {

if (bouffalo_sdk_component_easyflash_enabled) {
sources += [ "../common/BLConfig.cpp" ]
} else {
sources += [ "../common/BLConfig_littlefs.cpp" ]
}

if (chip_enable_openthread) {
Expand Down
Loading

0 comments on commit 20200ee

Please sign in to comment.