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

**URL:** <https://forums.freertos.org/t/unable-to-compile-freertos-kernel-files-with-keil-compiler-version-6/10697>\
**Category:** Kernel\
**Created:** [September 18, 2020, 5:47am UTC](https://forums.freertos.org/t/unable-to-compile-freertos-kernel-files-with-keil-compiler-version-6/10697 "2020-09-18T05:47:14Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![rxa1031](https://d3iykfbgfh8zhg.cloudfront.net/user_avatar/forums.freertos.org/rxa1031/32/891_2.png) [@rxa1031](https://forums.freertos.org/u/rxa1031)\
**Post date:** [September 18, 2020, 5:47am UTC](https://forums.freertos.org/t/unable-to-compile-freertos-kernel-files-with-keil-compiler-version-6/10697/1 "2020-09-18T05:47:14Z")

</div>

Hi,

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:

> **[FreeRTOS/FreeRTOS-Kernel](https://github.com/FreeRTOS/FreeRTOS-Kernel/tree/master/portable/RVDS/ARM_CM4F)**
>
> FreeRTOS kernel files only, submoduled into https://github.com/FreeRTOS/FreeRTOS and various other repos. - FreeRTOS/FreeRTOS-Kernel

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](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.

Thanks,  
@rxa1031

---

<div class="post-metadata">

**Author:** ![aggarg](https://d3iykfbgfh8zhg.cloudfront.net/user_avatar/forums.freertos.org/aggarg/32/4245_2.png) [@aggarg](https://forums.freertos.org/u/aggarg)\
**Post date:** [September 18, 2020, 2:46pm UTC](https://forums.freertos.org/t/unable-to-compile-freertos-kernel-files-with-keil-compiler-version-6/10697/2 "2020-09-18T14:46:28Z")

</div>

Are you using the GCC port files: [https://github.com/FreeRTOS/FreeRTOS-Kernel/tree/master/portable/GCC/ARM\_CM4F](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.

Thanks.

---

<div class="post-metadata">

**Author:** ![rxa1031](https://d3iykfbgfh8zhg.cloudfront.net/user_avatar/forums.freertos.org/rxa1031/32/891_2.png) [@rxa1031](https://forums.freertos.org/u/rxa1031)\
**Post date:** [September 18, 2020, 2:51pm UTC](https://forums.freertos.org/t/unable-to-compile-freertos-kernel-files-with-keil-compiler-version-6/10697/3 "2020-09-18T14:51:42Z")

</div>

@aggarg

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.

Regards,  
Rajeev

---

<div class="post-metadata">

**Author:** ![rxa1031](https://d3iykfbgfh8zhg.cloudfront.net/user_avatar/forums.freertos.org/rxa1031/32/891_2.png) [@rxa1031](https://forums.freertos.org/u/rxa1031)\
**Post date:** [September 18, 2020, 2:57pm UTC](https://forums.freertos.org/t/unable-to-compile-freertos-kernel-files-with-keil-compiler-version-6/10697/4 "2020-09-18T14:57:02Z")

</div>

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](https://github.com/FreeRTOS/FreeRTOS-Kernel/issues/154) so that others may review my concerns.

Regards,  
Rajeev

---

<div class="post-metadata">

**Author:** ![aggarg](https://d3iykfbgfh8zhg.cloudfront.net/user_avatar/forums.freertos.org/aggarg/32/4245_2.png) [@aggarg](https://forums.freertos.org/u/aggarg)\
**Post date:** [September 18, 2020, 3:13pm UTC](https://forums.freertos.org/t/unable-to-compile-freertos-kernel-files-with-keil-compiler-version-6/10697/5 "2020-09-18T15:13:19Z")

</div>

I have uploaded a project here: [https://github.com/FreeRTOS/FreeRTOS-Kernel/files/5246366/stm32h753.zip](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.

Thanks.

---

<div class="post-metadata">

**Author:** ![rxa1031](https://d3iykfbgfh8zhg.cloudfront.net/user_avatar/forums.freertos.org/rxa1031/32/891_2.png) [@rxa1031](https://forums.freertos.org/u/rxa1031)\
**Post date:** [September 21, 2020, 3:58pm UTC](https://forums.freertos.org/t/unable-to-compile-freertos-kernel-files-with-keil-compiler-version-6/10697/6 "2020-09-21T15:58:46Z")

</div>

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

Thanks,  
Rajeev

---

<div class="post-metadata">

**Author:** ![BigCatDairy](https://d3iykfbgfh8zhg.cloudfront.net/user_avatar/forums.freertos.org/bigcatdairy/32/4778_2.png) [@BigCatDairy](https://forums.freertos.org/u/BigCatDairy)\
**Post date:** [October 9, 2023, 1:56pm UTC](https://forums.freertos.org/t/unable-to-compile-freertos-kernel-files-with-keil-compiler-version-6/10697/7 "2023-10-09T13:56:57Z")

</div>

I met the same problem, but I am new developer of stm32, could you pl give any instruction of how to use? thanks.

---

<div class="post-metadata">

**Author:** ![aggarg](https://d3iykfbgfh8zhg.cloudfront.net/user_avatar/forums.freertos.org/aggarg/32/4245_2.png) [@aggarg](https://forums.freertos.org/u/aggarg)\
**Post date:** [October 9, 2023, 5:55pm UTC](https://forums.freertos.org/t/unable-to-compile-freertos-kernel-files-with-keil-compiler-version-6/10697/8 "2023-10-09T17:55:31Z")

</div>

Would you please your problem? Also, please create a new issue as this one is 3 years old.
