MinGW overrides other toolchains defined in System target file with Embedded Coder
5 次查看(过去 30 天)
显示 更早的评论
Hi,
I am currently working on a dsPIC project (Microchip) and am using the Microchip dsPIC Microcontrollers Support from Embedded Coder blockset (https://fr.mathworks.com/hardware-support/microchip-dspic.html) to generate code for my target.
I have also installed the MinGW-w64 plugin (<http://fr.mathworks.com/matlabcentral/fileexchange/52848-matlab-support-for-mingw-w64-c-c++-compiler>) that I used for other projects.
My Matlab version is R2015b.
But whenever I want to build a model for my specific target, no matter what, the building process will use the MinGW toolchain even if the correct "System target file" is selected in the "Code Generation" menu of the model parameters. And this System target file is working fine as soon as I remove the MinGW compiler from Matlab...
Here are the build outputs with the exact same model and the exact same parameters, with MinGW installed and uninstalled:
MinGW installed (notice the "### Using toolchain: MinGW64 v4.x | gmake (64-bit Windows)"):
33FJ256GP710A, 2 pins used.
- - - - - - - - - -
### Generating code into build folder: C:\Users\Arthur.Gaucher\Documents\StageI2T\Matlab\i2t_generic\i2t_generic.X
### Invoking Target Language Compiler on i2t_generic.rtw
### Using System Target File: C:\Program Files (x86)\Microchip\MatlabTools\blocks\MCHP_dsPIC_stf.tlc
### Loading TLC function libraries
### Initial pass through model to cache user defined code
### Caching model source code
### Writing main
### Writing MCHP_modelInclude.h
--- Single Tasking implementation ---
### Writing header file i2t_generic.h
### Writing header file i2t_generic_types.h
### Writing header file rtwtypes.h
### Writing source file i2t_generic.c
### Writing header file i2t_generic_private.h
.
### Writing source file i2t_generic_data.c
### Writing header file rtmodel.h
### Writing source file i2t_generic_main.c
### TLC code generation complete.
### Generating TLC interface API.
...### Creating HTML report file i2t_generic_codegen_rpt.html
### Creating project marker file: rtw_proj.tmw
### Using toolchain: MinGW64 v4.x | gmake (64-bit Windows)
### Creating 'C:\Users\Arthur.Gaucher\Documents\StageI2T\Matlab\i2t_generic\i2t_generic.X\i2t_generic.mk' ...
### Building 'i2t_generic': C:\PROGRA~1\MATLAB\R2015b\bin\win64\gmake -f i2t_generic.mk all
C:\Users\Arthur.Gaucher\Documents\StageI2T\Matlab\i2t_generic\i2t_generic.X>C:\PROGRA~1\MATLAB\R2015b\bin\win64\gmake -f i2t_generic.mk all
C:\MATLAB\SUPPOR~1\R2015b\MW_MIN~1\bin/gcc -c -ansi -pedantic -Wno-long-long -fwrapv -O3 -fno-loop-optimize -DONESTEPFCN=1 -DTERMFCN=0 -DMAT_FILE=0 -DMULTI_INSTANCE_CODE=0 -DINTEGER_CODE=0 -DMT=0 -DCLASSIC_INTERFACE=0 -DALLOCATIONFCN=0 -DTID01EQ=0 -DMODEL=i2t_generic -DNUMST=1 -DNCSTATES=0 -DHAVESTDIO -IC:/Users/Arthur.Gaucher/Documents/StageI2T/Matlab/i2t_generic/i2t_generic.X -IC:/Users/Arthur.Gaucher/Documents/StageI2T/Matlab/i2t_generic -IC:/PROGRA~1/MATLAB/R2015b/extern/include -IC:/PROGRA~1/MATLAB/R2015b/simulink/include -IC:/PROGRA~1/MATLAB/R2015b/rtw/c/src -IC:/PROGRA~1/MATLAB/R2015b/rtw/c/src/ext_mode/common -IC:/PROGRA~1/MATLAB/R2015b/rtw/c/ert -o "MCHP_UART2_Interrupt.obj" "MCHP_UART2_Interrupt.c"
In file included from MCHP_UART2_Interrupt.c:1:0:
i2t_generic.h:30:22: fatal error: p33Fxxxx.h: No such file or directory
#include <p33Fxxxx.h>
^
compilation terminated.
gmake: *** [MCHP_UART2_Interrupt.obj] Error 1
### Build procedure for model: 'i2t_generic' aborted due to an error.
Cannot propose to program chip from Matlab: Either file i2t_generic.elf does not exist or MPLAB X API is not available on this system.
* Visit the Microchip Blockset Forum for any questions, issues, share tricks.
* Visit the Microchip Wiki for further informations and examples.
-----------------------------------------------------------------------------------------
* MPLAB X project: i2t_generic.X then select the project folder
-----------------------------------------------------------------------------------------
***** Error detected. Links above are provided for debug purpose only (.elf file might not be current).
Error: Error(s) encountered while building "i2t_generic":
### Failed to generate all binary outputs.
MinGW uninstalled:
33FJ256GP710A, 2 pins used.
- - - - - - - - - -
### Generating code into build folder: C:\Users\Arthur.Gaucher\Documents\StageI2T\Matlab\i2t_generic\i2t_generic.X
### Invoking Target Language Compiler on i2t_generic.rtw
### Using System Target File: C:\Program Files (x86)\Microchip\MatlabTools\blocks\MCHP_dsPIC_stf.tlc
### Loading TLC function libraries
### Initial pass through model to cache user defined code
### Caching model source code
### Writing main
### Writing MCHP_modelInclude.h
--- Single Tasking implementation ---
### Writing header file i2t_generic.h
### Writing header file i2t_generic_types.h
### Writing header file rtwtypes.h
### Writing source file i2t_generic.c
### Writing header file i2t_generic_private.h
.
### Writing source file i2t_generic_data.c
### Writing header file rtmodel.h
### Writing source file i2t_generic_main.c
### TLC code generation complete.
### Generating TLC interface API.
...### Creating HTML report file i2t_generic_codegen_rpt.html
### Creating project marker file: rtw_proj.tmw
.
### Processing Template Makefile: C:\Program Files (x86)\Microchip\MatlabTools\mchp\MCHP_dsPIC.tmf
### Creating i2t_generic.mk from C:\Program Files (x86)\Microchip\MatlabTools\mchp\MCHP_dsPIC.tmf
### Building i2t_generic: "C:\Users\Arthur.Gaucher\Documents\StageI2T\Matlab\i2t_generic\i2t_generic.X\i2t_generic.bat"
C:\Users\Arthur.Gaucher\Documents\StageI2T\Matlab\i2t_generic\i2t_generic.X>"C:\Program Files\MATLAB\R2015b\bin\win64\gmake" -f i2t_generic.mk GENERATE_ASAP2=0 MCHP_AUTO_FLASH=0 MCHP_MULTITHREAD_COMPILATION=0 ISPROTECTINGMODEL=NOTPROTECTING
Compiling: MCHP_UART2_Interrupt.c
"C:/PROGRA~2/MICROC~1/xc16/v1.31/bin/xc16-gcc.exe" -c -mcpu=33FJ256GP710A -omf=elf -g -O3 -I. -I.. -IC:/PROGRA~1/MATLAB/R2015b/rtw/c/ert -IC:/PROGRA~1/MATLAB/R2015b/extern/include -IC:/PROGRA~1/MATLAB/R2015b/simulink/include -IC:/PROGRA~1/MATLAB/R2015b/rtw/c/src -IC:/PROGRA~1/MATLAB/R2015b/rtw/c/src/ext_mode/common -IC:/Users/Arthur.Gaucher/Documents/StageI2T/Matlab/i2t_generic/i2t_generic.X -IC:/Users/Arthur.Gaucher/Documents/StageI2T/Matlab/i2t_generic -IC:/PROGRA~2/MICROC~1/xc16/v1.31/include -IC:/PROGRA~2/MICROC~1/xc16/v1.31/support/dsPIC33F/h -IC:/PROGRA~2/MICROC~1/xc16/v1.31/support/generic/h MCHP_UART2_Interrupt.c -o MCHP_UART2_Interrupt.o
Options have been disabled due to restricted license
Visit http://www.microchip.com/ to purchase a new key.
Compiling: i2t_generic_data.c
"C:/PROGRA~2/MICROC~1/xc16/v1.31/bin/xc16-gcc.exe" -c -mcpu=33FJ256GP710A -omf=elf -g -O3 -I. -I.. -IC:/PROGRA~1/MATLAB/R2015b/rtw/c/ert -IC:/PROGRA~1/MATLAB/R2015b/extern/include -IC:/PROGRA~1/MATLAB/R2015b/simulink/include -IC:/PROGRA~1/MATLAB/R2015b/rtw/c/src -IC:/PROGRA~1/MATLAB/R2015b/rtw/c/src/ext_mode/common -IC:/Users/Arthur.Gaucher/Documents/StageI2T/Matlab/i2t_generic/i2t_generic.X -IC:/Users/Arthur.Gaucher/Documents/StageI2T/Matlab/i2t_generic -IC:/PROGRA~2/MICROC~1/xc16/v1.31/include -IC:/PROGRA~2/MICROC~1/xc16/v1.31/support/dsPIC33F/h -IC:/PROGRA~2/MICROC~1/xc16/v1.31/support/generic/h i2t_generic_data.c -o i2t_generic_data.o
Options have been disabled due to restricted license
Visit http://www.microchip.com/ to purchase a new key.
Compiling: i2t_generic_main.c
"C:/PROGRA~2/MICROC~1/xc16/v1.31/bin/xc16-gcc.exe" -c -mcpu=33FJ256GP710A -omf=elf -g -O3 -I. -I.. -IC:/PROGRA~1/MATLAB/R2015b/rtw/c/ert -IC:/PROGRA~1/MATLAB/R2015b/extern/include -IC:/PROGRA~1/MATLAB/R2015b/simulink/include -IC:/PROGRA~1/MATLAB/R2015b/rtw/c/src -IC:/PROGRA~1/MATLAB/R2015b/rtw/c/src/ext_mode/common -IC:/Users/Arthur.Gaucher/Documents/StageI2T/Matlab/i2t_generic/i2t_generic.X -IC:/Users/Arthur.Gaucher/Documents/StageI2T/Matlab/i2t_generic -IC:/PROGRA~2/MICROC~1/xc16/v1.31/include -IC:/PROGRA~2/MICROC~1/xc16/v1.31/support/dsPIC33F/h -IC:/PROGRA~2/MICROC~1/xc16/v1.31/support/generic/h i2t_generic_main.c -o i2t_generic_main.o
Options have been disabled due to restricted license
Visit http://www.microchip.com/ to purchase a new key.
Compiling: i2t_generic.c
"C:/PROGRA~2/MICROC~1/xc16/v1.31/bin/xc16-gcc.exe" -c -mcpu=33FJ256GP710A -omf=elf -g -O3 -I. -I.. -IC:/PROGRA~1/MATLAB/R2015b/rtw/c/ert -IC:/PROGRA~1/MATLAB/R2015b/extern/include -IC:/PROGRA~1/MATLAB/R2015b/simulink/include -IC:/PROGRA~1/MATLAB/R2015b/rtw/c/src -IC:/PROGRA~1/MATLAB/R2015b/rtw/c/src/ext_mode/common -IC:/Users/Arthur.Gaucher/Documents/StageI2T/Matlab/i2t_generic/i2t_generic.X -IC:/Users/Arthur.Gaucher/Documents/StageI2T/Matlab/i2t_generic -IC:/PROGRA~2/MICROC~1/xc16/v1.31/include -IC:/PROGRA~2/MICROC~1/xc16/v1.31/support/dsPIC33F/h -IC:/PROGRA~2/MICROC~1/xc16/v1.31/support/generic/h i2t_generic.c -o i2t_generic.o
Options have been disabled due to restricted license
Visit http://www.microchip.com/ to purchase a new key.
### BUILD_MODE real_time
"C:/PROGRA~2/MICROC~1/xc16/v1.31/bin/xc16-gcc.exe" -mcpu=33FJ256GP710A MCHP_UART2_Interrupt.o i2t_generic_data.o i2t_generic_main.o i2t_generic.o C:/PROGRA~2/MICROC~1/xc16/v1.31/lib/libpic30-elf.a C:/PROGRA~2/MICROC~1/xc16/v1.31/lib/libm-elf.a C:/PROGRA~2/MICROC~1/xc16/v1.31/lib/libc-elf.a C:/PROGRA~2/MICROC~1/xc16/v1.31/lib/libq-dsp-elf.a -o i2t_generic.elf -omf=elf -Wl,--script="C:/PROGRA~2/MICROC~1/xc16/v1.31/support/dsPIC33F/gld/P33FJ2~3.GLD",-t,--report-mem,-Map=info.map,-cref,--memorysummary,memoryfile.xml
c:\progra~2\microc~1\xc16\v1.31\bin\bin\..\bin/elf-ld.exe: mode pic30_elf32
MCHP_UART2_Interrupt.o
i2t_generic_data.o
i2t_generic_main.o
i2t_generic.o
(C:/PROGRA~2/MICROC~1/xc16/v1.31/lib/libpic30-elf.a)crt0_standard.o
(C:/PROGRA~2/MICROC~1/xc16/v1.31/lib/libpic30-elf.a)data_init_standard.o
(C:/PROGRA~2/MICROC~1/xc16/v1.31/lib/libpic30-elf.a)crt_start_mode_normal.eo
xc16-ld 1.31 (A)
Program Memory [Origin = 0x200, Length = 0x2aa00]
section address length (PC units) length (bytes) (dec)
------- ------- ----------------- --------------------
.text 0x200 0x14e 0x1f5 (501)
.const 0x34e 0x10 0x18 (24)
.text 0x35e 0x210 0x318 (792)
.dinit 0x56e 0x1a 0x27 (39)
Total program memory used (bytes): 0x54c (1356) <1%
Ivt Memory [Origin = 0x4, Length = 0xfc]
section address length (PC units) length (bytes) (dec)
------- ------- ----------------- --------------------
.ivt._T1Interrupt 0x1a 0x2 0x3 (3)
.ivt._U2TXInterrupt 0x52 0x2 0x3 (3)
Data Memory [Origin = 0x800, Length = 0x7800]
section address alignment gaps total length (dec)
------- ------- -------------- -------------------
.nbss 0x800 0 0xc (12)
.bss 0x80c 0 0x30 (48)
Total data memory used (bytes): 0x3c (60) <1%
Dynamic Memory Usage
region address maximum length (dec)
------ ------- ---------------------
heap 0 0 (0)
stack 0x83c 0x77c4 (30660)
Maximum dynamic memory (bytes): 0x77c4 (30660)
+++ Created executable: i2t_generic.elf
### Created i2t_generic.elf successfully (or it was already up to date)
-----------------------------------------------------------------------------------------
* Visit the Microchip Blockset Forum for any questions, issues, share tricks.
* Visit the Microchip Wiki for further informations and examples.
-----------------------------------------------------------------------------------------
* HTML report file: i2t_generic_codegen_rpt.html
-----------------------------------------------------------------------------------------
* MPLAB X project: i2t_generic.X then select the project folder
-----------------------------------------------------------------------------------------
* FLASH compiled model: i2t_generic.elf on chip 33FJ256GP710A
Flash after compilation: off switch: (on/off)
-----------------------------------------------------------------------------------------
### Successful completion of build procedure for model: i2t_generic
Build process completed successfully
Now you would tell me that I just need to remove the MinGW compiler but I need it in order to perform PIL simulation, as it needs to compile host-side and target-side parts of my model.
If you have any suggestion on what is going on when the MinGW compiler is enabled...
Thank you.
0 个评论
回答(3 个)
Akhilesh Mishra
2017-7-11
Please refer to the following documentation links - https://www.mathworks.com/help/releases/R2017a/rtw/ug/program-builds.html#btz8pmx https://www.mathworks.com/help/releases/R2017a/rtw/ref/toolchain.html
I believe that the Toolchain setting currently set is 'Automatically locate an installed toolchain' for your code generation parameters, which selects MinGW by default. Consider selecting the Toolchain manually based on the target and compiler settings.
0 个评论
Mohammed
2023-5-8
Hi Lovers,
i am working on a bachelor thesis with dspic33, i get almost same error. after marking a programm to my target, i am greeted with this message every time i want to make build, i ask you for a hint. In any case thank you.
0 个评论
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!