cancel
Showing results for 
Search instead for 
Did you mean: 

How to instruct STM32CubeMX to generate code compilable with ARM / Keil Compiler Version 6

Rajeev Arora
Senior

****Preliminary concern block START****

Hello,

Please help me understand any setting or IOC file change that can help me instruct STM32CubeMX to generate code which:

A. Includes the Files from the GCC folder instead of RVDS folder (so that the code can be compiled using ARM / Keil Compiler version 6)?

I currently have to modify the STM32CubeMX generated code for MDK-ARM V5.27 (or V5) to:

  1. Use MDK ARM compiler version 6
  2. Manually modify the generated UVPROJX file so as to:
    1. STOP using files PORT.C and PORTMACRO.H available in folder ..\Middlewares\Third_Party\FreeRTOS\Source\portable\RVDS\ARM_CM4F (path with reference to the UVPROJX file location) (note the word RVDS in folder path)
    2. Add path to the above two files which are instead available in folder Middlewares\Third_Party\FreeRTOS\Source\portable\GCC\ARM_CM4F (note the word GCC in folder path)

I am afraid that as soon as I regenerate code with help of the IOC file and STM32CubeMX, the UVPROJX will again start using folder RVDS\ARM_CM4F instead of GCC\ARM_CM4F.

Please help with fixing above issue, as this fix is critical to my current release.

Thanks,

@rxa1031

****Preliminary concern block END****

****Follow up / observations START****

Hello,

I am using HAL and LL driver with Arm Compiler version 6. The currently in use HAL driver has macro __STM32H7xx_HAL_VERSION set to 0x01090000 (i.e. version 1.09.00.00, which corresponds to STM32Cube MCU Package for STM32H7 series version 1.8.0).

I have been using STM32CubeMX generated code that is compilable with Keil Version 5. I am able to compile this code with help of Keil Compiler Version 6. I do not observe any issue with the LL or HAL drivers.

I am aware that there is indeed issue with only FreeRTOS code compilation with Keil Compiler version 6. However, this is only because the STM32CubeMX does not (help select ARM-Keil compiler version 6 and hence does not) incorporate the GCC folder (and rather incorporates the RVDS folder which is needed for Version 5 compiler). I assume that a fix for this should be an easy task for the STM32CubeMX / ST team. For

testing purpose, in one of my test codes, I had manually changed the folder path to confirm that the issue is because of incorrect folder inclusion only.

More details can be found on the below link:

https://github.com/FreeRTOS/FreeRTOS-Kernel/issues/154

Attached IOC files USART3-Test.IOC and Gateway-H7-HW-Text.IOC shall help generate code with HAL drivers included. The USART3-Test.IOC also helps generates code which includes some LL Drivers as

well.

After you click on Generate Code button, you shall observe the WARNINGS messages for Not Configured or Wrong parameter values (for which I am already in conversation with ST). (These concerns are with regards to using defined macros for declaring some property values).

Once I open the generated project with Keil IDE, I open project property menu, then under Options for Target 'Gateway-H7-Hw-Test' -> Target -> Code Generation Arm Compiler, I select Use default compiler version 6.

The STM32Cube always adds incorrect value for XTAL (MHz) so I change it back to 25 MHz.

One will have to add some variables / macros to the main file before compiling the Gateway H7 HW Test

code, I am sharing the declarations below, please add them under users Private Variable comment:

unsigned char u8MaxStandardCAN1Filters = 0;
unsigned char u8MaxExtendedCAN1Filters = 2;
 
unsigned char u8MaxStandardCAN2Filters = 0;
unsigned char u8MaxExtendedCAN2Filters = 0;

The code will compile successfully using the Keil Compiler Version 6.

Please share your inputs.

Thanks,

Rajeev

Regards,

@rxa1031

****Follow up / observations END****

1 ACCEPTED SOLUTION

Accepted Solutions

Dear @Houssem CHAABANI​ , @Khouloud ZEMMELI​ ,

There are concerns with using MDK-ARM version 5, one of them being that it takes a lot of time (tens of minutes) just to compile the code.

Also, we have been instructed by our library provider to use the MDK-ARM compiler version 6.

I observe there is a quick fix for my concern, which being deleting the RVDS folder and adding the GCC folder. Then opening UVPROJX file in text editor and changing folder name RVDS to GCC. I am currently doing this change manually.

As the microcontroller in use is STM32H753, hence I am downloading the GCC\ARM_CM4F folder and its content from location https://github.com/STMicroelectronics/STM32CubeH7/tree/master/Middlewares/Third_Party/FreeRTOS/Source/portable/GCC/ARM_CM4F

Updating the STM32CubeMX tool to automate the above change, will be of great help, along with saving lot of time spent just in compiling / building the code.

Thanks,

Rajeev

View solution in original post

3 REPLIES 3
Houssem CHAABANI
Senior II

Dear @Rajeev Arora​ ,

Thank you for your feedback,

Please note that KEIL version 6 is not currently supported, and it's recommended to use the supported Toolchain/IDE.

Best Regards,

Houssem

Dear @Houssem CHAABANI​ , @Khouloud ZEMMELI​ ,

There are concerns with using MDK-ARM version 5, one of them being that it takes a lot of time (tens of minutes) just to compile the code.

Also, we have been instructed by our library provider to use the MDK-ARM compiler version 6.

I observe there is a quick fix for my concern, which being deleting the RVDS folder and adding the GCC folder. Then opening UVPROJX file in text editor and changing folder name RVDS to GCC. I am currently doing this change manually.

As the microcontroller in use is STM32H753, hence I am downloading the GCC\ARM_CM4F folder and its content from location https://github.com/STMicroelectronics/STM32CubeH7/tree/master/Middlewares/Third_Party/FreeRTOS/Source/portable/GCC/ARM_CM4F

Updating the STM32CubeMX tool to automate the above change, will be of great help, along with saving lot of time spent just in compiling / building the code.

Thanks,

Rajeev

Thanks, this solutions is still working.
(Providing MDK-ARM V6 support - STMicroelectronics Community)