Tuesday, January 23rd 2018, 8:46am UTC+1

You are not logged in.

  • Login
  • Register

Dear visitor, welcome to SEGGER Forum. If this is your first visit here, please read the Help. It explains how this page works. You must be registered before you can use all the page's features. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.

MatthewKyeo

Beginner

Date of registration: Jul 19th 2017

Posts: 49

1

Tuesday, October 24th 2017, 9:19am

[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.





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

SEGGER - Nino

Super Moderator

Date of registration: Jan 2nd 2017

Posts: 567

2

Tuesday, October 24th 2017, 9:38am

Hi Matthew,

Quoted


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.

Quoted

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

MatthewKyeo

Beginner

Date of registration: Jul 19th 2017

Posts: 49

3

Wednesday, October 25th 2017, 6:16am

- 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"?



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

-Best Regards

This post has been edited 1 times, last edit by "MatthewKyeo" (Oct 25th 2017, 6:18am)


SEGGER - Nino

Super Moderator

Date of registration: Jan 2nd 2017

Posts: 567

4

Wednesday, October 25th 2017, 9:29am

Hi Matthew,

Quoted

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

MatthewKyeo

Beginner

Date of registration: Jul 19th 2017

Posts: 49

5

Wednesday, October 25th 2017, 10:14am

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 .




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

-Best Regards