I am trying to program the S32K144EVB through Simulink using the NXP Model-Based Design Toolbox for S32K MCUs. I am on Matlab 2017b.
The installation seemed to be correct and the env variable has been set. When I created the simple model with the button and the LED it started to compile code and I got a Code generation report. But when it than tried to compile with the GCC compiler it gave me the following error:
C:\MATLAB\Add-Ons\Toolboxes\NXP_MBDToolbox_S32K1xx(2)\code\NXP_S32_Model_mbd_rtw>"C:\Program Files\MATLAB\R2017b\bin\win64\gmake" -f NXP_S32_Model.mk COPY_MDLREF_INCLUDES=0 ISPROTECTINGMODEL=NOTPROTECTING GENERATE_ERT_S_FUNCTION=0 INCLUDE_MDL_TERMINATE_FCN=1 COMBINE_OUTPUT_UPDATE_FCNS=1 MULTI_INSTANCE_CODE=0 INTEGER_CODE=0
Cleaning...
RELATIVE_PATH_TO_ANCHOR is ..
==== Removing object files from build directory ====
Copying necessary files to build directory...
Compiler details : "C:\MATLAB\Add-Ons\Toolboxes\NXP_MBDToolbox_S32K1xx(2)\code\tools\gcc-6.3-arm32-eabi/bin/arm-none-eabi-gcc" -c -mcpu=cortex-m4 -mthumb -mfloat-abi=hard -mfpu=fpv4-sp-d16 -O1 -g -gstrict-dwarf -DARM_MATH_CM4 -D__FPU_PRESENT=1 -D__FPU_USED=1 -D__NVIC_PRIO_BITS=FEATURE_NVIC_PRIO_BITS -o SetupFiles -DCPU_S32K144HFT0VLLT -I. -I.. -I.. -I"C:\Program Files\MATLAB\R2017b\simulink\include" -I"C:\Program Files\MATLAB\R2017b\extern\include" -I"C:\Program Files\MATLAB\R2017b\rtw\c\src" -I"C:\Program Files\MATLAB\R2017b\rtw\c\libsrc" -I"C:\Program Files\MATLAB\R2017b\rtw\c\src\ext_mode\common" -I"C:\Program Files\MATLAB\R2017b\rtw\c\src\ext_mode\tcpip" -I"C:\Program Files\MATLAB\R2017b\rtw\c\src\ext_mode\serial" -I"C:\Program Files\MATLAB\R2017b\rtw\c\src\ext_mode\custom" -IC:\MATLAB\Add-Ons\Toolboxes\NXP_MBDToolbox_S32K1xx(2)\code -IC:\PROGRA~1\MATLAB\R2017b\simulink\include\sf_runtime -IC:\MATLAB\Add-Ons\Toolboxes\NXP_MBDToolbox_S32K1xx(2)\code\NXP_S32_Model_mbd_rtw -IC:\MBCD\OSCAT_projects\NXP_S32\Model -I"C:\MATLAB\Add-Ons\Toolboxes\NXP_MBDToolbox_S32K1xx(2)\code\tools\gcc-6.3-arm32-eabi/arm-none-eabi/include" -I"./common" -I"./inc" -I"./src/clock/S32K1xx" -I"./src/sim/S32K144" -I"./src/power/S32K1xx" -I"./S32K144/include" -I"../common" -I"../inc" -I"../src/clock/S32K1xx" -I"../src/sim/S32K144" -I"../src/power/S32K1xx" -I"../S32K144/include"
Assembler details : "C:\MATLAB\Add-Ons\Toolboxes\NXP_MBDToolbox_S32K1xx(2)\code\tools\gcc-6.3-arm32-eabi/bin/arm-none-eabi-gcc" -c -mcpu=cortex-m4 -mthumb -mfloat-abi=hard -mfpu=fpv4-sp-d16 -g -x assembler-with-cpp -o SetupFiles
Product: NXP_S32_Model.mot
Build product type: executable
Building file startup_S32K144.o...
"C:\MATLAB\Add-Ons\Toolboxes\NXP_MBDToolbox_S32K1xx(2)\code\tools\gcc-6.3-arm32-eabi/bin/arm-none-eabi-gcc" -c -mcpu=cortex-m4 -mthumb -mfloat-abi=hard -mfpu=fpv4-sp-d16 -g -x assembler-with-cpp -o startup_S32K144.o startup_S32K144.s
gmake: *** [startup_S32K144.o] Error 1
### Build procedure for model: 'NXP_S32_Model' aborted due to an error.
Error(s) encountered while building "NXP_S32_Model"
I than went to the working directory and started the (**model.bat) batch file located in it. After i run that it gave me an error that libwinpthread-1.dll was missing and that reinstalling the software should fix this.
So i went to find the .dll located in:
C:\MATLAB\Add-Ons\Toolboxes\NXP_MBDToolbox_S32K1xx(2)\code\tools\gcc-6.3-arm32-eabi\bin
and copied it to the same location as were the batch file was located. So I rebuild the model (through Simulink) and it successfully downloaded the code to the board.
I know this is not how it is supposed to work. But for some reason it cannot find the .dll even when the env variable is set correctly. Any solution?