Skip to content

Commit

Permalink
[feat] Add littlefs to access flash storage
Browse files Browse the repository at this point in the history
  • Loading branch information
wy-hh committed Aug 23, 2024
1 parent dd8b002 commit 4aefb7f
Show file tree
Hide file tree
Showing 11 changed files with 435 additions and 8 deletions.
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 @@ -688,6 +688,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
14 changes: 12 additions & 2 deletions 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 @@ -161,8 +162,17 @@ 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-{all-clusters,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
5 changes: 4 additions & 1 deletion src/platform/bouffalolab/BL602/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,13 @@ static_library("BL602") {
"../common/FactoryDataProvider.h",
]
}

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

deps = [
"${chip_root}/src/credentials:credentials_header",
Expand Down
5 changes: 4 additions & 1 deletion src/platform/bouffalolab/BL702/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,13 @@ static_library("BL702") {
"../common/FactoryDataProvider.h",
]
}

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

if (chip_enable_wifi) {
sources += [
Expand Down
5 changes: 4 additions & 1 deletion src/platform/bouffalolab/BL702L/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,13 @@ static_library("BL702L") {
"../common/FactoryDataProvider.h",
]
}

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

if (chip_enable_openthread) {
# needed for MTD/FTD
Expand Down
Loading

0 comments on commit 4aefb7f

Please sign in to comment.