2023-08-25 03:37 AM
I'm using CMSIS-RTOSv2 middleware which I configure through CubeMX. The files generated by CubeMX are somewhat different from the ones from official CMSIS-RTOSv2 github repository where latter has all implementations for memory pool functions and my project, whose code is generated through CubeMX, doesn't have them. Upon inspection of "cmsis_os2.h" header file I found that declarations for memory pool functions are provided but no implementations are given inside "cmsis_os2.c" file. I have CubeMX updated to latest version.
Any ideas why are memory pool functions in CMSIS-RTOSv2 literally cut out of implementation file?
2023-08-25 05:14 AM
Hi,
The DTCM is a high-speed memory that is directly connected to the processor and is not directly accessible by the DMA controller. The DTCM is intended for storing critical real-time data and code that requires low-latency access. The DMA controller, on the other hand, is designed to transfer data between peripherals and memory without CPU intervention, which is typically used for larger, less time-critical data transfers.
I hope this may help.
Regards
2023-08-25 06:22 AM
@ramprakash09 Any reason you brought up DTCM and DMA when the post didn't mention it? Just not following here.
2023-08-25 06:58 AM - edited 2023-08-25 06:59 AM
As stated by TDK there is no mention of DTCM and DMA in the post. I think he tagged F1 product.
Also, your statement is incorrect. In fact, it depends on the product. On F7 family only the CPU could access DTCM, meanwhile on H7 family MDMA could access TCM memories through AHBS bus:
2023-08-25 01:55 PM - edited 2023-08-26 04:12 AM
@lgacnik97 Where is the official CMSIS-RTOS2 repo? If you mean this one:
https://github.com/cmsis-packs/cmsis-5/tree/cmsis/CMSIS/RTOS2/Source
it is not official and there's no source for osMemoryPool stuff. You're free to bring your own.
Or is this the ARM implementation for FreeRTOS?
https://github.com/ARM-software/CMSIS-FreeRTOS/blob/main/CMSIS/RTOS2/FreeRTOS/Source/cmsis_os2.c
2024-09-04 12:14 PM - last edited on 2024-09-06 08:44 AM by SofLit
Beware that the CMSIS OS2 wrapper for FreeRTOS implementation (as of today in the repo mentioned in this discussion) of the buffer pools is buggy.
Below is how the new buffers are "created"; the mem_arr is uint8_t *. What is amazing that it may not HardFault immediately if the buffer size is 2 (depends on the patter of alloc/free calls) because the beginnings of the blocks are used for the free list which is build from the freed buffers.
static void *CreateBlock (MemPool_t *mp) {
MemPoolBlock_t *p = NULL;
if (mp->n < mp->bl_cnt) {
/* Unallocated blocks exist, set pointer to new block */
p = (void *)(mp->mem_arr + (mp->bl_sz * mp->n));
/* Increment block index */
mp->n += 1U;
}
return (p);
}
2024-09-06 08:41 AM
In general, the quality of the cmsis_os2 wrapper for FreeRTOS is poor.
For example: in order to statically allocate timer one has to look inside to find out the memory for the control block should be large enough to contain BOTH StaticTimer_t (defined in FreeRTOS.h, so globally visible) and TimerCallback_t which is ONLY locally declared INSIDE.
I also do not any effort to assure 4-byte alignment of the callback function, so I should not be surprised if it HardFaults.