From c0420781951f59ac7c841ca917014a50c71c5a89 Mon Sep 17 00:00:00 2001 From: chinky Date: Thu, 18 Jul 2024 20:59:48 +0800 Subject: [PATCH] =?UTF-8?q?=E9=80=82=E9=85=8Drtt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 21 +++++++++++ Kconfig | 98 +++++++++++++++++++++++++++++++++++++++++++++++++++ SConscript | 17 +++++++++ inc/fdb_cfg.h | 4 +-- 4 files changed, 138 insertions(+), 2 deletions(-) create mode 100644 .gitignore create mode 100644 Kconfig create mode 100644 SConscript diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..83c3270 --- /dev/null +++ b/.gitignore @@ -0,0 +1,21 @@ +*.pyc +*.map +*.dblite +*.axf +*.exe +*.pdb +*.idb +*.ilk +*.old +build +Debug +*~ +*.o +*.obj +*.out +*.bak +*.dep +*.lib +*.i +*.d +.DS_Stor* diff --git a/Kconfig b/Kconfig new file mode 100644 index 0000000..db6c2b0 --- /dev/null +++ b/Kconfig @@ -0,0 +1,98 @@ + +# Kconfig file for package FlashDB +menuconfig LIB_USING_FLASHDB + bool "FlashDB: A lightweight database that supports key-value and time series data." + default y + +if LIB_USING_FLASHDB + + config FDB_USING_KVDB + bool "Using KVDB feature" + default y + + if FDB_USING_KVDB + config FDB_KV_AUTO_UPDATE + bool + prompt "Auto update KV to latest default when current KVDB version number is changed." + default n + + config FDB_KV_USING_CACHE + bool "Enable KVDB cache" + default n + + config FDB_KV_CACHE_TABLE_SIZE + int "KVDB cache table size(1~65535)" + default 128 + range 1 65535 + depends on FDB_KV_USING_CACHE + endif + + config FDB_USING_TSDB + bool + prompt "Using TSDB (Time series database) feature" + default y + + choice + prompt "Storage mode" + default FDB_USING_FAL_MODE + config FDB_USING_FAL_MODE + bool + prompt "Using FAL storage mode" + select PKG_USING_FAL if RT_VER_NUM < 0x40100 + select RT_USING_FAL if RT_VER_NUM >= 0x40100 + + config FDB_USING_FILE_MODE + bool "Using file mode" + endchoice + + if FDB_USING_FAL_MODE + choice + prompt "Write minimum granularity" + default FDB_WRITE_GRAN_1BIT + config FDB_WRITE_GRAN_1BIT + bool "1bit such as Nor Flash" + + config FDB_WRITE_GRAN_8BITS + bool "8bits such as STM32F2/F4" + + config FDB_WRITE_GRAN_32BITS + bool "32bits such as STM32F1" + + config FDB_WRITE_GRAN_64BITS + bool "64bits such as STM32L4" + + config FDB_WRITE_GRAN_128BITS + bool "128bits" + endchoice + + config FDB_WRITE_GRAN + int + default 1 if FDB_WRITE_GRAN_1BIT + default 8 if FDB_WRITE_GRAN_8BITS + default 32 if FDB_WRITE_GRAN_32BITS + default 64 if FDB_WRITE_GRAN_64BITS + default 128 if FDB_WRITE_GRAN_128BITS + endif + choice + prompt "File storage mode" + depends on FDB_USING_FILE_MODE + default FDB_USING_FILE_POSIX_MODE + + config FDB_USING_FILE_LIBC_MODE + bool "Using LIBC file API" + + config FDB_USING_FILE_POSIX_MODE + bool "Using POSIX file API" + endchoice + + + config FLASHDB_USING_SAMPLES + bool "Enable samples" + default n + + config FDB_DEBUG_ENABLE + bool "Enable debug log output" + default y + + +endif diff --git a/SConscript b/SConscript new file mode 100644 index 0000000..541fef6 --- /dev/null +++ b/SConscript @@ -0,0 +1,17 @@ +from building import * + +# get current directory +cwd = GetCurrentDir() +# The set of source files associated with this SConscript file. +src = Glob('src/*.c') +path = [cwd + '/inc'] + +if GetDepend(['FLASHDB_USING_SAMPLES']): + src += Glob('samples/*.c') + +if GetDepend(['RT_USING_UTEST']): + src += Glob('tests/*.c') + +group = DefineGroup('FlashDB', src, depend = ['LIB_USING_FLASHDB'], CPPPATH = path) + +Return('group') \ No newline at end of file diff --git a/inc/fdb_cfg.h b/inc/fdb_cfg.h index e8748ab..2c0d8ec 100644 --- a/inc/fdb_cfg.h +++ b/inc/fdb_cfg.h @@ -11,7 +11,7 @@ #ifndef _FDB_CFG_H_ #define _FDB_CFG_H_ - +#if 0 /* using KVDB feature */ #define FDB_USING_KVDB @@ -46,5 +46,5 @@ /* print debug information */ #define FDB_DEBUG_ENABLE - +#endif #endif /* _FDB_CFG_H_ */