[SOLVED] Question for startup code debugging and memory code size

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

  • [SOLVED] Question for startup code debugging and memory code size

    Hi, I'm Matthew. I use

    - 64-bit SES 3.26 on 64-bit Windows 10

    - J-Link Plus or onboard J-Link (Nordic's dev kits have a J-Link on the board itself)

    - J-Link 6.16h

    - Nordic's PCA10040 v1.1.1 board (this board uses nRF52832-QFAA MCU)

    - STM32F4 Discovery board


    In the past, I used IAR EWARM 7 and Keil MDK 5.


    [img]http://www.jkelec.co.kr/img/lecture/arm_app/img/iar_23.png[/img]


    1.IAR provides an option called "Run to main". If this is unchecked, the debugger starts from the startup code.

    Does SES has a feature to start debugging from the startup code?

    2. After building the project, SES shows the memory usage and the debugger view show it in detail.




    How can I get the code size from SES after the build is complete?

    I use GCC and various optimization levels to I wish to compare the code size after building the project.


    -Best Regards
    -Best Regards, Matthew
  • Hi Matthew,


    Does SES has a feature to start debugging from the startup code?


    Yes, simply press F11 instead of F5 to start debugging.
    So you "step" into the debug mode.

    How can I get the code size from SES after the build is complete?


    You have several options here.
    - Memory usage window. Simply subtract Flashsize-Remainingsize, the same for ram and add the values together.
    - In the Output window you will bet the total of the used flash and ram for the project.
    - in the Project Explorer you will see iin the columns Code and Data how much of ceah is used total by each file.

    Best regards,
    Nino
    Please read the forum rules before posting: Forum Rules

    Keep in mind, this is not a support forum. Its main purpose is user to user interaction.
    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 contact us per e-mail.
    The following contact form can be used for this: Contact Us

  • SEGGER - Nino wrote:

    - in the Project Explorer you will see iin the columns Code and Data how much of ceah is used total by each file.

    Best regards,
    Nino
    Wow, Thanks, Nino! 2 last questions, please.

    1. About the "Code and Data" shown in the Project items columns,




    I noticed that the size shown in the output window and the Project items columns are different.

    See the red mark; Output shows the code size is 80.4KB whereas the column shows 75.7KB. The purple section is different too.

    Then, is the code size 80.4KB, which is shown in the Output window? This is quite confusing. ?(

    Also, the orange box, if I sum 51.2KB, 13.6KB and 23.7KB this exceeds 75.7KB. Does this mean that there are some source files that are not used for the building the project?

    Hope to hear your explanation, please!


    2. Lastly, I have the question related to the values.




    SES says that "main.c" size is 5.1KB and the output file shows the object files size.

    Is that code size different from the object file size? Maybe I have misunderstood the definition of "Code Size".

    Also, is the Data size of "main.c" means size of "Data + .bss variables"?

    [img]http://www.bravegnu.org/gnu-eprog/csections.png[/img]

    After your reply, my queries will be solved, let's close this!

    -Best Regards
    -Best Regards, Matthew

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

  • Hi Matthew,

    See the red mark; Output shows the code size is 80.4KB whereas the column shows 75.7KB. The purple section is different too.

    Then, is the code size 80.4KB, which is shown in the Output window? This is quite confusing. ?(


    The code size for each file includes all functions variables etc. even the unused ones. On project level you see the actual memory usage excluding unused functions for example.
    That is why that value is usually smaller.

    The difference to the Output memory usage window is because the memory usage can be split differently depending on what method is used to calculate the values.
    If you sum both values up you will notice that they are actually equal.
    75,7 + 13,4 = 80,4 + 8,7

    Best regards,
    Nino
    Please read the forum rules before posting: Forum Rules

    Keep in mind, this is not a support forum. Its main purpose is user to user interaction.
    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 contact us per e-mail.
    The following contact form can be used for this: Contact Us

  • SEGGER - Nino wrote:

    The difference to the Output memory usage window is because the memory usage can be split differently depending on what method is used to calculate the values.
    If you sum both values up you will notice that they are actually equal.
    75,7 + 13,4 = 80,4 + 8,7
    Oh, I see. Come to think of it, the startup code has code to copy the ".data" from Flash to RAM .

    [img]http://www.bravegnu.org/gnu-eprog/csections.png[/img]


    That calculation sure solved my mystery. Case complete! Thanks, Nino!

    -Best Regards
    -Best Regards, Matthew