Skip to content

Fixing sketch size calculation (text + ctors + rodata) #126

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from

Conversation

bbaltz505
Copy link
Contributor

Change the total sketch size calculation based on Sidney's explanation:

The arc-elf32-size.exe added in other sections to the total Sketch flash usage and that is not correct. The calculation should be the sum of text, ctor, and rodata sections. Need to correct the upload script to reflect that.

@bbaltz505
Copy link
Contributor Author

Size breakdown using arc-elf32-size:

section     size         addr
text       13136   1073954816
ctors         12   1073967952
rodata       440   1073967964
datas       3156   2818629632
bss         1916   2818632788
heap        8192   2818634704
stack       2560   2818642896
.comment     118            0
Total      29530
Sketch uses 13,588 bytes (6%) of program storage space. Maximum is 196,608 bytes.
Global variables use 5,072 bytes (61%) of dynamic memory, leaving 3,120 bytes for local variables. Maximum is 8,192 bytes.

@bbaltz505
Copy link
Contributor Author

According to Sidney Leung:

As for providing dynamic RAM usage, it is not a practical exercise. First of all, the Arduino platform does not have an OS on the ARC side. Thus, dynamic memory allocation is simply finding a large enough piece of memory from the Heap to use - that's done by malloc(). There is minimal amount of de-fragmentation processing in malloc - best it can do is to join two pieces of adjacent free-ed memory together into a larger piece. Therefore, the sum of unused/free-ed RAM is not the amount of memory available for malloc. This renders the efforts of returning available memory to user meaningless.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants