[SOLVED] Chosen heap size in SES doesn't get propagated to linkerfile

This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

  • [SOLVED] Chosen heap size in SES doesn't get propagated to linkerfile

    Using Segger 5.70a.

    I have a couple of issues regarding the heap size not being correctly propagated from the UI to the .emProject file.

    These are the 2 subtleties
    1. The location of the heap size directive within the .emProject file; and
    2. A refresh issue when the emProject file is viewed in the Segger Editor window.
    In my case, the first part of the Segger .emProject file contains the following lines:

    XML Source Code

    1. <!DOCTYPE CrossStudio_Project_File>
    2. <solution Name="keyboard_usb" target="8" version="2">
    3. <project Name="keyboard_usb">
    4. <configuration
    5. Name="Common"
    6. arm_architecture="v7EM"
    7. arm_core_type="Cortex-M4"
    8. arm_endian="Little"
    9. arm_fp_abi="Hard"
    10. arm_fpu_type="FPv4-SP-D16"
    11. arm_linker_heap_size="8192"
    12. arm_linker_process_stack_size="0"
    13. arm_linker_stack_size="8192"
    14. arm_linker_treat_warnings_as_errors="Yes"
    15. arm_simulator_memory_simulation_parameter="RWX 00000000,00100000,FFFFFFFF;RWX 20000000,00010000,CDCDCDCD"
    16. arm_target_device_name="nRF52840_xxAA"
    17. .
    18. .
    19. .
    Display All


    From a first load of Segger Embedded Studio, I go through the following steps:
    • Start SES (which automatically opens the last project).
    • View the .emProject file within Segger, where I can see “arm_linker_heap_size="8192"” under the Common configuration in the first part of the.
    • With the top tree node selected in the Project Explorer, Click the menu Project -> Options.
    • In the drop-down box of build configurations, select “Common” (I have Debug and Release build configurations).
    • In the Code tree node, select “Runtime Memory Area”.
    • Heap Size shows as 1024 bytes (the first clue we have a problem, as it shows as 1024 bytes for all Debug, Release or Common configurations selected in the drop-down list, despite .emProject file Common configuration setting this to 8192 bytes).
    • Set Heap Size to a different value, e.g. 32768. Value now shows as “modified”. Note the right-click menu changes to allow it to be re-set to “Use Inherited Value”, so Segger knows it’s overriding the inherited value.
    • Click OK.
    • From the File menu, save the project file. Click “Yes” to re-load the project when prompted.
    • Visual check of .emProject file shows no changes (arm_linker_heap_size="8192"). Checked both within Segger and with external editor.
    • Build project – Inspecting .ld file shows heap still at old 8,192 value.
    • Re-Build project - Inspecting .ld file shows heap still at old 8,192 value.
    Next issue – if the .emProject file is externally edited, Segger detects that the file has changed, and it prompts the user to re-load the project file. However, if the emProject file is also open in the editor in Segger at the same time, it does not refresh. The Segger editor window continues to display the old file content, despite Segger detecting the file has changed and re-loading the project file. Changing the window selection away from, and back to, the .emProject file does not show the updated file contents either. It shows the old version of the file. Within the Segger IDE, the .emProject file needs to be manually closed and re-opened to see the changes.
    If I remove the arm_linker_heap_size="8192" line from my .emProject file, Segger then builds using the default heap size of 1024 bytes. From that point forwards, things work normally. Manually setting the heap size from the project options menu all starts working as expected. Therefore, you did not encounter the issue. When specifying a different heap size from the Segger menu, the line “arm_linker_heap_size="32768"” is added to the .emProject file when the project file is saved, right at the very bottom of the project file:

    XML Source Code

    1. .
    2. .
    3. .
    4. <configuration Name="Release" c_preprocessor_definitions="NDEBUG" />
    5. <configuration Name="Debug" c_preprocessor_definitions="DEBUG;DEBUG_NRF" />
    6. <configuration
    7. Name="Common"
    8. arm_linker_heap_size="32768"
    9. macros="NRF_SDK_ROOT=C:\\SVN\\Tricklestar\\Keyboard\\sdk\\nRF5_SDK_17.1.0_ddde560;ACC_SDK_ROOT=C:\\SVN\\Tricklestar\\Keyboard\\acconeer_xm122" />
    10. </solution>
    Display All
    When a non-default heap size is specified within Segger, it is placing the directive in a different location within the .emProject file.
    To summarise, there are 2 points:
    1. Segger Embedded Studio does not seem to be correctly handling the “arm_linker_heap_size="8192" field in the project file. It may be related to the specific location of that line within the .emProject file. It seems that Segger will detect, and use, the value specified in the earlier part of the .emProject file, however the value set here does not interact with the Segger IDE user controls for setting that propery. It seems placing this value early in the .emProject file is overriding any settings the user may attempt to specify in the Segger IDE and there is no user feedback that this override is in place. Segger seems to be aware of the override, as manually setting a new value through the IDE shows the user visually that the new value is accepted, but the new value is not written to the .emProject file when the file is saved, and the new value is not used when the project is compiled. This is the crux of my heap size issue.
    2. Segger Embedded Studio has a refresh/reload issue relating to the .emProject file. When the file is changed, Segger detects it and re-loads the project file. However, if the .emProject file is open in the Segger Editor, it does not refresh the view of the file, showing the old content.
    Thanks,
    Ola

    The post was edited 1 time, last by ola1olsson ().

  • Hello Ola,

    Thank you for your inquiry.
    Under no circumstances should the .emProject file be edited manually via the internal or external editors.
    If you want to change project settings make sure to always use the GUI e.g. right click the project in project explorer and select Options.
    There you can find the heap setting under Code > Runtime Memory Area > Heap Size.
    Simply select the correct build configuration for which you want that option to have an effect for and then press OK.
    This will always work.

    Any other approach will not be supported by us.

    Best regards,
    Nino
    Please read the forum rules before posting.

    Keep in mind, this is *not* a support forum.
    Our engineers will try to answer your questions between their projects if possible but this can be delayed by longer periods of time.
    Should you be entitled to support you can contact us via our support system: segger.com/ticket/

    Or you can contact us via e-mail.
  • 1. I don't think you read my post. I was actually triggering the error by using the UI.
    The reason for editing the project file manually was to discover why using the GUI controls were not working. Editing the heap within the UI would not change the value in the generated linker script file and I was trying to understand why.

    2.If Segger don’t want users to edit this file manually, why is there a right-click menu item for that file called “Open Solution in Editor”? If they don’t want manual edits to be made, then this right-click menu should be changed to “View Solution in Editor”, and the file opened in a read-only format. The argument logic is not consistent.
  • Hello,

    1. The GUI controls are working. Make sure to do a rebuild of your project when changing linker properties.

    2. Because all tools and products we sell we use ourselves. And there are certainly situations where it can be useful to edit that file manually. But only if instructed by our support team.

    Best regards,
    Nino
    Please read the forum rules before posting.

    Keep in mind, this is *not* a support forum.
    Our engineers will try to answer your questions between their projects if possible but this can be delayed by longer periods of time.
    Should you be entitled to support you can contact us via our support system: segger.com/ticket/

    Or you can contact us via e-mail.