aboutsummaryrefslogtreecommitdiffstats
path: root/src/libs
diff options
context:
space:
mode:
authorFelipe Martínez <felipe@pipe01.net>2024-12-09 01:10:09 +0100
committerGitHub <noreply@github.com>2024-12-09 00:10:09 +0000
commitb8c51abe691a2d0f6770f4bfef3574541f49d744 (patch)
tree0e501734fed33451789943e30aad9be23d8eb3c6 /src/libs
parent2105a7b63da8d4065ebfc62e0057f225358eedfc (diff)
Use all free RAM for FreeRTOS heap
* Use all free RAM for FreeRTOS heap * Wrap newlib malloc and related functions * Implement calloc
Diffstat (limited to 'src/libs')
-rw-r--r--src/libs/lfs_config.h49
1 files changed, 49 insertions, 0 deletions
diff --git a/src/libs/lfs_config.h b/src/libs/lfs_config.h
new file mode 100644
index 00000000..eaeede0e
--- /dev/null
+++ b/src/libs/lfs_config.h
@@ -0,0 +1,49 @@
+#pragma once
+
+#include <libraries/log/nrf_log.h>
+
+#ifndef LFS_TRACE
+#ifdef LFS_YES_TRACE
+#define LFS_TRACE_(fmt, ...) \
+ NRF_LOG_DEBUG("[LFS] %s:%d:trace: " fmt "%s\n", __FILE__, __LINE__, __VA_ARGS__)
+#define LFS_TRACE(...) LFS_TRACE_(__VA_ARGS__, "")
+#else
+#define LFS_TRACE(...)
+#endif
+#endif
+
+#ifndef LFS_DEBUG
+#ifndef LFS_NO_DEBUG
+#define LFS_DEBUG_(fmt, ...) \
+ NRF_LOG_DEBUG("[LFS] %s:%d:debug: " fmt "%s\n", __FILE__, __LINE__, __VA_ARGS__)
+#define LFS_DEBUG(...) LFS_DEBUG_(__VA_ARGS__, "")
+#else
+#define LFS_DEBUG(...)
+#endif
+#endif
+
+#ifndef LFS_WARN
+#ifndef LFS_NO_WARN
+#define LFS_WARN_(fmt, ...) \
+ NRF_LOG_WARNING("[LFS] %s:%d:warn: " fmt "%s\n", __FILE__, __LINE__, __VA_ARGS__)
+#define LFS_WARN(...) LFS_WARN_(__VA_ARGS__, "")
+#else
+#define LFS_WARN(...)
+#endif
+#endif
+
+#ifndef LFS_ERROR
+#ifndef LFS_NO_ERROR
+#define LFS_ERROR_(fmt, ...) \
+ NRF_LOG_ERROR("[LFS] %s:%d:error: " fmt "%s\n", __FILE__, __LINE__, __VA_ARGS__)
+#define LFS_ERROR(...) LFS_ERROR_(__VA_ARGS__, "")
+#else
+#define LFS_ERROR(...)
+#endif
+#endif
+
+// This is required in order for the CRC implementation in littlefs/lfs_util.c to be compiled
+#undef LFS_CONFIG
+
+#undef LFS_UTIL_H
+#include <littlefs/lfs_util.h>