How to update Automotive Motor Control library for Kinetis KV4x to work with GCC after hotfix for KV4x?

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

How to update Automotive Motor Control library for Kinetis KV4x to work with GCC after hotfix for KV4x?

Jump to solution
1,264 Views
Maciek
Contributor V

Hi constantinrazvan.chivu and dumitru-daniel.popa,

after applying Your last hotfix for Kinetis KV4x

(https://community.nxp.com/message/975746?commentID=975746#comment-975746)

I'm able to build successfully the example models that use peripheral blocks for KV4x with GCC compiler.

But I'm getting errors for models that are using Math and Motor Control Library blocks!

This issue was resolved before for Kinetis KV3x in this post:

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

Is it possible to fix this problem in this (KV4x) case ?

Thanks for help

Maciek

0 Kudos
1 Solution
912 Views
constantinrazva
NXP Employee
NXP Employee

Hello Maciek‌,

Yes, it is possible. In order to use Math and Motor Control Library blocks, please follow these steps:

1) make a folder named gcc (copy the folder from archive) and move it to --> {Root Folder}/MCLIB_kv4xf/lib/gcc

2) get include folder from archive and move it to --> {Root Folder}/MCLIB_kv4xf/include folder (replace the whole folder)

3) get mcd_kv4xf.tmf file and move it to --> {Root Folder}/mcd_kv4xf/mcd_kv4xf.tmf file (replace this file)

4) get mcd_kv4xf_copy_required_files.p -->{Root Folder}/mcd_kv4xf/mscripts/mcd_kv4xf_copy_required_files.p file (replace this file)

Note: you might have folders named *mctbx_kv4xf* instead of *mcd_kv4xf*. In this case, the steps remain the same, but with different path names.

 

Kind regards,

Razvan.

View solution in original post

0 Kudos
4 Replies
913 Views
constantinrazva
NXP Employee
NXP Employee

Hello Maciek‌,

Yes, it is possible. In order to use Math and Motor Control Library blocks, please follow these steps:

1) make a folder named gcc (copy the folder from archive) and move it to --> {Root Folder}/MCLIB_kv4xf/lib/gcc

2) get include folder from archive and move it to --> {Root Folder}/MCLIB_kv4xf/include folder (replace the whole folder)

3) get mcd_kv4xf.tmf file and move it to --> {Root Folder}/mcd_kv4xf/mcd_kv4xf.tmf file (replace this file)

4) get mcd_kv4xf_copy_required_files.p -->{Root Folder}/mcd_kv4xf/mscripts/mcd_kv4xf_copy_required_files.p file (replace this file)

Note: you might have folders named *mctbx_kv4xf* instead of *mcd_kv4xf*. In this case, the steps remain the same, but with different path names.

 

Kind regards,

Razvan.

0 Kudos
912 Views
Maciek
Contributor V

Hi constantinrazvan.chivu,

after this fix I've been able to build all (or most of) the models from Examples directory.

Including '_gdlib' and '_gflib' and '_gmclib' examples!

Thanks for Your help.

I've seen strange behavior with the model 'kv4xf_sim_pil_target'. During the first try to build I've got errors.

Below is the output from last stage of the build process:


==== Creating kv4xf_sim_pil_target.elf from obj files ====
"C:\Users\Maciek\Documents\MATLAB\Add-Ons\Toolboxes\NXP_MBDToolbox_S32K1xx\code\tools\gcc-arm-none-eabi-4_9/bin/arm-none-eabi-gcc" -mcpu=cortex-m4 -mthumb -mfloat-abi=hard -mfpu=fpv4-sp-d16 -Xlinker --gc-sections -Xlinker --defsym=__ram_vector_table__=1 -TMKV4xF.ld startup_MKV46F15.o fsl_clock_manager.o fsl_ftm_common.o fsl_ftm_driver.o fsl_ftm_hal.o fsl_interrupt_manager.o fsl_mcg_hal.o fsl_sim_clock_module_names_MKV46F15.o fsl_sim_hal.o fsl_uart_common.o fsl_uart_driver.o fsl_uart_hal.o kv4xf_sim_pil_target.o main_init.o mcd_main.o rtiostream_utils.o startup.o system_MKV46F15.o uart_init.o -specs=nosys.specs --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,kv4xf_sim_pil_target.map -o kv4xf_sim_pil_target.elf
c:/users/maciek/documents/matlab/add-ons/toolboxes/nxp_mbdtoolbox_s32k1xx/code/tools/gcc-arm-none-eabi-4_9/bin/../lib/gcc/arm-none-eabi/4.9.3/../../../../arm-none-eabi/bin/ld.exe: cannot open linker script file MKV4xF.ld: No such file or directory
collect2.exe: error: ld returned 1 exit status
gmake: *** [kv4xf_sim_pil_target.elf] Error 1
### Build procedure for model: 'kv4xf_sim_pil_target' aborted due to an error.
Error make_rtw: exception id RTW:buildProcess:fatalBuildError message Error(s) encountered while building "kv4xf_sim_pil_target"

