Unable to compile FreeRTOS-Kernel files with Keil Compiler Version 6


Background / Project activities:

I use STM32CubeMX to generate code for STM32H753BIT6 Version V microcontroller.

At least four problems are encountered while using STM32CubeMX:

  1. I had to modify my Project to compile with help of Keil Compiler version 6. When I was using Keil Compiler version 5 (without modifying my code), the compile time was about 7 minutes.
  2. The STM32CubeMX imports the FreeRTOS version 10.2.1 with CMSIS-RTOS version 2.00 (and not FreeRTOS version 10.4.0)
  3. FreeRTOS Kernel cannot be compiled using Keil Compiler version 6.
  4. STM32CubeMX generated code uses the functions from CMSIS_OS.C file (which are rappers over the FreeRTOS functions) for creating tasks. Certain implemented APIs have minor issues (which I’ve reported on appropriate website / issue tracker).

I’ve created a project for understanding how to create tasks. Used FreeRTOS version is 10.2.1 with CMSIS-RTOS version 2.00. Based on this project I expect to update my project to use Tasks.

Concern with FreeRTOS-Kernel:

When using Keil ARM Compiler version 6 to compile the code, I am observing several concerns, possibly because the FreeRTOS-Kernel code is still compilable with help of Keil ARM Compiler Version 5 and not with Keil Compiler Version 6.

The files under question (port.c and portmacro.h) are available under folder:

I have made modifications to the files and brought them up to a level wherein the compiler is now not throwing errors. I however need your help with how to correctly use the extern variables inside the ASM code . I am also concerned about how to handle C variables in assembly.

(This page is preventing me upload code. I will try to upload port.zip again after chicking in / sharing my concern Maybe one can download the ZIP file from link https://github.com/FreeRTOS/FreeRTOS-Kernel/issues/154).

I have used the __CC_ARM macro to separate out the assembly code which can be compiled with Keil Compiler Version 5 from the one that can be compiled with Keil Compiler Version 6.

I hereby request you to please review the files and help me with an updated file ASAP (as it is crucial to my project.

Please help.


Are you using the GCC port files: https://github.com/FreeRTOS/FreeRTOS-Kernel/tree/master/portable/GCC/ARM_CM4F

You need to use GCC port files for Keil Compiler Version 6. Let me know if that does not work.



May you please help me with the path for the GCC files for Keil. Maybe I added incorrect reference to files that I am using, as I was not sure where to find the exact Keil Compiler related files on the GitHub / FreeRTOS Kernel.

I have therefore attached the files to the issue I raised on GitHub.

I did review both the base files and they are indeed coded for compiling with help of Keil / ARM Compiler Version 5. Also as I am sure about the current compiler being supported, I tried modifying the two files so that the files can be compiled with help of ARM / Keil compiler version 6.


Dear Gaurav,

As I am developing code for STM32H753BIT6, I used STM32CubeMX to configure the microcontroller and also enabled FreeRTOS in the tool, so as to get the FreeRTOS (version 10.2.1 with CMSIS-RTOS version 2.0) port for the microcontroller

The path for the port.c and portmacro.h in the project that I am using is .\Middlewares\Third_Party\FreeRTOS\Source\portable\RVDS\ARM_CM4F

As I am a new member on this forum I posibly do not have rights for uploading the file to this forum, I have therefore uploaded the files to https://github.com/FreeRTOS/FreeRTOS-Kernel/issues/154 so that others may review my concerns.


I have uploaded a project here: https://github.com/FreeRTOS/FreeRTOS-Kernel/files/5246366/stm32h753.zip

As you can see, the only thing I did is change RVDS port files with GCC ones and update the corresponding include paths in the Keil IDE.


Dear All,

Below information is shared as reference for individuals / coders who are looking out for answer to query:

Is there a way to tell STM32CubeMX to use GCC and not use RVDS?

I’ve raised concern about this to ST Community:

Description: How to instruct STM32CubeMX to generate code compilable with ARM / Keil Compiler Version 6
Case Number: 00115320
Date/Time Opened: 9/18/2020 9:13 AM