How to update Automotive Motor Control library for Kinetis KV3x to work with GCC ?

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

How to update Automotive Motor Control library for Kinetis KV3x to work with GCC ?

Jump to solution
1,443 Views
Maciek
Contributor V

Hi,
after Daniel's (dumitru-daniel.popa) hotfix for MBD Toolbox for KV3x with GCC:

https://community.nxp.com/message/908035?commentID=908035#comment-908035?q=kinetis 

I'm able to build the examples that are using only peripheral blocks from KV3x. I'm building on R2016b with GCC from S32K MBD Toolbox v3.0.0.
But I'm getting errors for models that are using Math and Motor Control Library blocks!
Below the hotfix was said:
"#3: If you need to use the Automotive Motor Control library you need to get the latest version that support Kinetis families with GCC."
I assume this is my problem.


How to get/update this library to be able to compile models correctly ?

Thanks
Maciek

Tags (2)
0 Kudos
1 Solution
1,063 Views
Maciek
Contributor V

Hi constantinrazvan.chivu,

everything works perfectly.
I've removed the CM4_MMCLIB_GCC.a from the S32K Toolbox installation to 'produce' the error I've mentioned before. And there is no error now. Everything builds without warnings. And indeed the library is copied to _rtw directory every time.
I don't know what has happened. The only (probably) difference between now and yesterday is:
today I was building after the whole Matlab restart (after Your hotfix). Yesterday I may have started builds without restarting Matlab... I can't see anything else.
Anyway, it works.

I will try a few simple models on hardware.
Thanks for help
Maciek

View solution in original post

5 Replies
1,063 Views
constantinrazva
NXP Employee
NXP Employee

Hi Maciek‌,

Sorry for the late reply, I had to get the sources for an older (not anymore supported) MCLib version and build the .a for gcc. To fix this issue, please copy the attached files and folders: (*please first make a copy of the existing ones)

 

gcc folder from archive --> {Root Folder}/MCLIB_kv3xf/lib/gcc folder

include folder from archive --> {Root Folder}/MCLIB_kv3xf/include folder

mcd_kv3xf.tmf file --> {Root Folder}/mcd_kv3xf/mcd_kv3xf.tmf file

mcd_kv3xf_copy_required_files.-->{Root Folder}/mcd_kv3xf/mscripts/mcd_kv3xf_copy_required_files.file

 

Please let us know if you have any other questions.

Hope this helps,

Razvan.

0 Kudos
1,063 Views
Maciek
Contributor V

Hi constantinrazvan.chivu,

Your hotfix works (but with modifications)!
Finally I was able to build executables for all examples with 'gmclib' and 'gflib' strings in names using GCC from S32DS.

However, I want to clarify some points.
I have added (not replaced) Your 'gcc' folder to 'C:\MCToolbox\mctbx_Kinetis\mctbx_kv3xf\MCLIB_kv3xf' folder. In my installation there was no such folder; only folders 'iar', 'kail', 'lcc' and 'vc'.
I don't have 'mcd_kv3xf' folder but in the corresponding place I have 'mctbx_kv3xf' - and I've replaced .tmf file there. The matlab .p file was also replaced in '.../mctbx_kv3xf/mscripts/' instead of '.../mcd_kv3xf/mscripts/.
After these changes I wasn't able to build any example model. At the end of the build process I've got a line:
"...--sysroot=C:\Users\Maciek\Documents\MATLAB\Add-Ons\Toolboxes\NXP_MBDToolbox_S32K1xx\code\tools\gcc-arm-none-eabi-4_9/arm-none-eabi/newlib -lm "CM4_MMCLIB_GCC.a" -Wl,-Map..."
with error message saying: 'CM4_MMCLIB_GCC.a' there is no such file or directory..."
As it seems that Your library is searched in 'C:\Users\Maciek\Documents\MATLAB\Add-Ons\Toolboxes\NXP_MBDToolbox_S32K1xx\code\tools\gcc-arm-none-eabi-4_9/arm-none-eabi/newlib' directory in S32K MBD Toolbox installation - I've copied the library there. And after that everything works fine.

The only concern I have: is it safe to keep this library there ? I don't want to mess something with S32K MBD Toolbox installation.

Thanks
Maciek

0 Kudos
1,063 Views
constantinrazva
NXP Employee
NXP Employee

Hello Maciek‌,

First of all sorry about the mcd_kvxx vs mctbx_kvxx issue - i got it from the development path name (not the installation path name).

Secondly, I put the entire folder for gcc so that you can drag&drop it into the specified path; there was no gcc support for MCLib for this toolbox in the past (that's the reason why there was no gcc folder).

About the compiler, the  GCC_ARM_TOOL system environment variable should point to gcc-arm-none-eabi-4_9; if you have S32K Toolbox you can use the same path as for GCC_S32K_TOOL:

It should be something similar to C:\MBDToolbox\mbdtbx_S32K\tools\gcc-arm-none-eabi-4_9 (as stated in step #3 in the hotfix provided here).

Finally, in regard with CM4_MMCLIB_GCC.a, this file should be copied in the *_rtw folder that is created when you build a model - this is done by the mcd_kv3xf_copy_required_files.p file.

To address your concern, it is safe for you to keep it there, but that is not how it's intended to work - if the mcd_kv3xf_copy_required_files.p copies it into the *_rtw folder, it should work as is, leaving it in the gcc folder.

So can you check (having GCC_ARM_TOOL environment variable set the same to GCC_S32K_TOOL) if you have any errors? And if the errors persist, can you tell me if the CM4_MMCLIB_GCC.a file is in the respective *_rtw folder ?

Thanks!

Razvan.

Edited after initial post : I installed a fresh copy of kinetis tbx from www.nxp.com, added the initial hotfix for gcc, then added this hotfix for MCLib (having GCC_ARM_TOOL set as I stated above)  and it works. Please let me know if you encounter any problems after setting the GCC_ARM_TOOL env variable.

0 Kudos
1,064 Views
Maciek
Contributor V

Hi constantinrazvan.chivu,

everything works perfectly.
I've removed the CM4_MMCLIB_GCC.a from the S32K Toolbox installation to 'produce' the error I've mentioned before. And there is no error now. Everything builds without warnings. And indeed the library is copied to _rtw directory every time.
I don't know what has happened. The only (probably) difference between now and yesterday is:
today I was building after the whole Matlab restart (after Your hotfix). Yesterday I may have started builds without restarting Matlab... I can't see anything else.
Anyway, it works.

I will try a few simple models on hardware.
Thanks for help
Maciek

1,063 Views
dumitru-daniel_
NXP Employee
NXP Employee

Hi Maciek‌,

Indeed you will need an updated AMMCLIB that has support for GCC (built with GCC).

99% sure - in think i use the same library from S32K toolbox. 

We will check this tomorrow and we will let you know. constantinrazvan.chivu‌ can you please advice?

Thank you!

Daniel

0 Kudos