-
-
Notifications
You must be signed in to change notification settings - Fork 398
Added support for advanced sketch "size" command #1211
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
Conversation
Please consider a recipe which just copies the advanced tool's stdout without any parsing. No JSON - just copy all the stdout text directly to the user interface. The usage case is more complex memory models, where a region of memory may be used in multiple ways. For example, if a memory region is 512K and can be segments into 4 different usages (eg, Cortex-M7 ITCM code, DTCM data, DMA-optimized data, and stack), this JSON approach would require using 4 lines which each show the same 512K region, giving users the mistaken impression that 4X as much memory exists. |
b6530f6
to
4e26adf
Compare
The
you can also omit the For eample this one arduino/ArduinoCore-mbed#256 (comment) leverage the Anyway, if you really need it I can change this PR to handle your use case, something like this:
|
closes #1514 |
Sorry, forgot about this until just recently... now that I'm finally working on updating Teensy software for arduino-cli. JSON format is fine. I can update my sizer utility to output JSON, and my Java patches to read JSON. Perhaps the JSON format should offer a way to send copies of the verbatim text in non-English languages? |
4e26adf
to
2941d46
Compare
It's the tool that should create the |
LANG environment variable is fine. |
I'm going to update my sizer code and start work on a Java patch to receive JSON. Going with this format. Hope it doesn't end up changing (much). |
I'm going to merge this PR as-is, only need to add docs... |
2941d46
to
0fd2b9f
Compare
Co-authored-by: Silvano Cerza <[email protected]>
Co-authored-by: Silvano Cerza <[email protected]>
Co-authored-by: per1234 <[email protected]>
Co-authored-by: per1234 <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a very cool enhancement. Thanks Cristian!
This PR adds a command-line recipe that the builder can use to obtain advanced statistics on sketch memory usage. This is especially useful for non-trivial memory layouts where the classic reg-exp based approach doesn't work well.
The proposed solution consists of a new recipe to the platform.txt:
recipe.advanced_size.pattern=...command line to run...
that, when present, is used instead of the previous
recipe.size.pattern=...
. The oldsize.pattern
may be left for backward compatibility.The command run in the
advanced_size
recipe should output the memory usage statistics in JSON format with the following syntax:The meaning of the fields is the following:
output
is a preformatted text that is displayed as-is in console.severity
indicates the warning level of the output messages, it can beinfo
,warning
orerror
. Warnings and errors are displayed in red (or in a different color than normal output). Errors will make the build/upload fail.sections
are a machine-readable representation of the memory sections and their usage level. It's an array of objects, each one representing a memory section. This array is used by thearduino-cli
to report memory usage when the--format json
output flag is set.Example:
the following change in the platforms.txt:
will produce the following output in the build:
When the
severity
is set toerror
the build/upload is interrupted and an exception is returned to the calling process. In this case an extra exception message must be provided through theerror
field, for example:This will produce the output:
Fix #480
/cc @PaulStoffregen