Skip to content

devmem : add file saving#10

Open
psolyca wants to merge 3 commits intokylemanna:masterfrom
psolyca:feature/file_saving
Open

devmem : add file saving#10
psolyca wants to merge 3 commits intokylemanna:masterfrom
psolyca:feature/file_saving

Conversation

@psolyca
Copy link
Copy Markdown

@psolyca psolyca commented Oct 22, 2020

Just a usefull thing for myself I share.

Feature added : As the title says, add the possibility to save the read values to a file.

@kylemanna
Copy link
Copy Markdown
Owner

I like the idea and the implementation looks clean!

I wonder though if it could be generalized a bit? What if it was updated to something like --binary and wrote to sys.stdout and the user could consider the following invocations:

Write to binary file:

$ devmem.py --binary -r 0x12345678 > file.bin

Write to another program for processing:

$ devmem.py --binary -r 0x12345678 | hexdump -C
$ devmem.py --binary -r 0x12345678 | path/to/memory_parser.py

This seems more flexible? What do you think?

@psolyca
Copy link
Copy Markdown
Author

psolyca commented Oct 24, 2020

Yes of course.
I did not think of this way.

Maybe it will work better, cause finally I had to make a C program to dump the memory of my platform, ARM Cortex-A9, cause this python script freeze and/or never finalize.
I have more than 19771544 bytes to dump, in C it is done in 4-5s.

@psolyca
Copy link
Copy Markdown
Author

psolyca commented Oct 25, 2020

@kylemanna Should be ok.

I have tested it and it works.
BTW, on my platform for 19771544 bytes long, I have a MemoryError on line 151.

@kylemanna
Copy link
Copy Markdown
Owner

I created MR #13 with a lot of improvements and a --binary output flag, can you check that out? I think it's also much faster.

Example using a file:

$ dd if=/dev/urandom count=1 bs=19771544 >! test2.bin
$ sha1sum test2.bin
2a69b263449ec99a5bcb04a670cd3b9b689d3f00  test2.bin
$ time (python3 -m devmem -s 4 -n 4942886 -r 0 -m test2.bin -b  | sha1sum )
2a69b263449ec99a5bcb04a670cd3b9b689d3f00  -

real    0.18s
user    0.15s
sys     0.04s

@kylemanna kylemanna self-assigned this Oct 26, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants