-
Notifications
You must be signed in to change notification settings - Fork 26
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
NRF52 debug tools update #297
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
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 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
This file contains 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
This file contains 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 @@ | ||
../../runners/embedded/artifacts/runner-nrf52-bootloader-nk3am.elf |
This file contains 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,25 @@ | ||
set pagination off | ||
set logging file gdb.txt | ||
set logging on | ||
|
||
set architecture arm | ||
set endian little | ||
set arm fallback-mode thumb | ||
set arm force-mode thumb | ||
set style enabled off | ||
file binary.elf | ||
target remote :3333 | ||
|
||
|
||
define stepinf | ||
while(1) | ||
p $msp | ||
step | ||
end | ||
end | ||
|
||
# Automatically start tracing upon reaching the following line | ||
# b transport.rs:181 | ||
# commands | ||
# stepinf | ||
# end |
This file contains 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,36 @@ | ||
from matplotlib import pyplot as plt | ||
|
||
""" | ||
Quickly graph gdb msp prints. | ||
|
||
rg -F "= (*mut ()) " gdb.txt > gdb.txt.stack | ||
|
||
Expected format is like: | ||
|
||
... | ||
$38057 = (*mut ()) 0x2001b478 | ||
$38058 = (*mut ()) 0x2001b478 | ||
... | ||
|
||
""" | ||
|
||
PATH = 'gdb.txt.stack' | ||
|
||
def main(): | ||
data = [] | ||
with open(PATH, 'r') as f: | ||
for line in f: | ||
num = int(line.split()[-1], 16) | ||
num = num - 0x20000000 | ||
num = num // 1024 | ||
data.append(num) | ||
|
||
print(len(data)) | ||
plt.plot(data) | ||
plt.ylabel('free stack memory left [kB]') | ||
plt.xlabel('sample no.') | ||
plt.show() | ||
|
||
|
||
if __name__ == '__main__': | ||
main() |
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.
What happens if there are multiple devices plugged?
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.
Both will be supplied as arguments probably (so the flashing should fail?). I did not consider this to be a use case, but perhaps you could provide the TTYDEV instead while calling Make, if you have multiple devices.
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 think it that case it should bail. Having multiple devices plugged while flashing is likely an 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.
I agree, but I do not want to support that. It's out of scope for me. What's the use case for having multiple bootloaders connected?
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.
Having multiple bootloaders connected is most likely an error and should abort.
It would be a nice to have safety feature.
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 understand the motivation, but I do not see how that can happen in the daily use, hence it looks like imaginary case for me, wasting time needlessly. As in, we do not check for free RAM memory or disk space either.
Can we fix that in another PR? Alternatively, I will be fine with a suggestion.
I do not think it can be done in one line (unless switching back to shell with some
tee
and pipes), so the count will have to be done separately on the actual use.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 could easily happen by mistake. Previously worst case scenario it would only flash one, now it would run a command with multiple unexpected arguments, so at least we should be aware of the consequence.
Another option would be to take only the first result of the wildcard with
$(world 1, $(TTYDEV))
: https://stackoverflow.com/questions/39674277/random-access-arrays-in-makefileThere 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.
It should abort, or otherwise we are not fixing the main problem this patch was meant to fix (to have a properly selected target device).
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.
nrf-builder
does it this way:The other solution for me would be to use
in nrf-builder
Actually
nrf-bootloader/upload.sh
already fail if it has more than 2 arguments, so the answer to my initial question was "it falis" which is a satisfying answer.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.