From 97fca5e4edb1957addbbe0eab56731b7f657f5f2 Mon Sep 17 00:00:00 2001
From: mculover666 <2412828003@qq.com>
Date: Thu, 1 Apr 2021 15:43:22 +0800
Subject: [PATCH] fix the bug in the storage space of the task name
---
.../KEIL/hello_world/TencentOS_tiny.uvoptx | 36 +++++++++----------
.../KEIL/hello_world/TencentOS_tiny.uvprojx | 2 +-
kernel/core/include/tos_task.h | 3 +-
kernel/core/tos_task.c | 2 +-
4 files changed, 22 insertions(+), 21 deletions(-)
diff --git a/board/TencentOS_tiny_EVB_MX_Plus/KEIL/hello_world/TencentOS_tiny.uvoptx b/board/TencentOS_tiny_EVB_MX_Plus/KEIL/hello_world/TencentOS_tiny.uvoptx
index 9e348f36..17eb8874 100644
--- a/board/TencentOS_tiny_EVB_MX_Plus/KEIL/hello_world/TencentOS_tiny.uvoptx
+++ b/board/TencentOS_tiny_EVB_MX_Plus/KEIL/hello_world/TencentOS_tiny.uvoptx
@@ -152,22 +152,6 @@
0
0
- 28
- 1
- 134231898
- 0
- 0
- 0
- 0
- 0
- 1
- ..\..\..\..\examples\hello_world\hello_world.c
-
- \\TencentOS_tiny\../../../../examples/hello_world/hello_world.c\28
-
-
- 1
- 0
245
1
134229606
@@ -182,7 +166,7 @@
\\TencentOS_tiny\../../../../arch/arm/arm-v7m/common/tos_cpu.c\245
- 2
+ 1
0
251
1
@@ -197,6 +181,22 @@
\\TencentOS_tiny\../../../../arch/arm/arm-v7m/common/tos_cpu.c\251
+
+ 2
+ 0
+ 28
+ 1
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ ..\..\..\..\examples\hello_world\hello_world.c
+
+
+
@@ -835,7 +835,7 @@
kernel
- 1
+ 0
0
0
0
diff --git a/board/TencentOS_tiny_EVB_MX_Plus/KEIL/hello_world/TencentOS_tiny.uvprojx b/board/TencentOS_tiny_EVB_MX_Plus/KEIL/hello_world/TencentOS_tiny.uvprojx
index 3de07e32..a85fd809 100644
--- a/board/TencentOS_tiny_EVB_MX_Plus/KEIL/hello_world/TencentOS_tiny.uvprojx
+++ b/board/TencentOS_tiny_EVB_MX_Plus/KEIL/hello_world/TencentOS_tiny.uvprojx
@@ -16,7 +16,7 @@
STM32L431RCTx
STMicroelectronics
- Keil.STM32L4xx_DFP.2.4.0
+ Keil.STM32L4xx_DFP.2.3.0
https://www.keil.com/pack/
IRAM(0x20000000-0x2000FFFF) IROM(0x8000000-0x803FFFF) CLOCK(8000000) FPU2 CPUTYPE("Cortex-M4")
diff --git a/kernel/core/include/tos_task.h b/kernel/core/include/tos_task.h
index f2a66e50..db7b48e0 100644
--- a/kernel/core/include/tos_task.h
+++ b/kernel/core/include/tos_task.h
@@ -20,7 +20,8 @@
__CDECLS_BEGIN
-#define K_TASK_NAME_MAX (16u)
+#define K_TASK_NAME_LEN_MAX (15u)
+#define K_TASK_NAME_MAX (K_TASK_NAME_LEN_MAX + 1)
#define K_TASK_STK_SIZE_MIN (sizeof(cpu_context_t))
// task state is just a flag, indicating which manager list we are in.
diff --git a/kernel/core/tos_task.c b/kernel/core/tos_task.c
index b91f8360..496de2c2 100644
--- a/kernel/core/tos_task.c
+++ b/kernel/core/tos_task.c
@@ -125,7 +125,7 @@ __API__ k_err_t tos_task_create(k_task_t *task,
task->prio = prio;
task->stk_base = stk_base;
task->stk_size = stk_size;
- strncpy(task->name, name, K_TASK_NAME_MAX);
+ strncpy(task->name, name, K_TASK_NAME_LEN_MAX);
#if TOS_CFG_ROUND_ROBIN_EN > 0u
task->timeslice_reload = timeslice;