-
Notifications
You must be signed in to change notification settings - Fork 178
Create itm.md #413
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
Merged
Merged
Create itm.md #413
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
c78bcd7
Create itm.md
adab5a4
Complete initial copy edit of itm.md
0ac6a71
Added missing sections to itm.md
fdb4638
Copy edit itm.md
4eb983d
Add more details to itm.md
e3df420
Copy edit itm.md
9f098e2
Add link to itm.md
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
### Instrumented Trace Macrocell | ||
|
||
For targets with Arm CoreSight (for example, Cortex-M3 and Cortex-M4), the Instrumented Trace Macrocell provides a lightweight, nonintrusive way to collect debug trace output. | ||
|
||
#### Assumptions | ||
|
||
##### Defined behavior | ||
|
||
When the ITM has been initialized (by the SerialWireOutput class or other application), writing data to the ITM stimulus registers results in the ITM transmitting the data over the SWO line. | ||
|
||
##### Undefined behavior | ||
|
||
- The debug clock frequency is left undefined because the most optimal frequency varies by target. It is up to each target's owner to choose a frequency that doesn't interfere with normal operation and that the owner's preferred debug monitor supports. | ||
- If another peripheral tries to take control of the SWO pin, it is undefined whether that operation succeeds. | ||
|
||
##### Note | ||
|
||
Some SWO viewers do not allow an arbitrary frequency to be set. Make sure that the development tools you expect your users to use support the chosen frequency. | ||
|
||
#### Dependencies | ||
|
||
- The target supports Arm CoreSight. | ||
- The target has SWO connected either to a compatible interface chip or exposed as a debug pin. | ||
|
||
#### Implementing the ITM API | ||
|
||
[](https://os-doc-builder.test.mbed.com/docs/development/mbed-os-api-doxy/group__itm__hal.html) | ||
|
||
- You must implement the function `itm_init`. When the function is called: | ||
- The function must initialize the debug clock for the ITM. | ||
- The function must configure the SWO pin for debug output. | ||
- You must add `ITM` to the `device_has` section in `target.json`. | ||
|
||
It is not necessary to modify any of the ITM registers in `itm_init`, except for the one related to the clock prescaling, `TPI->ACPR`. The helper function `mbed_itm_init` is responsible for calling `itm_init` and initializing the generic ITM registers. `mbed_itm_init` only calls the function `itm_init` once, making it unnecessary to protect `itm_init` against multiple initializations. | ||
|
||
#### Testing | ||
|
||
You can use the `SerialWireOutput` to send `stdout` to the SWO stimulus port on the ITM by including this override function: | ||
|
||
``` | ||
#include "SerialWireOutput.h" | ||
|
||
FileHandle* mbed::mbed_override_console(int fd) | ||
{ | ||
static SerialWireOutput swo; | ||
return &swo; | ||
} | ||
``` | ||
|
||
You can place the function in any C++ compilation unit, including `main.cpp`. |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Does this API have spaces in it, or does it follow the same formatting as the others ("InstrumentedTraceMacrocell")?
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 don't understand the question. Instrumented Trace Macrocell is the name of the module like Low Power Ticker.
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 have the ResetReason API, which is has no space and both Rs capitalized because we're referring to the class. Is it the same with this?
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.
Ah, no. This is a physical component defined in the architecture: http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.ddi0314h/Chdegecg.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.
@marcuschangarm - Looks good, it would be great if you can add that ITM link in the documentation itself. Its not a blocker though, so I'll approve.