nxp-mcuxpresso / mcux-sdk

MCUXpresso SDK
BSD 3-Clause "New" or "Revised" License
301 stars 136 forks source link

[BUG] Missing CMSIS RTOS abstraction for i.MX RT #199

Open stefanct opened 5 days ago

stefanct commented 5 days ago

Describe the bug

We would like to port a library to our project that relies on the functions declared in cmsis_os2.h. I can see this file is included in the SDK and referenced by the manifests of the RT series including the rt1020 that we are using. However, neither within Eclipse nor within a CMake-based project it seems to be available (i.e., the include directory is not added to the compiler command). From the CMake code it looks like maybe it was a user-visible/selectable component (set(CONFIG_USE_CMSIS_Device_API_RTOS2 true) is contained in the RTs' all_lib_device.cmake). There doesn't seem to be any example in the examples repository that uses it but I see no explicit indication whatsoever that it shouldn't be available. I presume it is a bug. Do I missing something?

To Reproduce

Expected behavior A working build :)

Additional context I haven't checked at all if the actual library is available for linking yet.

mcuxsusan commented 18 hours ago

Hi @stefanct, currently the CMSIS RTOS2 is not used by any of the SDK examples. For your case, I see you would like to include the cmsis_os2.h but it's not included as expected, am I right? I did a try to set(CONFIG_USE_CMSIS_Device_API_RTOS2 true) in the hello_world config.cmake for the rt1020 evk board and it seems OK.


diff --git a/evkmimxrt1020/demo_apps/hello_world/armgcc/config.cmake b/evkmimxrt1020/demo_apps/hello_world/armgcc/config.cmake
index c9c7004db5..b35e3eb9bf 100644
--- a/evkmimxrt1020/demo_apps/hello_world/armgcc/config.cmake
+++ b/evkmimxrt1020/demo_apps/hello_world/armgcc/config.cmake
@@ -28,3 +28,4 @@ set(CONFIG_KIT evkmimxrt1020)
 set(CONFIG_DEVICE_ID MIMXRT1021xxxxx)
 set(CONFIG_FPU DP_FPU)
 set(CONFIG_DSP NO_DSP)
+set(CONFIG_USE_CMSIS_Device_API_RTOS2 true)
diff --git a/evkmimxrt1020/demo_apps/hello_world/hello_world.c b/evkmimxrt1020/demo_apps/hello_world/hello_world.c
index 2daf4795ab..7814a731fd 100644
--- a/evkmimxrt1020/demo_apps/hello_world/hello_world.c
+++ b/evkmimxrt1020/demo_apps/hello_world/hello_world.c
@@ -11,6 +11,7 @@
 #include "pin_mux.h"
 #include "clock_config.h"
 #include "board.h"
+#include "cmsis_os2.h"