-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add script for remaining stack memory graphing
- Loading branch information
Showing
3 changed files
with
62 additions
and
0 deletions.
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
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() |