Explorar o código

RTX5: Corrected memory allocation for stack and data when "Object specific Memory allocation" configuration is used

Robert Rostohar %!s(int64=8) %!d(string=hai) anos
pai
achega
30e0577306
Modificáronse 2 ficheiros con 7 adicións e 6 borrados
  1. 1 0
      CMSIS/DoxyGen/RTOS2/src/cmsis_os2.txt
  2. 6 6
      CMSIS/RTOS2/RTX/Source/rtx_lib.c

+ 1 - 0
CMSIS/DoxyGen/RTOS2/src/cmsis_os2.txt

@@ -157,6 +157,7 @@ File/Folder                  | Content
       <td>V5.2.3</td>
       <td>
        - Corrected SysTick and PendSV handlers for ARMv8-M Baseline.
+       - Corrected memory allocation for stack and data when "Object specific Memory allocation" configuration is used.
       </td>
     </tr>
     <tr>

+ 6 - 6
CMSIS/RTOS2/RTX/Source/rtx_lib.c

@@ -96,7 +96,7 @@ __attribute__((section(".data.os.thread.mpi"))) =
 
 // Memory Pool for Thread Stack
 #if (OS_THREAD_USER_STACK_SIZE != 0)
-static uint64_t os_thread_stack[OS_THREAD_USER_STACK_SIZE/8] \
+static uint64_t os_thread_stack[2 + OS_THREAD_NUM + (OS_THREAD_USER_STACK_SIZE/8)] \
 __attribute__((section(".bss.os.thread.stack")));
 #endif
 
@@ -291,7 +291,7 @@ __attribute__((section(".data.os.mempool.mpi"))) =
 #if ((OS_MEMPOOL_DATA_SIZE & 7) != 0)
 #error "Invalid Data Memory size for Memory Pools!"
 #endif
-static uint64_t os_mp_data[OS_MEMPOOL_DATA_SIZE/8] \
+static uint64_t os_mp_data[2 + OS_MEMPOOL_NUM + (OS_MEMPOOL_DATA_SIZE/8)] \
 __attribute__((section(".bss.os.mempool.mem")));
 #endif
 
@@ -321,7 +321,7 @@ __attribute__((section(".data.os.msgqueue.mpi"))) =
 #if ((OS_MSGQUEUE_DATA_SIZE & 7) != 0)
 #error "Invalid Data Memory size for Message Queues!"
 #endif
-static uint64_t os_mq_data[OS_MSGQUEUE_DATA_SIZE/8] \
+static uint64_t os_mq_data[2 + OS_MSGQUEUE_NUM + (OS_MSGQUEUE_DATA_SIZE/8)] \
 __attribute__((section(".bss.os.msgqueue.mem")));
 #endif
 
@@ -355,17 +355,17 @@ const osRtxConfig_t osRtxConfig = {
   { 
     // Memory Pools (Variable Block Size)
 #if ((OS_THREAD_OBJ_MEM != 0) && (OS_THREAD_USER_STACK_SIZE != 0))
-    &os_thread_stack, (uint32_t)OS_THREAD_USER_STACK_SIZE,
+    &os_thread_stack, sizeof(os_thread_stack),
 #else
     NULL, 0U,
 #endif
 #if ((OS_MEMPOOL_OBJ_MEM != 0) && (OS_MEMPOOL_DATA_SIZE != 0))
-    &os_mp_data, (uint32_t)OS_MEMPOOL_DATA_SIZE,
+    &os_mp_data, sizeof(os_mp_data),
 #else
     NULL, 0U,
 #endif
 #if ((OS_MSGQUEUE_OBJ_MEM != 0) && (OS_MSGQUEUE_DATA_SIZE != 0))
-    &os_mq_data, (uint32_t)OS_MSGQUEUE_DATA_SIZE,
+    &os_mq_data, sizeof(os_mq_data),
 #else
     NULL, 0U,
 #endif