Compiling the cmake_example in FreeRTOS-Kernel (MINGW64)?

I’m using MINGW64 bash shell; note that in the path, I have several gcc executables:

$ which gcc
/mingw64/bin/gcc

$ cygpath -m $(which gcc)
C:/msys64/mingw64/bin/gcc.exe

$ ls -1 C:/msys64/mingw64/bin/*gcc.exe
C:/msys64/mingw64/bin/arm-none-eabi-gcc.exe*
C:/msys64/mingw64/bin/gcc.exe*
C:/msys64/mingw64/bin/x86_64-w64-mingw32-gcc.exe*

$ gcc --version
gcc.exe (Rev2, Built by MSYS2 project) 14.2.0

$ arm-none-eabi-gcc --version
arm-none-eabi-gcc.exe (GCC) 13.3.0

So, I’ve got FreeRTOS-Kernel here:

$ (cd C:/src/FreeRTOS-Kernel/; git status -uno)
HEAD detached at V11.1.0
nothing to commit (use -u to show untracked files)

and can see there is an example at $FREERTOS_KERNEL_PATH/examples/cmake_example; so I wanted to try and build it, like this:

$ cd C:/src/FreeRTOS-Kernel/examples/cmake_example
$ mkdir build && cd build

$ C:/Program\ Files/CMake/bin/cmake.exe  .. -DCMAKE_BUILD_TYPE=Debug -G "MSYS Makefiles"
-- The C compiler identification is GNU 14.2.0
-- The CXX compiler identification is GNU 14.2.0
-- Check for working C compiler: C:/msys64/mingw64/bin/gcc.exe
-- Check for working C compiler: C:/msys64/mingw64/bin/gcc.exe - works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: C:/msys64/mingw64/bin/g++.exe
-- Check for working CXX compiler: C:/msys64/mingw64/bin/g++.exe - works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Configuring done
-- Generating done
-- Build files have been written to: C:/src/FreeRTOS-Kernel/examples/cmake_example/build

$ make
Scanning dependencies of target freertos_kernel_port
[  8%] Building C object FreeRTOS-Kernel/portable/CMakeFiles/freertos_kernel_port.dir/template/port.c.obj
[  8%] Built target freertos_kernel_port
Scanning dependencies of target freertos_kernel
[ 16%] Building C object FreeRTOS-Kernel/CMakeFiles/freertos_kernel.dir/croutine.c.obj
[ 25%] Building C object FreeRTOS-Kernel/CMakeFiles/freertos_kernel.dir/event_groups.c.obj
C:/src/FreeRTOS-Kernel/event_groups.c: In function 'xEventGroupSync':
C:/src/FreeRTOS-Kernel/event_groups.c:197:9: error: integer constant is too large for 'unsigned long' type [-Werror=long-long]
  197 |         configASSERT( ( uxBitsToWaitFor & eventEVENT_BITS_CONTROL_BYTES ) == 0 );
      |         ^~~~~~~~~~~~
C:/src/FreeRTOS-Kernel/event_groups.c:231:21: error: integer constant is too large for 'unsigned long' type [-Werror=long-long]
  231 |                     vTaskPlaceOnUnorderedEventList( &( pxEventBits->xTasksWaitingForBits ), ( uxBitsToWaitFor | eventCLEAR_EVENTS_ON_EXIT_BIT | eventWAIT_FOR_ALL_BITS ), xTicksToWait );
      |                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
C:/src/FreeRTOS-Kernel/event_groups.c:231:21: error: integer constant is too large for 'unsigned long' type [-Werror=long-long]
C:/src/FreeRTOS-Kernel/event_groups.c:267:13: error: integer constant is too large for 'unsigned long' type [-Werror=long-long]
  267 |             if( ( uxReturn & eventUNBLOCKED_DUE_TO_BIT_SET ) == ( EventBits_t ) 0 )
      |             ^~
C:/src/FreeRTOS-Kernel/event_groups.c:298:13: error: integer constant is too large for 'unsigned long' type [-Werror=long-long]
  298 |             uxReturn &= ~eventEVENT_BITS_CONTROL_BYTES;
      |             ^~~~~~~~
C:/src/FreeRTOS-Kernel/event_groups.c: In function 'xEventGroupWaitBits':
C:/src/FreeRTOS-Kernel/event_groups.c:328:9: error: integer constant is too large for 'unsigned long' type [-Werror=long-long]
  328 |         configASSERT( ( uxBitsToWaitFor & eventEVENT_BITS_CONTROL_BYTES ) == 0 );
      |         ^~~~~~~~~~~~
C:/src/FreeRTOS-Kernel/event_groups.c:375:21: error: integer constant is too large for 'unsigned long' type [-Werror=long-long]
  375 |                     uxControlBits |= eventCLEAR_EVENTS_ON_EXIT_BIT;
      |                     ^~~~~~~~~~~~~
C:/src/FreeRTOS-Kernel/event_groups.c:384:21: error: integer constant is too large for 'unsigned long' type [-Werror=long-long]
  384 |                     uxControlBits |= eventWAIT_FOR_ALL_BITS;
      |                     ^~~~~~~~~~~~~
C:/src/FreeRTOS-Kernel/event_groups.c:423:13: error: integer constant is too large for 'unsigned long' type [-Werror=long-long]
  423 |             if( ( uxReturn & eventUNBLOCKED_DUE_TO_BIT_SET ) == ( EventBits_t ) 0 )
      |             ^~
C:/src/FreeRTOS-Kernel/event_groups.c:458:13: error: integer constant is too large for 'unsigned long' type [-Werror=long-long]
  458 |             uxReturn &= ~eventEVENT_BITS_CONTROL_BYTES;
      |             ^~~~~~~~
C:/src/FreeRTOS-Kernel/event_groups.c: In function 'xEventGroupClearBits':
C:/src/FreeRTOS-Kernel/event_groups.c:483:9: error: integer constant is too large for 'unsigned long' type [-Werror=long-long]
  483 |         configASSERT( ( uxBitsToClear & eventEVENT_BITS_CONTROL_BYTES ) == 0 );
      |         ^~~~~~~~~~~~
C:/src/FreeRTOS-Kernel/event_groups.c: In function 'xEventGroupSetBits':
C:/src/FreeRTOS-Kernel/event_groups.c:563:9: error: integer constant is too large for 'unsigned long' type [-Werror=long-long]
  563 |         configASSERT( ( uxBitsToSet & eventEVENT_BITS_CONTROL_BYTES ) == 0 );
      |         ^~~~~~~~~~~~
C:/src/FreeRTOS-Kernel/event_groups.c:584:17: error: integer constant is too large for 'unsigned long' type [-Werror=long-long]
  584 |                 uxControlBits = uxBitsWaitedFor & eventEVENT_BITS_CONTROL_BYTES;
      |                 ^~~~~~~~~~~~~
C:/src/FreeRTOS-Kernel/event_groups.c:585:17: error: integer constant is too large for 'unsigned long' type [-Werror=long-long]
  585 |                 uxBitsWaitedFor &= ~eventEVENT_BITS_CONTROL_BYTES;
      |                 ^~~~~~~~~~~~~~~
C:/src/FreeRTOS-Kernel/event_groups.c:587:17: error: integer constant is too large for 'unsigned long' type [-Werror=long-long]
  587 |                 if( ( uxControlBits & eventWAIT_FOR_ALL_BITS ) == ( EventBits_t ) 0 )
      |                 ^~
C:/src/FreeRTOS-Kernel/event_groups.c:612:21: error: integer constant is too large for 'unsigned long' type [-Werror=long-long]
  612 |                     if( ( uxControlBits & eventCLEAR_EVENTS_ON_EXIT_BIT ) != ( EventBits_t ) 0 )
      |                     ^~
C:/src/FreeRTOS-Kernel/event_groups.c:626:21: error: integer constant is too large for 'unsigned long' type [-Werror=long-long]
  626 |                     vTaskRemoveFromUnorderedEventList( pxListItem, pxEventBits->uxEventBits | eventUNBLOCKED_DUE_TO_BIT_SET );
      |                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
C:/src/FreeRTOS-Kernel/event_groups.c: In function 'vEventGroupDelete':
C:/src/FreeRTOS-Kernel/event_groups.c:667:17: error: integer constant is too large for 'unsigned long' type [-Werror=long-long]
  667 |                 vTaskRemoveFromUnorderedEventList( pxTasksWaitingForBits->xListEnd.pxNext, eventUNBLOCKED_DUE_TO_BIT_SET );
      |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1.exe: all warnings being treated as errors
make[2]: *** [FreeRTOS-Kernel/CMakeFiles/freertos_kernel.dir/build.make:98: FreeRTOS-Kernel/CMakeFiles/freertos_kernel.dir/event_groups.c.obj] Error 1
make[1]: *** [CMakeFiles/Makefile2:185: FreeRTOS-Kernel/CMakeFiles/freertos_kernel.dir/all] Error 2
make: *** [Makefile:104: all] Error 2

So, in this case, CMake picked up the “plain”/“Windows” GCC compiler, the CMake setup/configuration passed, however make fails compilation, mostly with a “integer constant is too large for ‘unsigned long’ type” error.

I thought this was caused by using the “Windows” GCC compiler; so I managed to “coax” CMake to instead use the ARM GCC compiles by adding this to cmake_example/CMakeLists.txt:

cmake_minimum_required(VERSION 3.15)

find_program(CMAKE_C_COMPILER "arm-none-eabi-gcc.exe") # added
message("CMAKE_C_COMPILER ${CMAKE_C_COMPILER}")        # added
set(CMAKE_CXX_COMPILER "arm-none-eabi-g++.exe")        # added

project(example)
#...

Then, if I repeat the process in build subdirectory, I get this:

$ rm -rf *

$ /c/Program\ Files/CMake/bin/cmake.exe  .. -DCMAKE_BUILD_TYPE=Debug -G "MSYS Makefiles"
CMAKE_C_COMPILER C:/msys64/mingw64/bin/arm-none-eabi-gcc.exe
-- The C compiler identification is GNU 13.3.0
-- The CXX compiler identification is GNU 13.3.0
-- Check for working C compiler: C:/msys64/mingw64/bin/arm-none-eabi-gcc.exe
-- Check for working C compiler: C:/msys64/mingw64/bin/arm-none-eabi-gcc.exe - broken
CMake Error at C:/Program Files/CMake/share/cmake-3.17/Modules/CMakeTestCCompiler.cmake:60 (message):
  The C compiler

    "C:/msys64/mingw64/bin/arm-none-eabi-gcc.exe"

  is not able to compile a simple test program.

  It fails with the following output:

    Change Dir: C:/src/FreeRTOS-Kernel/examples/cmake_example/build/CMakeFiles/CMakeTmp

    Run Build Command(s):C:/msys64/usr/bin/make.exe cmTC_8e671/fast && /usr/bin/make  -f CMakeFiles/cmTC_8e671.dir/build.make CMakeFiles/cmTC_8e671.dir/build
    make[1]: Entering directory '/c/src/FreeRTOS-Kernel/examples/cmake_example/build/CMakeFiles/CMakeTmp'
    Building C object CMakeFiles/cmTC_8e671.dir/testCCompiler.c.obj
    /C/msys64/mingw64/bin/arm-none-eabi-gcc.exe    -o CMakeFiles/cmTC_8e671.dir/testCCompiler.c.obj   -c /C/src/FreeRTOS-Kernel/examples/cmake_example/build/CMakeFiles/CMakeTmp/testCCompiler.c
    Linking C executable cmTC_8e671.exe
    "/C/Program Files/CMake/bin/cmake.exe" -E rm -f CMakeFiles/cmTC_8e671.dir/objects.a
    /C/msys64/mingw64/bin/ar.exe cr CMakeFiles/cmTC_8e671.dir/objects.a @CMakeFiles/cmTC_8e671.dir/objects1.rsp
    /C/msys64/mingw64/bin/arm-none-eabi-gcc.exe      -Wl,--whole-archive CMakeFiles/cmTC_8e671.dir/objects.a -Wl,--no-whole-archive  -o cmTC_8e671.exe -Wl,--out-implib,libcmTC_8e671.dll.a -Wl,--major-image-version,0,--minor-image-version,0
    C:/msys64/mingw64/bin/../lib/gcc/arm-none-eabi/13.3.0/../../../../arm-none-eabi/bin/ld.exe: unrecognized option '--major-image-version'
    C:/msys64/mingw64/bin/../lib/gcc/arm-none-eabi/13.3.0/../../../../arm-none-eabi/bin/ld.exe: use the --help option for usage information
    collect2.exe: error: ld returned 1 exit status
    make[1]: *** [CMakeFiles/cmTC_8e671.dir/build.make:109: cmTC_8e671.exe] Error 1
    make[1]: Leaving directory '/c/src/FreeRTOS-Kernel/examples/cmake_example/build/CMakeFiles/CMakeTmp'
    make: *** [Makefile:141: cmTC_8e671/fast] Error 2





  CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
  CMakeLists.txt:7 (project)


-- Configuring incomplete, errors occurred!
See also "C:/src/FreeRTOS-Kernel/examples/cmake_example/build/CMakeFiles/CMakeOutput.log".
See also "C:/src/FreeRTOS-Kernel/examples/cmake_example/build/CMakeFiles/CMakeError.log".

So, now not even CMake setup/configuration passes, and it is actually linking of “simple test program” that fails with “unrecognized option ‘–major-image-version’”.

So, how am I supposed to build thiscmake_example?

Right, figured out how to compile this for the MINGW64 gcc; after some grepping, it turns out there is this stanza in FreeRTOS-Kernel/CMakeLists.txt:

# ...

    # Native FREERTOS_PORT for Linux and Windows MINGW builds
    if(UNIX)
        message(STATUS " Auto-Detected Unix, setting FREERTOS_PORT=GCC_POSIX")
        set(FREERTOS_PORT GCC_POSIX CACHE STRING "FreeRTOS port name")
    elseif(MINGW)
        message(STATUS " Auto-Detected MINGW, setting FREERTOS_PORT=MSVC_MINGW")
        set(FREERTOS_PORT MSVC_MINGW CACHE STRING "FreeRTOS port name")
    endif()

# ...

Right, and since there is a set(FREERTOS_PORT ... stanza already in cmake_example/CMakeLists.txt, we simply need to change it to value of MSVC_MINGW; but that alone will cause:

C:/src/FreeRTOS-Kernel/portable/MSVC-MingW/portmacro.h:60:27: error: ISO C90 does not support 'long long' [-Werror=long-long]
   60 |     typedef unsigned long long   UBaseType_t;
      |                           ^~~~
cc1.exe: all warnings being treated as errors

So, finally, we have to comment the set_property(TARGET freertos_kernel PROPERTY C_STANDARD 90) line at the end of cmake_example/CMakeLists.txt - and the project finally compiles and links for Windows. Here is the diff for cmake_example/CMakeLists.txt:

diff --git a/examples/cmake_example/CMakeLists.txt b/examples/cmake_example/CMakeLists.txt
index 7b31cc52a..1debd7ed2 100644
--- a/examples/cmake_example/CMakeLists.txt
+++ b/examples/cmake_example/CMakeLists.txt
@@ -21,7 +21,8 @@ endif()
 set(FREERTOS_HEAP "4" CACHE STRING "" FORCE)

 # Select the native compile PORT
-set(FREERTOS_PORT "TEMPLATE" CACHE STRING "" FORCE)
+#set(FREERTOS_PORT "TEMPLATE" CACHE STRING "" FORCE)
+set(FREERTOS_PORT "MSVC_MINGW" CACHE STRING "" FORCE)

 # Adding the FreeRTOS-Kernel subdirectory
 add_subdirectory(${FREERTOS_KERNEL_PATH} FreeRTOS-Kernel)
@@ -71,4 +72,4 @@ add_executable(${PROJECT_NAME}

 target_link_libraries(${PROJECT_NAME} freertos_kernel freertos_config)

-set_property(TARGET freertos_kernel PROPERTY C_STANDARD 90)
\ No newline at end of file
+#set_property(TARGET freertos_kernel PROPERTY C_STANDARD 90)

Right, also managed to compile this cmake_example for GCC_ARM_CM0 port (see FreeRTOS-Kernel/CMakeLists.txt for a basic list), however cannot get it to link.

Errors I’ve seen here:

  is not able to compile a simple test program.
...
    /C/msys64/mingw64/bin/arm-none-eabi-gcc.exe      -Wl,--whole-archive CMakeFiles/cmTC_b00b2.dir/objects.a -Wl,--no-whole-archive  -o cmTC_b00b2.exe -Wl,--out-implib,libcmTC_b00b2.dll.a -Wl,--major-image-version,0,--minor-image-version,0
    C:/msys64/mingw64/bin/../lib/gcc/arm-none-eabi/13.3.0/../../../../arm-none-eabi/bin/ld.exe: unrecognized option '--major-image-version'
    C:/msys64/mingw64/bin/../lib/gcc/arm-none-eabi/13.3.0/../../../../arm-none-eabi/bin/ld.exe: use the --help option for usage information
    collect2.exe: error: ld returned 1 exit status

This is apparently a sign of a missing toolchain, see links in the diff below for references.

C:/src/FreeRTOS-Kernel/portable/GCC/ARM_CM0/portmacro.h:80:6: error: #error configTICK_TYPE_WIDTH_IN_BITS set to unsupported tick type width.
   80 |     #error configTICK_TYPE_WIDTH_IN_BITS set to unsupported tick type width.
      |      ^~~~~
C:/src/FreeRTOS-Kernel/portable/GCC/ARM_CM0/portmacro.h:318:45: error: unknown type name 'TickType_t'; did you mean 'StackType_t'?
  318 |     extern void vPortSuppressTicksAndSleep( TickType_t xExpectedIdleTime );
      |                                             ^~~~~~~~~~
      |                                             StackType_t

Solved by setting configTICK_TYPE_WIDTH_IN_BITS to something other than TICK_TYPE_WIDTH_64_BITS

C:/src/FreeRTOS-Kernel/examples/template_configuration/FreeRTOSConfig.h:135:1: error: C++ style comments are not allowed in ISO C90 [-Werror]
  135 | //#define configTICK_TYPE_WIDTH_IN_BITS              TICK_TYPE_WIDTH_64_BITS

Solved by using /**/ comments instead of //

