GCC Toolchain with KV4x

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

GCC Toolchain with KV4x

Jump to solution
2,482 Views
lethuer
Contributor V

Hallo,

I want to set up the GCC Compiler to test if there is a difference to the IAR Compiler.

Therefore I've set up the Environment variable like shown below:

Unbenannt.PNG

the complete path is this: "C:/MBDToolbox/mbdtbx_S32K/tools/gcc-arm-none-eabi-4_9"

But I'm not using the S32K ! I want to use the KV4x.

But it should be possible to use the GCC Compiler, right ?

During the build procedure I get this message:

fsl_gpio_irq.c:60:3: error: 'for' loop initial declarations are only allowed in C99 or C11 mode
       for (uint8_t i = 0; i < 32; ++i) {
       ^
    fsl_gpio_irq.c:60:3: note: use option -std=c99, -std=gnu99, -std=c11 or -std=gnu11 to compile your code

As an attachment you get the build Report.

Also with C11 or C99 I get an error:

    C:/MBDToolbox/mbdtbx_S32K/tools/gcc-arm-none-eabi-4_9/bin/arm-none-eabi-ld: cannot find CM04_MMCLIB_CW.a: No such file or directory
    C:/MBDToolbox/mbdtbx_S32K/tools/gcc-arm-none-eabi-4_9/bin/arm-none-eabi-ld: cannot find -lm
    C:/MBDToolbox/mbdtbx_S32K/tools/gcc-arm-none-eabi-4_9/bin/arm-none-eabi-ld: cannot find -lc
    C:/MBDToolbox/mbdtbx_S32K/tools/gcc-arm-none-eabi-4_9/bin/arm-none-eabi-ld: cannot find -lgcc
    gmake: *** [Motorregelung_mit_KV46F150M_Stand_090118_GCC.elf] Error 1
    ### Build procedure for model: 'Motorregelung_mit_KV46F150M_Stand_090118_GCC' aborted due to an error.
    Error make_rtw: exception id RTW:buildProcess:fatalBuildError  message Error(s) encountered while building "Motorregelung_mit_KV46F150M_Stand_090118_GCC"

The target compile Options are configured like this:

Unbenannt.PNG

Are the Settings correct for the KV4x Controller ?

Best regards

0 Kudos
1 Solution
1,752 Views
constantinrazva
NXP Employee
NXP Employee

Hi again lethuer‌,

The link I gave earlier is for deploying a hotfix for kv3; I have attached the files you need for KV4 here. The process is very similar though - please follow these steps:

#1: Toolbox related files to add and enable the support for GCC

1.1. Go to {Kinetis Toolbox Install dir}\mctbx_Kinetis\mctbx_kv\mscripts\ folder and replace the mcd_kv_compiler_callback.p with the one attached

1.2. Go to {Kinetis Toolbox Install dir}\mctbx_Kinetis\mctbx_kv4xf\mctbx_kv4xf\ folder and replace mcd_kv4xf.tmf and mcd_kv4xf.tlc files with the ones attached

 

#2: GCC support files

2.1: Copy and replace the startup_MK22F51212.S file attached to both {Kinetis Toolbox Install dir}\mctbx_Kinetis\Kinetis_Platform_SDK\platform\startup\MK22F51212\gcc\ and {Kinetis Toolbox Install dir}\mctbx_Kinetis\mctbx_kv4xf\src\gcc_specific_files\ folders

 

#3: Define the GCC_ARM_TOOL system variable to point to GCC compiler toolchain.

For verification we used the compiler delivered with Model Based Design Toolbox for S32K rev 2.0.0 but you could use the one shipped with S32DS IDE as well.

e.g. GCC_ARM_TOOL = C:\MBDToolbox\mbdtbx_S32K\tools\gcc-arm-none-eabi-4_9

 

Notes: 

#1: The GCC options should be:

GCC Compile: -c -mcpu=cortex-m4 -mthumb -mfloat-abi=hard -mfpu=fpv4-sp-d16 -g -gstrict-dwarf

GCC Assemble: -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 -g

GCC Link: -mcpu=cortex-m4 -mthumb -mfloat-abi=hard -mfpu=fpv4-sp-d16

1.JPG

Hope this helps!

Razvan.

View solution in original post

8 Replies
1,751 Views
constantinrazva
NXP Employee
NXP Employee

Hi lethuer‌,

At the moment of the release of that toolbox, we had no support for GCC (this is an older toolbox) - we have added support for it last year and we addressed that issue here.

Please follow the instructions there to deploy the hotfix.

Best regards,

Razvan.

0 Kudos
1,753 Views
constantinrazva
NXP Employee
NXP Employee

Hi again lethuer‌,

The link I gave earlier is for deploying a hotfix for kv3; I have attached the files you need for KV4 here. The process is very similar though - please follow these steps:

#1: Toolbox related files to add and enable the support for GCC

1.1. Go to {Kinetis Toolbox Install dir}\mctbx_Kinetis\mctbx_kv\mscripts\ folder and replace the mcd_kv_compiler_callback.p with the one attached

1.2. Go to {Kinetis Toolbox Install dir}\mctbx_Kinetis\mctbx_kv4xf\mctbx_kv4xf\ folder and replace mcd_kv4xf.tmf and mcd_kv4xf.tlc files with the ones attached

 

#2: GCC support files

2.1: Copy and replace the startup_MK22F51212.S file attached to both {Kinetis Toolbox Install dir}\mctbx_Kinetis\Kinetis_Platform_SDK\platform\startup\MK22F51212\gcc\ and {Kinetis Toolbox Install dir}\mctbx_Kinetis\mctbx_kv4xf\src\gcc_specific_files\ folders

 

#3: Define the GCC_ARM_TOOL system variable to point to GCC compiler toolchain.

For verification we used the compiler delivered with Model Based Design Toolbox for S32K rev 2.0.0 but you could use the one shipped with S32DS IDE as well.

e.g. GCC_ARM_TOOL = C:\MBDToolbox\mbdtbx_S32K\tools\gcc-arm-none-eabi-4_9

 

Notes: 

#1: The GCC options should be:

GCC Compile: -c -mcpu=cortex-m4 -mthumb -mfloat-abi=hard -mfpu=fpv4-sp-d16 -g -gstrict-dwarf

GCC Assemble: -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 -g

GCC Link: -mcpu=cortex-m4 -mthumb -mfloat-abi=hard -mfpu=fpv4-sp-d16

1.JPG

Hope this helps!

Razvan.

1,752 Views
lethuer
Contributor V

Hello constantinrazvan.chivu

thank you for your answer !

I've followed your instructions.

In the Point #2 the red marked folder doesn't exist.

{Kinetis Toolbox Install dir}\mctbx_Kinetis\mctbx_kv4xf\src\gcc_specific_files\

So I've created a new one, is that correct ?

If I choose the IAR Compiler the build procedure and download to the target works.

With GCC now the build process is made succesful, but it does not run on the target.

I've attached the build report...

Any further tips for that ?

0 Kudos
1,752 Views
lethuer
Contributor V

With a simple model it works !

But not with a more complex model with ADC and PWM Trigger and some other blocks...

So in my model there is a fault.

Thank you for your Support !

0 Kudos
1,752 Views
constantinrazva
NXP Employee
NXP Employee

Hi lethuer‌,

Just to be sure, you are saying that you can use GCC with KV4x, right? 

And as for your model, from what I read in the build log you attached, the executable is generated successfully - besides that, unfortunately, there is no more information I can extract from it.

Please let us know if you are having further issues with using GCC or with our toolbox in general and we will try to sort it out quickly.

Kind regards,

Razvan.

0 Kudos
1,752 Views
lethuer
Contributor V

Hi constantinrazvan.chivu

that's correct !

GCC now also works in principle !

I was able to generate the code and download it to a Hardware with a small model with ADC and PWM interrupt.

Now I use a more complex model with some other simulink blocks beside the ADC and PWM Interrupts.

Because of any circumstances the download to the Hardware seems to fail with using GCC compiler, because the PWM Signal I want to use doesn't starts.

With IAR Compiler the model is downloaded to the Hardware completely and the PWM starts.

0 Kudos
1,753 Views
constantinrazva
NXP Employee
NXP Employee

Hi lethuer‌,

If that is the case, can you send us the model you are working on? From the tests we did, not only did the code compile, but the application worked as expected on the hardware, so we are having trouble finding the problem. If you send us something that is not working as expected, we can reproduce it and investigate why that happens and fix it. 

Thank you in advance, 

Razvan.

0 Kudos
1,753 Views
lethuer
Contributor V

Hi constantinrazvan.chivu

sorry...

At this moment it is not allowed for me to share the model.

Thank you very much for your suggestion.

0 Kudos