• AVR Freaks

Hot!slow XC16 compile with blockset v.3.46.03

Author
cooljustin
Starting Member
  • Total Posts : 64
  • Reward points : 0
  • Joined: 2010/11/13 00:32:55
  • Location: 0
  • Status: offline
2020/03/26 12:57:09 (permalink)
0

slow XC16 compile with blockset v.3.46.03

Hi,
 
I'm experiencing slow compile times when building the MCHP examples.  The model I am testing currently is Explorer1632_LCD.  It seems to build the Simulink model in good time, but when it begins to compile in XC16, it is very slow.  It seems to take about 1 second per line of text output to the diagnostic window, even when displaying stuff that should be very fast (like "printing" the compile summary at the end).
 
The total build time is around 4 minutes.
 
Samsung laptop
Gen 2 Core i7 quad core
12 GB ram
R2019b
XC16 v.1.50 (in "free" mode [max optimization=1])
blockset v.3.46.03
ICD3 connected, "flash after build" off
 
Any ideas, please?
 
Thanks,
Justin
#1

5 Replies Related Threads

    Lubin
    Moderator
    • Total Posts : 420
    • Reward points : 5
    • Joined: 2007/03/31 07:38:15
    • Location: Bayonne, France
    • Status: offline
    Re: slow XC16 compile with blockset v.3.46.03 2020/03/26 15:00:27 (permalink)
    0
    Hi Justin,
     
    For completness, below is the sum-up of our email discussion:
    Compilation process is usually faster than the code generation when the html report is activated with link to model etc... 
     
    The generated .X folder contains a <modelname>.bat file which allows to compile the .c file from a dos command.
    On your setup,
    - compiling from dos was fast.
    - compiling from the matlab command prompt using !<modelname>.bat command was fast either.
     
    - compiling with the diagnostic windows closed did not solved the speed issue (message are still beeing captured in the diagnostic windows anyway).
    It seems the compiler msg outputs captured in the diagnostic windows mechanism is the bottleneck.
     
    Could you try unchecking the multithread compilation in the compiler block ? Using only one CPU core for compilation might keep others core free to handle Maltab & Java underneath.
    #2
    cooljustin
    Starting Member
    • Total Posts : 64
    • Reward points : 0
    • Joined: 2010/11/13 00:32:55
    • Location: 0
    • Status: offline
    Re: slow XC16 compile with blockset v.3.46.03 2020/03/26 15:49:46 (permalink)
    0
    Thanks for adding the comprehensive history of this issue, Lubin.
     
    I had actually tried that before (disabling multithread compilation) but I tried it again, this time without the diagnostics window open.  It took about 15 seconds longer than with multithread enabled, so it doesn't seem to help.
     
    Is there anyway to disable the text output to the diag window completely (just as a test to see if it speeds it up)?
     
    #3
    Lubin
    Moderator
    • Total Posts : 420
    • Reward points : 5
    • Joined: 2007/03/31 07:38:15
    • Location: Bayonne, France
    • Status: offline
    Re: slow XC16 compile with blockset v.3.46.03 2020/03/27 03:40:08 (permalink)
    0
    cooljustinIs there anyway to disable the text output to the diag window completely (just as a test to see if it speeds it up)?

    Hi Justin,
     
    Replace the attached file in the mchp folder. (for v3.46.0x ONLY)
    Compilation output are redirected to a file "out.txt" in the .X folder.
     
    Compilation will always be notified as fail in the diagnostic windows even if it is ok.
     
    Check the out.txt file or check the timestamp of the binary file to make sure compilation is ok, and program the file using the Microchip->Flash from the  Simulink menu bar.
    Is compilation time any better?
     
    Lubin
    #4
    cooljustin
    Starting Member
    • Total Posts : 64
    • Reward points : 0
    • Joined: 2010/11/13 00:32:55
    • Location: 0
    • Status: offline
    Re: slow XC16 compile with blockset v.3.46.03 2020/03/27 06:17:17 (permalink)
    0
    Hi Lubin,
     
    Thanks for the update. Yes, that made a major difference!
     
    Build + compile times went from about ~3:40 to:
     
    Single thread: 1:06
    Multi thread: 1:17
     
    The weird thing is, when running in multi thread mode, it seems to produce an error that is not seen in single thread mode. Please see diag output below.
     
    Also, I tried to save the model with multithread and reopen it (to see if that made any difference in the compile times), but it would always open with single thread (even if it were saved in multi thread before).
     
    Single thread diag window output:

    ### Code generation artifacts for 'Explorer1632_LCD' were unpacked from 'C:\Users\xxxxx\Desktop\MPLAB-Device-Blocks-for-Simulink-master\MCHP_examples\Explorer1632_LCD.slxc'.
    Microchip Model Check before compilation
    The value 'xc16 - v1.50' of the mask parameter 'COMP_LIST' for the block 'Explorer1632_LCD/Compiler Options' is not valid.
    Component:Simulink | Category:Block warning
    Warning: Parameter define as Input: minutes not found in Function declaration
    Warning: Parameter value should be defined either as a block input or an output.
    Warning: Parameter define as Input: minutes not found in Function declaration
    Warning: Parameter value should be defined either as a block input or an output.
    The model has 7 discrete rates, which is greater than the 6 discrete sample time colors available. The 6th and slower rates have been marked using the orange sample time color.
    Component:Simulink | Category:Model warning
    Parameter precision loss occurred for 'Gain' of 'Explorer1632_LCD/ADC 10bit-value to Voltage'. The parameter's value cannot be represented exactly using the run-time data type. A small quantization error has occurred. To disable this warning or error, in the Configuration Parameters > Diagnostics > Data Validity pane, set the 'Detect precision loss' option in the Parameters group to 'none'.
    Component:Simulink | Category:Block warning Suppress
    ### Generating code and artifacts to 'Model specific' folder structure
    Code Generation 4 6
    Elapsed: 38 sec
    ### Generating code into build folder: C:\Users\xxxxx\Desktop\MPLAB-Device-Blocks-for-Simulink-master\MCHP_examples\Explorer1632_LCD.X
    The value 'xc16 - v1.50' of the mask parameter 'COMP_LIST' for the block 'Explorer1632_LCD/Compiler Options' is not valid.
    Component:Simulink | Category:Block warning
    Warning: Parameter define as Input: minutes not found in Function declaration
    Warning: Parameter value should be defined either as a block input or an output.
    Warning: Parameter define as Input: minutes not found in Function declaration
    Warning: Parameter value should be defined either as a block input or an output.
    The model has 7 discrete rates, which is greater than the 6 discrete sample time colors available. The 6th and slower rates have been marked using the orange sample time color.
    Component:Simulink | Category:Model warning
    Parameter precision loss occurred for 'Gain' of 'Explorer1632_LCD/ADC 10bit-value to Voltage'. The parameter's value cannot be represented exactly using the run-time data type. A small quantization error has occurred. To disable this warning or error, in the Configuration Parameters > Diagnostics > Data Validity pane, set the 'Detect precision loss' option in the Parameters group to 'none'.
    Component:Simulink | Category:Block warning Suppress
    ### Generated code for 'Explorer1632_LCD' is up to date because no structural, parameter or code replacement library changes were found.
    Problem while Creating MPLAB project. MPLAB Project skipped.
    .
    ### Processing Template Makefile: C:\Users\xxxxx\AppData\Roaming\MathWorks\MATLAB Add-Ons\Toolboxes\MPLAB Device Blocks for Simulink\mchp\MCHP_dsPIC.tmf
    Found legacy make variables |>START_MDLREFINC_EXPAND_INCLUDES<|, |>END_MDLREFINC_EXPAND_INCLUDES<|, |>MODELREF_INC_PATH<| in the template makefile C:\Users\xxxxx\AppData\Roaming\MathWorks\MATLAB Add-Ons\Toolboxes\MPLAB Device Blocks for Simulink\mchp\MCHP_dsPIC.tmf. The variables are no longer required. You can remove the variables. [3 similar]
    Component:Simulink | Category:Model warning
    ### C:\Users\xxxxx\Desktop\MPLAB-Device-Blocks-for-Simulink-master\MCHP_examples\Explorer1632_LCD.X\Explorer1632_LCD.mk which is generated from C:\Users\xxxxx\AppData\Roaming\MathWorks\MATLAB Add-Ons\Toolboxes\MPLAB Device Blocks for Simulink\mchp\MCHP_dsPIC.tmf is up to date
    ### Building Explorer1632_LCD: "C:\Users\xxxxx\Desktop\MPLAB-Device-Blocks-for-Simulink-master\MCHP_examples\Explorer1632_LCD.X\Explorer1632_LCD.bat" >> out.txt
    C:/Users/xxxxx/Desktop/MPLAB-Device-Blocks-for-Simulink-master/MCHP_examples/clib/Explorer1332_LCD_customCFile.c: In function 'PrintMinutes':
    C:/Users/xxxxx/Desktop/MPLAB-Device-Blocks-for-Simulink-master/MCHP_examples/clib/Explorer1332_LCD_customCFile.c:41:5: warning: incompatible implicit declaration of built-in function 'sprintf'
    C:/Users/xxxxx/Desktop/MPLAB-Device-Blocks-for-Simulink-master/MCHP_examples/clib/Explorer1332_LCD_customCFile.c: In function 'PrintSeconds':
    C:/Users/xxxxx/Desktop/MPLAB-Device-Blocks-for-Simulink-master/MCHP_examples/clib/Explorer1332_LCD_customCFile.c:49:5: warning: incompatible implicit declaration of built-in function 'sprintf'
    C:/Users/xxxxx/Desktop/MPLAB-Device-Blocks-for-Simulink-master/MCHP_examples/clib/Explorer1332_LCD_customCFile.c: In function 'PrintVoltage':
    C:/Users/xxxxx/Desktop/MPLAB-Device-Blocks-for-Simulink-master/MCHP_examples/clib/Explorer1332_LCD_customCFile.c:57:5: warning: incompatible implicit declaration of built-in function 'sprintf'
    C:/Users/xxxxx/Desktop/MPLAB-Device-Blocks-for-Simulink-master/MCHP_examples/clib/Explorer1332_LCD_customCFile.c: In function 'PrintTemperature':
    C:/Users/xxxxx/Desktop/MPLAB-Device-Blocks-for-Simulink-master/MCHP_examples/clib/Explorer1332_LCD_customCFile.c:69:5: warning: incompatible implicit declaration of built-in function 'sprintf'
    C:/Users/xxxxx/Desktop/MPLAB-Device-Blocks-for-Simulink-master/MCHP_examples/clib/Explorer1332_LCD_customCFile.c: In function 'PrintCPU':
    C:/Users/xxxxx/Desktop/MPLAB-Device-Blocks-for-Simulink-master/MCHP_examples/clib/Explorer1332_LCD_customCFile.c:78:5: warning: incompatible implicit declaration of built-in function 'sprintf'
    Problem while Creating MPLAB project. MPLAB Project skipped.
    -----------------------------------------------------------------------------------------
    * Visit the Microchip Blockset Forum for any questions, issues, share tricks.
    * Visit the Microchip Wiki for further informations and examples.
    -----------------------------------------------------------------------------------------
    * HTML report file: Explorer1632_LCD_codegen_rpt.html
    -----------------------------------------------------------------------------------------
    * MPLAB X project: Explorer1632_LCD.X then select the project folder
    -----------------------------------------------------------------------------------------
    * FLASH compiled model: Explorer1632_LCD.elf on chip 33FJ256GP710A
    Flash after compilation: off switch: (on/off)
    -----------------------------------------------------------------------------------------
    ### Successful completion of build procedure for model: Explorer1632_LCD
    Build process completed successfully

     
    Multi thread diag window output:

     
    ### Code generation artifacts for 'Explorer1632_LCD' were unpacked from 'C:\Users\xxxxx\Desktop\MPLAB-Device-Blocks-for-Simulink-master\MCHP_examples\Explorer1632_LCD.slxc'.
    Microchip Model Check before compilation
    The value 'xc16 - v1.50' of the mask parameter 'COMP_LIST' for the block 'Explorer1632_LCD/Compiler Options' is not valid.
    Component:Simulink | Category:Block warning
    Warning: Parameter define as Input: minutes not found in Function declaration
    Warning: Parameter value should be defined either as a block input or an output.
    Warning: Parameter define as Input: minutes not found in Function declaration
    Warning: Parameter value should be defined either as a block input or an output.
    The model has 7 discrete rates, which is greater than the 6 discrete sample time colors available. The 6th and slower rates have been marked using the orange sample time color.
    Component:Simulink | Category:Model warning
    Parameter precision loss occurred for 'Gain' of 'Explorer1632_LCD/ADC 10bit-value to Voltage'. The parameter's value cannot be represented exactly using the run-time data type. A small quantization error has occurred. To disable this warning or error, in the Configuration Parameters > Diagnostics > Data Validity pane, set the 'Detect precision loss' option in the Parameters group to 'none'.
    Component:Simulink | Category:Block warning Suppress
    ### Generating code and artifacts to 'Model specific' folder structure
    Code Generation [5 filtered] [6 filtered]
    Elapsed: 37 sec
    ### Generating code into build folder: C:\Users\xxxxx\Desktop\MPLAB-Device-Blocks-for-Simulink-master\MCHP_examples\Explorer1632_LCD.X
    The value 'xc16 - v1.50' of the mask parameter 'COMP_LIST' for the block 'Explorer1632_LCD/Compiler Options' is not valid.
    Component:Simulink | Category:Block warning
    Warning: Parameter define as Input: minutes not found in Function declaration
    Warning: Parameter value should be defined either as a block input or an output.
    Warning: Parameter define as Input: minutes not found in Function declaration
    Warning: Parameter value should be defined either as a block input or an output.
    The model has 7 discrete rates, which is greater than the 6 discrete sample time colors available. The 6th and slower rates have been marked using the orange sample time color.
    Component:Simulink | Category:Model warning
    Parameter precision loss occurred for 'Gain' of 'Explorer1632_LCD/ADC 10bit-value to Voltage'. The parameter's value cannot be represented exactly using the run-time data type. A small quantization error has occurred. To disable this warning or error, in the Configuration Parameters > Diagnostics > Data Validity pane, set the 'Detect precision loss' option in the Parameters group to 'none'.
    Component:Simulink | Category:Block warning Suppress
    ### Invoking Target Language Compiler on Explorer1632_LCD.rtw
    ### Using System Target File: C:\Users\xxxxx\AppData\Roaming\MathWorks\MATLAB Add-Ons\Toolboxes\MPLAB Device Blocks for Simulink\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
    .
    --- Multi Tasking implementation (Treat each discrete rate as separate task)---
    .
    ### Writing header file Explorer1632_LCD_types.h
    ### Writing header file Explorer1632_LCD.h
    ### Writing header file rtwtypes.h
    ### Writing source file Explorer1632_LCD.c
    .
    ### Writing header file Explorer1632_LCD_private.h
    ### Writing source file Explorer1632_LCD_data.c
    ### Writing header file rtmodel.h
    ### Writing source file Explorer1632_LCD_main.c
    ### TLC code generation complete.
    ### Generating TLC interface API.
    .................Problem while Creating MPLAB project. MPLAB Project skipped.
    .
    ### Processing Template Makefile: C:\Users\xxxxx\AppData\Roaming\MathWorks\MATLAB Add-Ons\Toolboxes\MPLAB Device Blocks for Simulink\mchp\MCHP_dsPIC.tmf
    Found legacy make variables |>START_MDLREFINC_EXPAND_INCLUDES<|, |>END_MDLREFINC_EXPAND_INCLUDES<|, |>MODELREF_INC_PATH<| in the template makefile C:\Users\xxxxx\AppData\Roaming\MathWorks\MATLAB Add-Ons\Toolboxes\MPLAB Device Blocks for Simulink\mchp\MCHP_dsPIC.tmf. The variables are no longer required. You can remove the variables. [3 similar]
    Component:Simulink | Category:Model warning
    COMPILATION using 9 thread.
    ### Creating C:\Users\xxxxx\Desktop\MPLAB-Device-Blocks-for-Simulink-master\MCHP_examples\Explorer1632_LCD.X\Explorer1632_LCD.mk from C:\Users\xxxxx\AppData\Roaming\MathWorks\MATLAB Add-Ons\Toolboxes\MPLAB Device Blocks for Simulink\mchp\MCHP_dsPIC.tmf
    ### Building Explorer1632_LCD: "C:\Users\xxxxx\Desktop\MPLAB-Device-Blocks-for-Simulink-master\MCHP_examples\Explorer1632_LCD.X\Explorer1632_LCD.bat" >> out.txt
    ### Creating HTML report file Explorer1632_LCD_codegen_rpt.html
    ### Build procedure for model: 'Explorer1632_LCD' aborted due to an error.
    Cannot propose to program chip from Matlab: Either file Explorer1632_LCD.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: Explorer1632_LCD.X then select the project folder
    -----------------------------------------------------------------------------------------
    ***** Error detected. Links above are provided for debug purpose only (.elf file might not be current).
    C:/Users/xxxxx/Desktop/MPLAB-Device-Blocks-for-Simulink-master/MCHP_examples/clib/Explorer1332_LCD_customCFile.c: In function 'PrintMinutes':
    C:/Users/xxxxx/Desktop/MPLAB-Device-Blocks-for-Simulink-master/MCHP_examples/clib/Explorer1332_LCD_customCFile.c:41:5: warning: incompatible implicit declaration of built-in function 'sprintf'
    C:/Users/xxxxx/Desktop/MPLAB-Device-Blocks-for-Simulink-master/MCHP_examples/clib/Explorer1332_LCD_customCFile.c: In function 'PrintSeconds':
    C:/Users/xxxxx/Desktop/MPLAB-Device-Blocks-for-Simulink-master/MCHP_examples/clib/Explorer1332_LCD_customCFile.c:49:5: warning: incompatible implicit declaration of built-in function 'sprintf'
    C:/Users/xxxxx/Desktop/MPLAB-Device-Blocks-for-Simulink-master/MCHP_examples/clib/Explorer1332_LCD_customCFile.c: In function 'PrintVoltage':
    C:/Users/xxxxx/Desktop/MPLAB-Device-Blocks-for-Simulink-master/MCHP_examples/clib/Explorer1332_LCD_customCFile.c:57:5: warning: incompatible implicit declaration of built-in function 'sprintf'
    C:/Users/xxxxx/Desktop/MPLAB-Device-Blocks-for-Simulink-master/MCHP_examples/clib/Explorer1332_LCD_customCFile.c: In function 'PrintTemperature':
    C:/Users/xxxxx/Desktop/MPLAB-Device-Blocks-for-Simulink-master/MCHP_examples/clib/Explorer1332_LCD_customCFile.c:69:5: warning: incompatible implicit declaration of built-in function 'sprintf'
    C:/Users/xxxxx/Desktop/MPLAB-Device-Blocks-for-Simulink-master/MCHP_examples/clib/Explorer1332_LCD_customCFile.c: In function 'PrintCPU':
    C:/Users/xxxxx/Desktop/MPLAB-Device-Blocks-for-Simulink-master/MCHP_examples/clib/Explorer1332_LCD_customCFile.c:78:5: warning: incompatible implicit declaration of built-in function 'sprintf'
     
    ### Unable to find build success text: "+++ Created" in build log.
     

     
    post edited by cooljustin - 2020/03/27 13:09:43
    #5
    cooljustin
    Starting Member
    • Total Posts : 64
    • Reward points : 0
    • Joined: 2010/11/13 00:32:55
    • Location: 0
    • Status: offline
    Re: slow XC16 compile with blockset v.3.46.03 2020/07/13 11:06:20 (permalink)
    0
    Hi Lubin,
     
    Would it be possible to add a switch to "send compile output to out.txt" or something in the upcoming blockset release?  Your solution in post #4 seems to have solved the compile time issue.
     
    Also, do you have any ideas as to why multi-thread produces errors?  I'd be happy to try anything you can think of.
    #6
    Jump to:
    © 2020 APG vNext Commercial Version 4.5