C:/src/FreeRTOS-Kernel/event_groups.c:298:25: error: unsigned conversion from 'int' to 'EventBits_t' {aka 'short unsigned int'} changes the value of '-65281' [-Werror=sign-conversion]
  298 |             uxReturn &= ~eventEVENT_BITS_CONTROL_BYTES;

Solved by using TICK_TYPE_WIDTH_32_BITS instead of TICK_TYPE_WIDTH_16_BITS

C:/src/FreeRTOS-Kernel/tasks.c:48:6: error: #error configKERNEL_PROVIDED_STATIC_MEMORY cannot be set to 1 when using an MPU port. The vApplicationGet*TaskMemory() functions must be provided manually.
   48 |     #error configKERNEL_PROVIDED_STATIC_MEMORY cannot be set to 1 when using an MPU port. The vApplicationGet*TaskMemory() functions must be provided manually.
      |      ^~~~~

Solved by setting configKERNEL_PROVIDED_STATIC_MEMORY to 0.

Here is the diff:

diff --git a/examples/cmake_example/CMakeLists.txt b/examples/cmake_example/CMakeLists.txt
index 7b31cc52a..e6d7cb7ba 100644
--- a/examples/cmake_example/CMakeLists.txt
+++ b/examples/cmake_example/CMakeLists.txt
@@ -1,4 +1,23 @@
 cmake_minimum_required(VERSION 3.15)
