A simple example to send the log files to the extra partition.
Clone the empty app and modify mos.yml
config_schema:
- ["debug.level", 2]
# fstab options
- ["fstab.fs0.opts", '{"bs": 4096, "es": 4096}']
- ["fstab.fs0.path", "/ext"]
- ["fstab.fs0.create", true] # use this line only when first flashing the firmware
#- ["fstab.fs0.created", true] # use this line after the first flash of the firmware
- ["file_logger.enable", true]
- ["file_logger.dir", "/ext"]
libs:
- origin: https://github.com/mongoose-os-libs/file-logger
- origin: https://github.com/mongoose-os-libs/fstab
- origin: https://github.com/mongoose-os-libs/ota-http-server
- origin: https://github.com/mongoose-os-libs/rpc-service-config
- origin: https://github.com/mongoose-os-libs/rpc-service-fs
- origin: https://github.com/mongoose-os-libs/rpc-uart
- origin: https://github.com/mongoose-os-libs/rpc-ws
- origin: https://github.com/mongoose-os-libs/sntp
- origin: https://github.com/mongoose-os-libs/vfs-fs-spiffs
- origin: https://github.com/mongoose-os-libs/wifi
conds:
- when: mos.platform == "esp32"
apply:
config_schema:
# esp32 partition
- ["fstab.fs0.dev", "fs_ext"]
- ["fstab.fs0.type", "SPIFFS"]
build_vars:
ESP_IDF_EXTRA_PARTITION: fs_ext,data,spiffs,,256K
- when: mos.platform == "esp8266"
apply:
libs:
- origin: https://github.com/mongoose-os-libs/vfs-dev-part
config_schema:
- ["devtab.dev0.name", "data"]
- ["devtab.dev0.type", "part"]
- ["devtab.dev0.opts", '{"dev": "sfl0", "offset": 0x300000, "size": 0x40000}']
- ["fstab.fs0.dev", "data"]
- ["fstab.fs0.type", "SPIFFS"]
- ["fstab.fs0.opts", '{"bs": 4096, "es": 4096}']
- ["fstab.fs0.path", "/ext"]
mos ls -l ext
log_000-19700101-000115.log 11335
log_001-19700101-000001.log 3933
log_002-20210224-131209.log 3978
log_003-20210224-131624.log 3978
log_004-20210224-132039.log 2107