I have downloaded and extracted FreeRTOSv202604.00-LTS and FreeRTOSv202406.05-LTS from freertosORG.
In both versions, I tried to build cmake_example (\FreeRTOS-LTS\FreeRTOS\FreeRTOS-Kernel\examples\cmake_example\) using the following commands at the given location.
This looks like a toolchain setup error. Somewhere under the hood your cmake is using an MSVC compiler rather than a GCC/Clang compiler. This explains why certain syntax like __attribute__ is not being recognized.
You’re going to need to use a GCC-compatible toolchain. You might be able to force this with the cmake -G "MinGW Makefiles" .. parameter.
Hi Kody,
Thank you very much for your response.
I’m new to FreeRTOS and have just started exploring it by compiling example projects to understand how it works. Your reply genuinely means a lot to me.
I tried using the commands in the given sequence, but I still get some different errors. (This time, the error appears in both v2024 and v2026.)
cmake -G “MinGW Makefiles” ..
mingw32-make or **cmake --build .
**
But now I am getting errors like: integer constant is too large for ‘unsigned long’ type [-Werror=long-long]. (error snapshot given below)
I tried to check event_groups.c 197 and tried to see where the variable data type is originally defined, but everything looks fine there. I do not need to make changes to the files; instead, I need to find out if I am using 64-bit compilers. So, I tried using the following commands, but the error persists.
**cmake -G “MinGW Makefiles” -DCMAKE_MAKE_PROGRAM=C:/mingw64/bin/mingw32-make.exe -DCMAKE_C_COMPILER=C:/mingw64/bin/x86_64-w64-mingw32-gcc.exe -DCMAKE_CXX_COMPILER=C:/mingw64/bin/x86_64-w64-mingw32-g++.exe ..
**
So my question is, if I downloaded FreeRTOS from FreeRTOS-ORG, i.e., a fresh download without any changes, one with version v2024 and another with version v2026(using commands cmake .. and cmake --build .), why does it work on v2024 and not on v2026?
This seems to come down to building on Windows. Windows defines a long as a 32-bit value even on a 64-bit OS. Many 64-bit Linux distros define a long as a 64-bit value.
The issue arises when you define the tick size to 64 bits. On windows this requires an unsigned long long which requires a compiler newer than C90. The standard is enforced here in the CMake file.
To get around this you could try changing this line in your local copy of the template config to #define configTICK_TYPE_WIDTH_IN_BITS TICK_TYPE_WIDTH_32_BITS
If this ends up working, let me know. I’m happy to update the code to default to a 32-bit tick so that windows builds happily.
To get a complete list of warnings at one go, you can comment out this line so that warnings are not treated as errors and then we can take a look what all needs to be changed.
As you suggested, I changed line139 (FreeRTOSConfig.h) in my local copy of the template config to #define configTICK_TYPE_WIDTH_IN_BITS TICK_TYPE_WIDTH_32_BITS and run the commands below.
This worked out for me. I can see example.exe get created(snapshot attached). This is true for both versions, v2024 and v2026. (Additionally, I checked CLI outputs and found the compiler info “The C compiler identification is GNU 15.2.0”.)
I can see that the previous errors are appearing as warnings(snapshot attached), and example.exe has been created.
Even though the expected outcome is achieved with this change, I think suppressing errors to the warnings is not the way to solve this issue. I mean the build should be clean with no errors or warnings.
Kody’s earlier suggestion resolved the issue for me. But I’d still like to hear your recommendations on any further improvements.