• AVR Freaks

Hot!External mode heap size error in Blockset 3.45.02

Author
AnttiW
New Member
  • Total Posts : 9
  • Reward points : 0
  • Joined: 2019/08/11 21:52:15
  • Location: 0
  • Status: offline
2019/08/20 03:32:57 (permalink)
0

External mode heap size error in Blockset 3.45.02

The external mode is not properly configured in .MK file. "--heap" should be "_min_heap_size".
 
This blocks the code generation.
 
#------------------------------ Others dsPIC blockset parameters --------------
EXTMODE_DATA_UPLOAD = 1

OPTIM_GCC         =  -O0 -g
LDFLAGS         = -t,--report-mem,-Map=info.map,-cref,-flto,-O0,--memorysummary,memoryfile.xml,--heap=129
 
Any idea how to solve this? This comes from compiler options, but how to change this to correct one?
 
Best Regards Antti
post edited by AnttiW - 2019/08/20 04:12:59
#1

13 Replies Related Threads

    Lubin
    Moderator
    • Total Posts : 373
    • Reward points : 5
    • Joined: 2007/03/31 07:38:15
    • Location: Bayonne, France
    • Status: offline
    Re: External mode heap size error in Blockset 3.45.02 2019/08/20 04:08:15 (permalink)
    0
    Hi Antti,
     
    With dsPIC, "--heap" is used and with PIC32 "--defsym,_min_heap_size" should be used.
     
    Which chip do you target, which compiler version is used ?
    Could you share a model with this issue ?
     
    Thanks,
    Lubin
    #2
    AnttiW
    New Member
    • Total Posts : 9
    • Reward points : 0
    • Joined: 2019/08/11 21:52:15
    • Location: 0
    • Status: offline
    Re: External mode heap size error in Blockset 3.45.02 2019/08/20 04:34:38 (permalink)
    0
    Hello Lubin,
     
    I'm using PIC32MZ2048EFM on curiosity 2.0 board. Compiler is xc32 free edition and it's the latest available.
     
    The compiler is not visible on the block, it's just states it "x32 -v0.0". But in normal mode it selects the latest available compiler and the PIC is working correctly.
     
    The code generation indicates following:
    he value 'xc32 - v0.0' of the mask parameter 'COMP_LIST' for the block 'MCLV2_V/Compiler Options' is not valid.
     
    The model is now attached to first post. I tried to make a new model with fresh settings. Still it ends to "--heap" parameter. 
     
    Earlier blockset version made it correctly in Simulink 2017b. The reason to use newer blockset version is that PKOB 4 programmer is not found, which is in Curiosity 2.0 board.
     
    Do I miss some parameter or configuration?
     
    Best Regards Antti
     
     
     
     
    post edited by AnttiW - 2019/08/20 04:57:14
    #3
    Lubin
    Moderator
    • Total Posts : 373
    • Reward points : 5
    • Joined: 2007/03/31 07:38:15
    • Location: Bayonne, France
    • Status: offline
    Re: External mode heap size error in Blockset 3.45.02 2019/08/20 05:11:32 (permalink)
    0
    Hi Antti,
     
    Current xc32 release is repported as v0.0. This is a known issue which will be fix with other XC32 verison.
     
    It seems you spotted a bug. With your inputs  I should be able to track this down. 
     
    I think a heap is not required if you check the option "use static memory" in the external mode configuration panel.
    Maybe a workaround to test in the meantime.
     
    Lubin
    #4
    AnttiW
    New Member
    • Total Posts : 9
    • Reward points : 0
    • Joined: 2019/08/11 21:52:15
    • Location: 0
    • Status: offline
    Re: External mode heap size error in Blockset 3.45.02 2019/08/20 05:16:07 (permalink)
    0
    Hello Lubin,
     
    the static memory could not be checked as it's gray. Could it be forced from somewhere else?
     
    Antti
    #5
    Lubin
    Moderator
    • Total Posts : 373
    • Reward points : 5
    • Joined: 2007/03/31 07:38:15
    • Location: Bayonne, France
    • Status: offline
    Re: External mode heap size error in Blockset 3.45.02 2019/08/21 06:25:16 (permalink)
    0
    Hi Antti,
     
    I checked, static memory is available for dsPIC only. 
     
    The issue should be fixed. Could you give a try with a patched version available at: https://github.com/LubinKerhuel/MPLAB-Device-Blocks-for-Simulink/archive/Beta.zip
     
    I noticed you used the compiler -O0 option. That is for debug purpose. Please use -O1 (free) at least.
     
    Thanks,
    Lubin
    #6
    AnttiW
    New Member
    • Total Posts : 9
    • Reward points : 0
    • Joined: 2019/08/11 21:52:15
    • Location: 0
    • Status: offline
    Re: External mode heap size error in Blockset 3.45.02 2019/08/21 14:04:23 (permalink)
    0
    Hello Lubin,
     
    Thanks for really fast response! I tried this new blockset and there are couple of things which might be just different compared to Zynq / Arm support packages. I'm just not sure what should happen and what is wrong or ok. These notes are just what are differences between different support pakcages.
     
    1) Answering to originial question: now the model is translated and it could be flashed immedietely!
     
    Earlier the model was not translated, but somehow if there was some files (elf or something) the script continued just with warnings. End result was that mcu was flashed with wrong model. I think that this could be changed with compiler or script settings to stop if warnings are shown. It's difficult to see if model is changed and it's not what you see on the pc screen. In this model I used the leds to observe if the newer is compiled or not. But both cases it was re-flashed.
     
    2) If I change any parameter or for example manual switch state in the model, I have to save and close to simulink. Then again -> compile model -> and observe the behaviour.
     
    If I don't close the model, the results will something like:
    "### Build procedure for model: 'MCLV2_V' aborted due to an error.
    Project root folder is incorrect. Cannot generate MPLAB X project.
    Cannot propose to program chip from Matlab: Either file MCLV2_V.hex does not exist or MPLAB X API is not available on this system."


    Compared to other blockset I haven't seen same behaviour. Is this just what needs to do or is this something else?
     
    3) With fresh model when it's compiled, there will be available in blue text "ModelName.x" "then select the project folder."
     
    If I click this, then MPLAB will open, but every file is in same folder/view. I was just thinking that is there a feature which will open MPLAB in a way that source c coude is correct folder and header files are in different folder in MPLAB. Or should I do this manually?
     
    4) The model could be finally compiled and flashed to mcu, when running in the external mode. I could observe behaviour in scope window. But what is strange I could not change state for example manual switch in Simulink. The other blockset allows to change gains and switch, but this does not.
     
    I can debug the communication in real osciloscope that communication behaves correctly. But why the manual switch state change is not allowed in external mode?
     
    5) Finally I tried to go SIL mode. I did reset config and changed the parameter to SIL. Then re-opening the model.
     
    When tried to compile the model I got the message:
    ### Processing Template Makefile: C:\...\mchp\MCHP_pic32.tmf
    Error using setup_for_lcc (line 53)
    No supported compiler detected. A compiler is required by some simulation modes and the build process. Install a supported compiler. For options, see https://www.mathworks.com/support/compilers.

    After installing a supported compiler, restart MATLAB.


    Is there some parameters which is just not correct?
     
    What I can see with picInfo command is :
    >>picInfo
       - Blockset in C:\..MPLAB Device Blocks for Simulink(2)
     
       - Link to MPLAB X to program chip is Ok

      1 Compiler(s) found for 16 bits chip:
       - C:/Program Files (x86)/Microchip/xc16/v1.36
     
      1 Compiler(s) found for 32 bits chip:
       - C:/Program Files (x86)/Microchip/xc32/v2.20
    <--return
    Microchip Blockset 3.45.03 installed. See info and examples.
     
    And PIL compiling is stopped for this message.
     
    Best Regards Antti
    #7
    AnttiW
    New Member
    • Total Posts : 9
    • Reward points : 0
    • Joined: 2019/08/11 21:52:15
    • Location: 0
    • Status: offline
    Re: External mode heap size error in Blockset 3.45.02 2019/08/21 14:22:54 (permalink)
    0
    Hi, sorry for typhos. I just can't edit earlier message as this throws something like acces denied message.
     
    5) PIL mode, not SIL mode was the original question.
     
    -antti
     
    #8
    ric
    Super Member
    • Total Posts : 23598
    • Reward points : 0
    • Joined: 2003/11/07 12:41:26
    • Location: Australia, Melbourne
    • Status: online
    Re: External mode heap size error in Blockset 3.45.02 2019/08/21 16:46:36 (permalink)
    0
    AnttiW
    Hi, sorry for typhos. I just can't edit earlier message as this throws something like acces denied message.

    That is because your previous post contains a live URL, triggering the crappy firewall on this website.
    See: How to avoid errors when editing posts
     

    I also post at: PicForum
    Links to useful PIC information: http://picforum.ric323.co...opic.php?f=59&t=15
    NEW USERS: Posting images, links and code - workaround for restrictions.
    To get a useful answer, always state which PIC you are using!
    #9
    AnttiW
    New Member
    • Total Posts : 9
    • Reward points : 0
    • Joined: 2019/08/11 21:52:15
    • Location: 0
    • Status: offline
    Re: External mode heap size error in Blockset 3.45.02 2019/08/21 22:45:01 (permalink)
    0
    Some corrections:
     
    4) If needed tunable parameters or switch etc in real time:
     
     -> Configurations -> Optimization -> Default parameter behaviour -> "Tunable"
     
    This enables parameter changes when it's runnign.
     
    -antti
    #10
    Lubin
    Moderator
    • Total Posts : 373
    • Reward points : 5
    • Joined: 2007/03/31 07:38:15
    • Location: Bayonne, France
    • Status: offline
    Re: External mode heap size error in Blockset 3.45.02 2019/08/22 06:33:09 (permalink)
    0
    Hi Antti,
     
    1) The compilation stop on error and the chip is not flashed in such case.
    Warning provide information but is not a show stopper for the compilation. 
    If you have any doubt, you might clean-up the folder (from the Microchip menu at Simulink top)
     
    2) 4) Parameters including switch must be set as "tunable".
    Note that tunable parameters provide more constraint for the code optimization thus might be slightly slower and consume more memory.
     
    3) Open the project from MPLAB X, or use the Simulink Microchip top menu: "Open with MPLAB X" after having generated the code. (Tested with your model). .h and .c files are respectively in the MPLAB X header and source "folder". For project using using External Mode or PIL are missing some files which can be found in the MathWorks folder. The original purpose is to debug standalone project (not external mode nor PIL which are tricky to debug alongside Simulink from MPLAB X.)
     
    5) You migh thave to install MinGW (for Matab R2019a). Type mex -setup to check the compiler is properly installed
     
    Lubin
    #11
    AnttiW
    New Member
    • Total Posts : 9
    • Reward points : 0
    • Joined: 2019/08/11 21:52:15
    • Location: 0
    • Status: offline
    Re: External mode heap size error in Blockset 3.45.02 2019/08/22 23:31:51 (permalink)
    0
    Hi,
     
    thank you for reply. Some additional questions concerning PIL mode and MPLAB X project.
     
    1) I can see that in Simulink window Microchip  menu is "Open with MPLAB X", but it's gray. It's not possible to select. Same behaviour is in Simulink diagnostic viewer where is blue text: "xxx_project.X" then select the project folder.
     
    For some reason .X folder is not generated and when opening MPLAB then all the files are same folder.
    - Is there some Windows environmental parameter which should be changed?
     
    2) PIL mode. This might be related to previous question. I have installed and tested that MEX configurations are correct.  Now I got following message from diagnostic viewer:
     
    ...
    Internal checks disabled; compiler is not suited for release.
    Configure with --enable-checking=release to enable checks.
    ### BUILD_MODE pil_prebuild
    ### Created ObjectModules            
    ### Created ObjectModules             successfully (or it was already up to date)
    ### Build procedure for model: 'Uart_test' aborted due to an error.
    Project root folder is incorrect. Cannot generate MPLAB X project.
    Cannot propose to program chip from Matlab: Either file Uart_test.hex 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:            Uart_test.X then select the project folder
    -----------------------------------------------------------------------------------------
     ***** Error detected. Links above are provided for debug purpose only (.elf file might not be current).
    ### Unable to find build success text: "+++ Created" in build log.
     
    - Now it looks that MEX is working but some reason becomes again problem with .X folder.
    - What is wrong with project root folder or where to change it?
     
    Best Regards Antti
    #12
    Lubin
    Moderator
    • Total Posts : 373
    • Reward points : 5
    • Joined: 2007/03/31 07:38:15
    • Location: Bayonne, France
    • Status: offline
    Re: External mode heap size error in Blockset 3.45.02 2019/08/27 08:02:04 (permalink)
    0
    Hi Antti,
     
    I hit issues with recent matlab release when testing PIL. It is not solved so far. It is granted to work with R2017b and few version below.
     
    There was one issue which might cause the issue you encounter with MPLAB X project, affecting PIC32. 
    It is fixed and one example for external mode for PIC32MZ was added.
    Anyway, note that the MPLAB X project is intended to use with standalone project (i.e. not using External mode, nor PIL).
     
    use 3.45.04 or above:
    https://fr.mathworks.com/matlabcentral/fileexchange/71892-mplab-device-blocks-for-simulink-dspic-pic32-and-sam-mcu
     
    Lubin
     
    **edit: updated link to beta to current release including theses changes
    post edited by Lubin - 2019/09/17 01:54:13
    #13
    AnttiW
    New Member
    • Total Posts : 9
    • Reward points : 0
    • Joined: 2019/08/11 21:52:15
    • Location: 0
    • Status: offline
    Re: External mode heap size error in Blockset 3.45.02 2019/08/27 13:10:29 (permalink)
    0
    Hi,
     
    thanks for fast response! I tried new blockset, but I still didn't get mplab x project file when clicking on the diagnostic viewer. The files are still all in same folder.
     
    Best Regards Antti
    post edited by AnttiW - 2019/08/28 00:49:38
    #14
    Jump to:
    © 2019 APG vNext Commercial Version 4.5