From aa1b0ccb187acca38d02637db8f57f4aef62a202 Mon Sep 17 00:00:00 2001
From: a1012112796 <1012112796@qq.com>
Date: Wed, 31 Jul 2024 09:50:16 +0800
Subject: [PATCH] =?UTF-8?q?405=20DR:=20=E5=90=AF=E7=94=A8=20ulog=20&=20?=
=?UTF-8?q?=E7=B3=BB=E7=BB=9F=E7=BA=BF=E7=A8=8B=E8=B0=83=E6=95=B4?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: a1012112796 <1012112796@qq.com>
---
MDK_405_dr/.config | 33 +++++++++-
MDK_405_dr/project.uvprojx | 60 ++++++++++++-------
MDK_405_dr/rtconfig.h | 23 ++++++-
MDK_405_dr/template.uvprojx | 2 +-
.../dfs/filesystems/elmfat/dfs_elm.c | 2 +-
5 files changed, 92 insertions(+), 28 deletions(-)
diff --git a/MDK_405_dr/.config b/MDK_405_dr/.config
index 9dc91ce..15d3634 100644
--- a/MDK_405_dr/.config
+++ b/MDK_405_dr/.config
@@ -20,7 +20,7 @@ CONFIG_RT_USING_HOOK=y
CONFIG_RT_HOOK_USING_FUNC_PTR=y
CONFIG_RT_USING_IDLE_HOOK=y
CONFIG_RT_IDLE_HOOK_LIST_SIZE=4
-CONFIG_IDLE_THREAD_STACK_SIZE=256
+CONFIG_IDLE_THREAD_STACK_SIZE=1024
# CONFIG_RT_USING_TIMER_SOFT is not set
#
@@ -255,7 +255,36 @@ CONFIG_RT_USING_CPLUSPLUS=y
# Utilities
#
# CONFIG_RT_USING_RYM is not set
-# CONFIG_RT_USING_ULOG is not set
+CONFIG_RT_USING_ULOG=y
+# CONFIG_ULOG_OUTPUT_LVL_A is not set
+# CONFIG_ULOG_OUTPUT_LVL_E is not set
+# CONFIG_ULOG_OUTPUT_LVL_W is not set
+# CONFIG_ULOG_OUTPUT_LVL_I is not set
+CONFIG_ULOG_OUTPUT_LVL_D=y
+CONFIG_ULOG_OUTPUT_LVL=7
+CONFIG_ULOG_USING_ISR_LOG=y
+CONFIG_ULOG_ASSERT_ENABLE=y
+CONFIG_ULOG_LINE_BUF_SIZE=128
+CONFIG_ULOG_USING_ASYNC_OUTPUT=y
+CONFIG_ULOG_ASYNC_OUTPUT_BUF_SIZE=2048
+CONFIG_ULOG_ASYNC_OUTPUT_BY_THREAD=y
+CONFIG_ULOG_ASYNC_OUTPUT_THREAD_STACK=2048
+CONFIG_ULOG_ASYNC_OUTPUT_THREAD_PRIORITY=30
+
+#
+# log format
+#
+CONFIG_ULOG_OUTPUT_FLOAT=y
+CONFIG_ULOG_USING_COLOR=y
+CONFIG_ULOG_OUTPUT_TIME=y
+CONFIG_ULOG_TIME_USING_TIMESTAMP=y
+CONFIG_ULOG_OUTPUT_LEVEL=y
+CONFIG_ULOG_OUTPUT_TAG=y
+# CONFIG_ULOG_OUTPUT_THREAD_NAME is not set
+CONFIG_ULOG_BACKEND_USING_CONSOLE=y
+# CONFIG_ULOG_BACKEND_USING_FILE is not set
+# CONFIG_ULOG_USING_FILTER is not set
+# CONFIG_ULOG_USING_SYSLOG is not set
# CONFIG_RT_USING_UTEST is not set
# CONFIG_RT_USING_VAR_EXPORT is not set
# CONFIG_RT_USING_RT_LINK is not set
diff --git a/MDK_405_dr/project.uvprojx b/MDK_405_dr/project.uvprojx
index 2564873..c01136c 100644
--- a/MDK_405_dr/project.uvprojx
+++ b/MDK_405_dr/project.uvprojx
@@ -10,7 +10,6 @@
rt-thread
0x4
ARM-ADS
- 5060960::V5.06 update 7 (build 960)::.\ARMCC
0
@@ -339,7 +338,7 @@
__STDC_LIMIT_MACROS, USE_HAL_DRIVER, RT_USING_LIBC, __CLK_TCK=RT_TICK_PER_SECOND, __RTTHREAD__, STM32F405xx, RT_USING_ARM_LIBC
- ..\rt-thread\components\drivers\usb\usbdevice;..\rt-thread\components\libc\compilers\common\extension;..\rt-thread\components\libc\posix\io\poll;..\rt-thread\components\drivers\include;..\libraries\HAL_Drivers\CMSIS\Include;..\rt-thread\components\libc\posix\io\stdio;..\rt-thread\components\drivers\include;..\rt-thread\include;..\rt-thread\components\drivers\spi;..\libraries\HAL_Drivers\config;board;..\rt-thread\components\dfs\include;..\rt-thread\components\drivers\include;..\libraries\STM32F4xx_HAL\CMSIS\Device\ST\STM32F4xx\Include;..\rt-thread\components\drivers\include;..\libraries\HAL_Drivers\drv_flash;board\CubeMX_Config\Inc;..\rt-thread\components\finsh;..\rt-thread\components\dfs\filesystems\elmfat;..\rt-thread\components\libc\cplusplus;..\rt-thread\libcpu\arm\cortex-m4;..\rt-thread\components\drivers\include;..\libraries\STM32F4xx_HAL\STM32F4xx_HAL_Driver\Inc;..\rt-thread\components\libc\posix\ipc;..\rt-thread\components\libc\compilers\common\include;..\rt-thread\components\drivers\include;.;..\rt-thread\components\libc\compilers\common\extension\fcntl\octal;..\rt-thread\components\fal\inc;..\rt-thread\libcpu\arm\common;..\libraries\HAL_Drivers
+ ..\rt-thread\components\drivers\usb\usbdevice;..\rt-thread\components\libc\compilers\common\extension;..\rt-thread\components\libc\posix\io\poll;..\rt-thread\components\utilities\ulog;..\rt-thread\components\drivers\include;..\libraries\HAL_Drivers\CMSIS\Include;..\rt-thread\components\libc\posix\io\stdio;..\rt-thread\components\drivers\include;..\rt-thread\include;..\rt-thread\components\drivers\spi;..\libraries\HAL_Drivers\config;board;..\rt-thread\components\dfs\include;..\rt-thread\components\drivers\include;..\libraries\STM32F4xx_HAL\CMSIS\Device\ST\STM32F4xx\Include;..\rt-thread\components\drivers\include;..\libraries\HAL_Drivers\drv_flash;board\CubeMX_Config\Inc;..\rt-thread\components\finsh;..\rt-thread\components\dfs\filesystems\elmfat;..\rt-thread\components\libc\cplusplus;..\rt-thread\libcpu\arm\cortex-m4;..\rt-thread\components\drivers\include;..\libraries\STM32F4xx_HAL\STM32F4xx_HAL_Driver\Inc;..\rt-thread\components\libc\posix\ipc;..\rt-thread\components\libc\compilers\common\include;..\rt-thread\components\drivers\include;.;..\rt-thread\components\libc\compilers\common\extension\fcntl\octal;..\rt-thread\components\fal\inc;..\rt-thread\libcpu\arm\common;..\libraries\HAL_Drivers
@@ -429,29 +428,29 @@
CPlusPlus
- cxx_Mutex.cpp
- 8
- ..\rt-thread\components\libc\cplusplus\cxx_Mutex.cpp
-
-
- cxx_Thread.cpp
- 8
- ..\rt-thread\components\libc\cplusplus\cxx_Thread.cpp
+ cxx_crt_init.c
+ 1
+ ..\rt-thread\components\libc\cplusplus\cxx_crt_init.c
cxx_crt.cpp
8
..\rt-thread\components\libc\cplusplus\cxx_crt.cpp
+
+ cxx_Thread.cpp
+ 8
+ ..\rt-thread\components\libc\cplusplus\cxx_Thread.cpp
+
cxx_Semaphore.cpp
8
..\rt-thread\components\libc\cplusplus\cxx_Semaphore.cpp
- cxx_crt_init.c
- 1
- ..\rt-thread\components\libc\cplusplus\cxx_crt_init.c
+ cxx_Mutex.cpp
+ 8
+ ..\rt-thread\components\libc\cplusplus\cxx_Mutex.cpp
@@ -638,16 +637,6 @@
Fal
-
- fal_flash.c
- 1
- ..\rt-thread\components\fal\src\fal_flash.c
-
-
- fal_rtt.c
- 1
- ..\rt-thread\components\fal\src\fal_rtt.c
-
fal.c
1
@@ -658,6 +647,16 @@
1
..\rt-thread\components\fal\src\fal_partition.c
+
+ fal_flash.c
+ 1
+ ..\rt-thread\components\fal\src\fal_flash.c
+
+
+ fal_rtt.c
+ 1
+ ..\rt-thread\components\fal\src\fal_rtt.c
+
@@ -990,6 +989,21 @@
+
+ Utilities
+
+
+ ulog.c
+ 1
+ ..\rt-thread\components\utilities\ulog\ulog.c
+
+
+ console_be.c
+ 1
+ ..\rt-thread\components\utilities\ulog\backend\console_be.c
+
+
+
diff --git a/MDK_405_dr/rtconfig.h b/MDK_405_dr/rtconfig.h
index a0d5a99..b7ab5da 100644
--- a/MDK_405_dr/rtconfig.h
+++ b/MDK_405_dr/rtconfig.h
@@ -16,7 +16,7 @@
#define RT_HOOK_USING_FUNC_PTR
#define RT_USING_IDLE_HOOK
#define RT_IDLE_HOOK_LIST_SIZE 4
-#define IDLE_THREAD_STACK_SIZE 256
+#define IDLE_THREAD_STACK_SIZE 1024
/* kservice optimization */
@@ -142,6 +142,27 @@
/* Utilities */
+#define RT_USING_ULOG
+#define ULOG_OUTPUT_LVL_D
+#define ULOG_OUTPUT_LVL 7
+#define ULOG_USING_ISR_LOG
+#define ULOG_ASSERT_ENABLE
+#define ULOG_LINE_BUF_SIZE 128
+#define ULOG_USING_ASYNC_OUTPUT
+#define ULOG_ASYNC_OUTPUT_BUF_SIZE 2048
+#define ULOG_ASYNC_OUTPUT_BY_THREAD
+#define ULOG_ASYNC_OUTPUT_THREAD_STACK 2048
+#define ULOG_ASYNC_OUTPUT_THREAD_PRIORITY 30
+
+/* log format */
+
+#define ULOG_OUTPUT_FLOAT
+#define ULOG_USING_COLOR
+#define ULOG_OUTPUT_TIME
+#define ULOG_TIME_USING_TIMESTAMP
+#define ULOG_OUTPUT_LEVEL
+#define ULOG_OUTPUT_TAG
+#define ULOG_BACKEND_USING_CONSOLE
/* RT-Thread online packages */
diff --git a/MDK_405_dr/template.uvprojx b/MDK_405_dr/template.uvprojx
index b1395e0..e49b99b 100644
--- a/MDK_405_dr/template.uvprojx
+++ b/MDK_405_dr/template.uvprojx
@@ -182,7 +182,7 @@
1
0
0
- 1
+ 2
0
0
1
diff --git a/rt-thread/components/dfs/filesystems/elmfat/dfs_elm.c b/rt-thread/components/dfs/filesystems/elmfat/dfs_elm.c
index 048690f..d6838fa 100644
--- a/rt-thread/components/dfs/filesystems/elmfat/dfs_elm.c
+++ b/rt-thread/components/dfs/filesystems/elmfat/dfs_elm.c
@@ -948,7 +948,7 @@ DWORD get_fattime(void)
struct tm tm_now;
now = time(RT_NULL);
- gmtime_r(&now, &tm_now);
+ localtime_r(&now, &tm_now);
fat_time = (DWORD)(tm_now.tm_year - 80) << 25 |
(DWORD)(tm_now.tm_mon + 1) << 21 |