-
Notifications
You must be signed in to change notification settings - Fork 38
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
bare_etiss_processor/get_metrics.py: Invalid stats for Stack/Heap usage since memory map refactoring #68
Comments
If also realized that using the |
See PRs #61 and #54 for longer reasoning behind this. In short: Requiring the RAM segment of the ELF file to be as long as the actual RAM is non-standard, breaking ETISS when ELF-files from projects where the linker behavior cannot be changed easily have to be used.
I would instead pass the total RAM size to the metrics script via command line, or implement a parser for the .ini files ETISS uses anyways. Remember, you can only read the minimum reserved stack/heap size from the ELF file and linker script, the actual usage has to be determined at runtime. Please do open a PR when you implement a solution. |
@PhilippvK since I also don't see a way to reliably get the memory layout from an arbitrary ELF file, I'd go with the suggestion to use the memsegs.ini file as input to this script. this should also be pretty simple to integrate in ml_on_mcu, since that file is already required for the etiss invocation anyways. |
@rafzi Yes, think we can go with that approach. Should the path to the memsegs.ini file be mandatory or should I define some defaults as a fallback? But even if we know the RAM size, the tracing of the Heap and Stack Usage is not so trivial as mentioned by @wysiwyng. Using the |
Defaults that are compatible with the ELFs from the examples here would be useful. For stack size, it would be nice not to rely on non-standard symbols like _min_stack, so that we are compatible with arbitrary ELFs. So I'd go for a 4K or 16K stack size default and if the user finds that this is fully utilized, he may configure it to be larger. |
The script
get_metrics.py
is useful to get information in the usage of memory in ETISS.I recently discovered that the reported stack usage is always zero and the heap non-zero instead. Here is an example:
Using the following
memsegs.ini
andMIN_STACK_SIZE=0x4000
:After having a look at the generated binary using
readelf
I figured out what is going on:The Memory size of the RAM memory segment is not equal to the specified RAM_SIZE anymore which leads to the fact that it’s value can not be used to figure out the end of the ram and therefore the start/end of the stack section.
See before…
… and after #61:
Therefore the following code in the aforementioned script is invalid:
A rather “hacky” workaround would be parsing the value of the symbol
VALUE_ram_size
similar to the way, thestackSize
andheapStart
is determined.The text was updated successfully, but these errors were encountered: