-
Notifications
You must be signed in to change notification settings - Fork 3k
Statically allocate ARMCC required mutex objects #5687
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@TaniaMirzin Can you test if this resolves the issue you reported? |
@0xc0170 |
@TaniaMirzin Not sure which fix you are referencing, as this one is changing what is currently on master. Adding The fix looks good (we should provide cb_mem and its size). If you look at CMSIS_5, they provided a new macro to disable multithreaded clib impl that is currently in there only for ARMCC. Reference: https://github.com/ARM-software/CMSIS_5/blob/bb78a8aa71384f2c7d909570d88d3cce3467ffe1/CMSIS/RTOS2/RTX/Source/rtx_lib.c#L566. If we define the macro to disable their strong definitions, we are still missing some functions ( for instance All this because ARMCC does not guarantee how many locks C lib needs? (as IAR does via |
@TaniaMirzin - Hi Tania, this is the same fix you already verified. @0xc0170 - Martin, Tania verified this fix already. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@SenRamakri Please note my comment above, about missing userthread lib space, we should track that separately.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great 👍
The issue is that ARMCC is using this same API to create a mutex per FILE, and the user can create an unlimited number of FILEs. I'm not exactly sure how the other toolchains handle this (@c1728p9?). It looks like they might have separate ties for malloc mutexes vs other stdlib mutexes. |
IAR does that is correct. IAR locks they provide two defines I can create an issue for this, as this fix here is correct, just that during looking at the code why in the first place we have this misalignment with CMSIS, and how we can get our fixes there. |
/morph build |
/morph build |
Build : SUCCESSBuild number : 707 Triggering tests/morph test |
Exporter Build : FAILUREBuild number : 357 |
/morph export-build |
Test : SUCCESSBuild number : 540 |
Exporter Build : SUCCESSBuild number : 361 |
Well, the ARMCC doesn't provide any macros like that, but we could simplify the whole thing by setting it on Mbed OS level. |
This is fix for - #5664
Previously we used OS_MUTEX_NUM define to pre-allocate Mutex objects for ARMCC libs. But that doesn't guarantee that they will be avaliable for ARMCC usage always as any other client can grab them before ARMCC lib requires that to be used/initialized. This change is to statically allocate memory for Mutex objects for ARMCC to ensure ARMCC have them when it needs.