I'm building models without any physical hardware board attached - I'm waiting for HVP-MC3PH with KV3 and KV4 control cards to be delivered soon. So I've unchecked box: 'Enable PIL Mode Download' - and then the model has built successfully! After that I've checked this box back again - and this time the model has built without errors!

I've checked also that similar example model for kv3: 'kv3xf_sim_pil_target' shows the same behavior. At first it throws errors:

==== Creating kv3xf_sim_pil_target.elf from obj files ====
"C:\Users\Maciek\Documents\MATLAB\Add-Ons\Toolboxes\NXP_MBDToolbox_S32K1xx\code\tools\gcc-arm-none-eabi-4_9/bin/arm-none-eabi-gcc" -mcpu=cortex-m4 -mthumb -mfloat-abi=hard -mfpu=fpv4-sp-d16 -Xlinker --gc-sections -Xlinker --defsym=__ram_vector_table__=1 -TMKV3xF.ld startup_MK22F51212.o fsl_clock_manager.o fsl_debug_uart.o fsl_ftm_driver.o fsl_ftm_hal.o fsl_ftm_shared_irqs.o fsl_interrupt_manager.o fsl_mcg_hal.o fsl_os_abstraction_bm.o fsl_pit_driver.o fsl_pit_hal.o fsl_pit_irq.o fsl_sim_clock_module_names_K22F51212.o fsl_sim_hal.o fsl_uart_driver.o fsl_uart_hal_common_configurations.o fsl_uart_hal_fifo_configurations.o fsl_uart_hal_interrupts_and_dma.o fsl_uart_hal_status_flags.o fsl_uart_hal_transfer_functions.o kv3xf_sim_pil_target.o main_init.o mcd_main.o rtiostream_utils.o startup.o sw_timer.o system_MK22F51212.o uart_init.o -specs=nosys.specs --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,kv3xf_sim_pil_target.map -o kv3xf_sim_pil_target.elf
c:/users/maciek/documents/matlab/add-ons/toolboxes/nxp_mbdtoolbox_s32k1xx/code/tools/gcc-arm-none-eabi-4_9/bin/../lib/gcc/arm-none-eabi/4.9.3/../../../../arm-none-eabi/bin/ld.exe: cannot open linker script file MKV3xF.ld: No such file or directory
collect2.exe: error: ld returned 1 exit status
gmake: *** [kv3xf_sim_pil_target.elf] Error 1
### Build procedure for model: 'kv3xf_sim_pil_target' aborted due to an error.
Error make_rtw: exception id RTW:buildProcess:fatalBuildError message Error(s) encountered while building "kv3xf_sim_pil_target"

but after unchecking box / building successfully / checking box again -> it builds without errors...

Is it expected behavior ? Or is it signalling future problems with PIL mode ?

Maciek

0 Kudos
912 Views
constantinrazva
NXP Employee
NXP Employee

Hello Maciek‌,

I took a look at what happened - in both KV3xf and KV4xf the linker files were not copied when you used PIL and GCC compiler; i fixed this issue and put the new files in the attached archive.

You should replace the following files:

1) {Root Folder}/mcd_kv3xf/mscripts/mcd_kv3xf_copy_required_files.p

2) {Root Folder}/mcd_kv4xf/mscripts/mcd_kv4xf_copy_required_files.p

3) {Root Folder}/mcd_kv4xf/mscripts/mcd_kv4xf_get_linker_file.p

Note: you might have folders named *mctbx_kv4xf* instead of *mcd_kv4xf*. In this case, the steps remain the same, but with different path names.

Please let us know if you encounter other issues or want help with something else.

Kind regards,

Razvan.

0 Kudos
912 Views
constantinrazva
NXP Employee
NXP Employee

Hi Maciek‌,

This is not the expected behavior. Thank you for reporting it to us in such a detailed manner. I will take a look and come back to you after I've figured out what's going on.

Kind regards,

Razvan.

0 Kudos