+
+# https://stackoverflow.com/q/70324578 ->
+# https://cmake.org/cmake/help/latest/manual/cmake-toolchains.7.html#cross-compiling-for-linux
+# https://cmake.org/cmake/help/latest/variable/CMAKE_SYSTEM_NAME.html
+set(CMAKE_SYSTEM_NAME Generic)  # added
+set(CMAKE_SYSTEM_PROCESSOR arm) # added
+
+find_program(CMAKE_C_COMPILER "arm-none-eabi-gcc.exe") # added
+message("CMAKE_C_COMPILER ${CMAKE_C_COMPILER}")        # added
+set(CMAKE_CXX_COMPILER "arm-none-eabi-g++.exe")        # added
+
+# https://stackoverflow.com/q/53633705
+set(CMAKE_TRY_COMPILE_TARGET_TYPE "STATIC_LIBRARY")    # added
+
+# https://discourse.cmake.org/t/9726
+set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mcpu=cortex-m4 -mthumb -mno-thumb-interwork -mfpu=fpv4-sp-d16 -mfloat-abi=hard")
+set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mcpu=cortex-m4 -mthumb -mno-thumb-interwork -mfpu=fpv4-sp-d16 -mfloat-abi=hard")
+set(CMAKE_ASM_FLAGS "${CMAKE_ASM_FLAGS} -mcpu=cortex-m4 -mthumb -mno-thumb-interwork -mfpu=fpv4-sp-d16 -mfloat-abi=hard")
+
 project(example)

 set(FREERTOS_KERNEL_PATH "../../")
