-
Notifications
You must be signed in to change notification settings - Fork 178
Docs for MemoryStats API, Debug API, Assert and Error APIs #310
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
Docs for MemoryStats API, Debug API, Assert and Error APIs #310
Conversation
Note that for Assert and Error functions there are no specific examples code/repo apart from usage example on the help docs. These are simple functions and does not require specific examples to demonstrate their usage and calling these puts the system in error state/stops execution. |
docs/reference/api/platform/Error.md
Outdated
@@ -1,5 +1,20 @@ | |||
## Error | |||
|
|||
The error function generates a fatal runtime error, which allows the user to dump a message to the serial line, halt the program and place the device in an idle mode with a blinking red LED. | |||
Mbed-OS provides an error function to output messages to STDIO at runtime when the system encounters a fatal error. Its declared in mbed_error.h. The function will output the error message when called for the first time, but will ignore subsequent calls without generating any output. |
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.
Might be worth adding that this function invokes exit - termination process .
Sidequestion: I do not remember why are subsequent calls ingored?
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.
Also conditionally compiled with NDEBUG macro (similar note is for assert above)
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.
That's good idea, to add the termination/NDEBUG note.
Currently error function internally uses a static variable which prevents further output if you call again.
docs/reference/api/platform/Error.md
Outdated
### Error usage example | ||
The code below uses error function to print a fatal error indicating out of memory condition. | ||
|
||
void *operator new(std::size_t count) |
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.
shouldn't this use code snippet syntax ?
// code here
### Assert example | ||
### Assert usage example | ||
|
||
MBED_ASSERT macro can be used for runtime evaluation of expressions. If the evaluation fails, an error message will be printed out to bash in the below format. Note that MBED_ASSERT macro is available in debug builds only. |
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.
I assume debug builds here means debug + develop profiles?
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.
Good question, I really thought its just debug builds. Let me confirm and update the docs.
9168762
to
ae65207
Compare
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.
I've reviewed Assert.md so far. Please review my changes to make sure I haven't accidentally changed the meaning of anything. Also, please address my comments and queries. I'll start on the other files tomorrow.
@@ -1,11 +1,33 @@ | |||
## Assert |
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.
Query: Should we change this to "mbed_assert" to match the macro name?
} | ||
``` | ||
|
||
You can use the `MBED_STATIC_ASSERT` macro for compile-time evaluation of expressions. If the evaluation fails, the passed in error message prints, and the compilation fails. |
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.
Query: This says "MBED_STATIC_ASSERT", but the paragraph below says "MBED_ASSERT_STATIC". Are these two separate macros, or is one incorrect?
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.
Good catch, its a typo, let me fix and others. thanks for the review.
[Add example(s) here.] | ||
You can use the `MBED_ASSERT` macro for runtime evaluation of expressions. If the evaluation fails, an error message prints to bash in the below format. Note that the `MBED_ASSERT` macro is available in the debug and develop build profiles but not in the release build profile. | ||
|
||
mbed assertation failed: <EVALUATED EXPRESSION>, file: <FILE NAME>, line <LINE NUMBER IN FILE> |
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.
Query: Should this be part of the code block that starts on line 17? If not, please put it in code format and give it some context.
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.
Hi Amanda, I fixed the comments but kept the heading as "Assert" since we are explaining the usage/purpose in the doc anyway, also I thought if we change to Mbed Assert, the same applies to many other places as well, so I thought we will keep the heading as Assert. Let me know if you think otherwise.
|
||
[Add example(s) here.] | ||
You can use the `MBED_ASSERT` macro for runtime evaluation of expressions. If the evaluation fails, an error message prints to bash in the below format. Note that the `MBED_ASSERT` macro is available in the debug and develop build profiles but not in the release build profile. |
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.
We may want to link to the build profiles page.
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.
I've reviewed Debug.md. Please review my changes to make sure I didn't accidentally change the meaning of anything. Please also address my comments and queries.
docs/reference/api/platform/Debug.md
Outdated
|
||
### Debug example | ||
|
||
[Add example here.] | ||
[](https://github.com/ARMmbed/mbed-os-example-platform-utils) |
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.
@sg- Should this be in the Mbed example teams folder like the other examples?
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 example program demonstrates MemoryStats and then have few things to demonstrate debug functions. That's why I have it as a separate example in its own repo. Does that make sense?
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.
Hi Sam,
Yeah, it makes more sense to move it to example teams folder. Ill do that, Thanks for pointing that out.
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.
Hi Sam, Looks like I need permission to publish to mbed_example. When I try to publish "mbed_example" is not showing as a option for me. Can you please add me to the mbed_example repo?
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.
what is your developer account name?
docs/reference/api/platform/Debug.md
Outdated
[Embed class reference here. If you've never done this before, please ask your editor.] | ||
[](https://os.mbed.com/docs/v5.6/mbed-os-api-doxy/group__platform__debug.html) | ||
|
||
### Debug functions usage |
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.
I like the content in this section, but this section breaks the standardization with the other APIs. Could we make it a second example or move some of the content up to the description area?
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.
I see, yes, we can move it to description area.
docs/reference/api/platform/Debug.md
Outdated
|
||
[Embed class reference here. If you've never done this before, please ask your editor.] | ||
[](https://os.mbed.com/docs/v5.6/mbed-os-api-doxy/group__platform__debug.html) |
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.
Query: Does this link work for you? I can't get it to work.
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.
Actually it doesn't work now, it depends on my other change coming into mbed-os side.
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.
I've copy edited the remaining two documents. Please review my edits to make sure I didn't accidentally change the meaning of any content. Please also address my queries and comments.
docs/reference/api/platform/Error.md
Outdated
@@ -1,5 +1,21 @@ | |||
## Error | |||
|
|||
The error function generates a fatal runtime error, which allows the user to dump a message to the serial line, halt the program and place the device in an idle mode with a blinking red LED. | |||
Mbed OS provides an error function to output messages to `STDIO` at runtime when the system encounters a fatal error and causes the application to terminate. `mbed_error.h` declares this error message. Note that the error function outputs the error message in debug and develop builds only. In release builds, the error function does not generate any output, but the application is still be terminated. |
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.
Query: Who or what terminates the application? Please clarify for active voice. [Note: I'll fix that extra "be" that I accidentally left in there after I know how to change the passive to active voice.]
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.
Good question, its the mbed-OS error function implementation that terminates the application.
docs/reference/api/platform/Error.md
Outdated
You can read more about the Error function in [its documentation](https://github.com/ARMmbed/mbed-os/blob/master/platform/mbed_error.h). | ||
### Error function reference | ||
|
||
[](https://os.mbed.com/docs/v5.6/mbed-os-api-doxy/group__platform__error.html) |
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.
Query: Does this link work for you? I see "Page error".
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.
Again, it depends on my other change coming into mbed-os side.
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.
Awesome. In the description of this PR, could you please list the mbed-os PR#s as dependencies?
[Add embedded class reference here. If you've never done this, please talk to your editor.] | ||
### MemoryStats functions reference | ||
|
||
[](https://os.mbed.com/docs/v5.6/mbed-os-api-doxy/group__platform__stats.html) |
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.
Query: Does this link work for you? I see "Page error".
|
||
### MemoryStats example | ||
|
||
[Add example here.] | ||
[](https://github.com/ARMmbed/mbed-os-example-platform-utils) |
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.
@sg- Should this be in the Mbed example teams folder like the other API examples?
Depends on - ARMmbed/mbed-os#5372 |
@@ -1,11 +1,15 @@ | |||
## MemoryStats | |||
|
|||
[Add description here.] | |||
Mbed OS provides a set of functions that you can use to capture the memory statistics at runtime. `mbed_stats.h` declares these functions. You can use memory statistics functions to capture heap usage, cumulative stack usage or stack usage per thread at runtime. To enable memory usage monitoring, you must build Mbed OS with the following macros. |
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.
There are some differences between tracing and stats. It would be good to call them out explicitly and explain how each would be used.
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.
Good catch, actually I shouldn't have mentioned MBED_MEM_TRACING_ENABLED at all. There is a separate requirement for writing "mem_trace functions" assigned to Martin. So let me clean this up and remove the references to MBED_MEM_TRACING_ENABLED. I think it should be captured in mem_trace docs, not here.
@SenRamakri What are the PR #s for the mbed-os repo dependencies? |
@AnotherButler It depends on PR ARMmbed/mbed-os#5372. Please see my comment from yesterday. |
Copy edit, mostly for active voice, parallelism and spelling.
Copy edit file, mostly for active voice and punctuation around restrictive clauses.
Copy edit for active voice, branding and consistent tense across docs.
Edit file for active voice, expansion of words and formatting.
c692cf1
to
bd3c432
Compare
@SenRamakri Is this ready to merge now, or are there any other dependencies or reviews we still need? |
This can be merged now as the dependency on mbed-os side is merged. |
No description provided.