@@ -21,7 +40,8 @@ endif()
 set(FREERTOS_HEAP "4" CACHE STRING "" FORCE)

 # Select the native compile PORT
-set(FREERTOS_PORT "TEMPLATE" CACHE STRING "" FORCE)
+#set(FREERTOS_PORT "TEMPLATE" CACHE STRING "" FORCE)
+set(FREERTOS_PORT "GCC_ARM_CM0" CACHE STRING "" FORCE)

 # Adding the FreeRTOS-Kernel subdirectory
 add_subdirectory(${FREERTOS_KERNEL_PATH} FreeRTOS-Kernel)
@@ -71,4 +91,4 @@ add_executable(${PROJECT_NAME}

 target_link_libraries(${PROJECT_NAME} freertos_kernel freertos_config)

-set_property(TARGET freertos_kernel PROPERTY C_STANDARD 90)
\ No newline at end of file
+set_property(TARGET freertos_kernel PROPERTY C_STANDARD 90)
diff --git a/examples/template_configuration/FreeRTOSConfig.h b/examples/template_configuration/FreeRTOSConfig.h
index 33f80ea62..ff7ad0350 100644
--- a/examples/template_configuration/FreeRTOSConfig.h
+++ b/examples/template_configuration/FreeRTOSConfig.h
@@ -132,7 +132,8 @@
  *
  * Defining configTICK_TYPE_WIDTH_IN_BITS as TICK_TYPE_WIDTH_64_BITS causes
  * TickType_t to be defined (typedef'ed) as an unsigned 64-bit type. */
-#define configTICK_TYPE_WIDTH_IN_BITS              TICK_TYPE_WIDTH_64_BITS
+/*#define configTICK_TYPE_WIDTH_IN_BITS              TICK_TYPE_WIDTH_64_BITS*/
+#define configTICK_TYPE_WIDTH_IN_BITS              TICK_TYPE_WIDTH_32_BITS

 /* Set configIDLE_SHOULD_YIELD to 1 to have the Idle task yield to an
  * application task if there is an Idle priority (priority 0) application task that
@@ -559,7 +560,8 @@
  * The application can provide it's own implementation of
  * vApplicationGetIdleTaskMemory() and vApplicationGetTimerTaskMemory() by
  * setting configKERNEL_PROVIDED_STATIC_MEMORY to 0 or leaving it undefined. */
-#define configKERNEL_PROVIDED_STATIC_MEMORY    1
+/*#define configKERNEL_PROVIDED_STATIC_MEMORY    1*/
+#define configKERNEL_PROVIDED_STATIC_MEMORY    0

 /******************************************************************************/
 /* ARMv8-M port Specific Configuration definitions. ***************************/

As I mentioned, for me this compiles, but does not link - the linking errors are mostly undefined references like:

...
[100%] Linking C executable example
C:/msys64/mingw64/bin/../lib/gcc/arm-none-eabi/13.3.0/../../../../arm-none-eabi/bin/ld.exe: CMakeFiles/example.dir/main.c.obj: in function `exampleTask':
C:/src/FreeRTOS-Kernel/examples/cmake_example/main.c:60:(.text+0xa): undefined reference to `MPU_vTaskDelay'
C:/msys64/mingw64/bin/../lib/gcc/arm-none-eabi/13.3.0/../../../../arm-none-eabi/bin/ld.exe: CMakeFiles/example.dir/main.c.obj: in function `main':
C:/src/FreeRTOS-Kernel/examples/cmake_example/main.c:72:(.text+0x30): undefined reference to `MPU_xTaskCreateStatic'
C:/msys64/mingw64/bin/../lib/gcc/arm-none-eabi/13.3.0/../../../../arm-none-eabi/bin/ld.exe: FreeRTOS-Kernel/libfreertos_kernel.a(tasks.c.obj): in function `prvCreateIdleTasks':
C:/src/FreeRTOS-Kernel/tasks.c:3596:(.text+0x64): undefined reference to `vApplicationGetIdleTaskMemory'
C:/msys64/mingw64/bin/../lib/gcc/arm-none-eabi/13.3.0/../../../../arm-none-eabi/bin/ld.exe: FreeRTOS-Kernel/libfreertos_kernel.a(tasks.c.obj): in function `uxTaskPriorityGetFromISR':
C:/src/FreeRTOS-Kernel/tasks.c:2672:(privileged_functions+0x370): undefined reference to `ulSetInterruptMask'
C:/msys64/mingw64/bin/../lib/gcc/arm-none-eabi/13.3.0/../../../../arm-none-eabi/bin/ld.exe: C:/src/FreeRTOS-Kernel/tasks.c:2679:(privileged_functions+0x390): undefined reference to `vClearInterruptMask'
...

Thank you for sharing your solution!