jamesmunns

Doing embedded stuff

Be nice, work hard. Build tools, tell stories. Start five year fights. Kein Ort für Nazis.


A list of all the other services I'm on around the internet


Posts with code highlighted with codehost by @wavebeem.


All posts licensed under CC-BY-SA 4.0, unless otherwise stated.


Writing a little tool to peek and poke values to RAM. Here's my little end to end test ensuring it actually works :D

Edit: I'm reading and writing RAM to an nRF52, a 64MHz microcontroller with USB and 256KiB of RAM. The other 32KiB are running the application.

$ cat hound-of-the-baskervilles.txt | head -c 229376 > hound.bin

$ time target/release/stage0-cli peek -a 0x20000000 -l 229376 -f boop.bin
target/release/stage0-cli peek -a 0x20000000 -l 229376 -f boop.bin  0.02s user 0.06s system 8% cpu 0.891 total

$ cat boop.bin | head -c 128 | xxd
00000000: ffff ffff ffff ffff ffff ffff ffff ffff  ................
00000010: ffff ffff ffff ffff ffff ffff ffff ffff  ................
00000020: ffff ffff ffff ffff ffff ffff ffff ffff  ................
00000030: ffff ffff ffff ffff ffff ffff ffff ffff  ................
00000040: ffff ffff ffff ffff ffff ffff ffff ffff  ................
00000050: ffff ffff ffff ffff ffff ffff ffff ffff  ................
00000060: ffff ffff ffff ffff ffff ffff ffff ffff  ................
00000070: ffff ffff ffff ffff ffff ffff ffff ffff  ................

$ time target/release/stage0-cli poke -a 0x20000000 -f hound.bin
len: 229376
target/release/stage0-cli poke -a 0x20000000 -f hound.bin  0.04s user 0.04s system 8% cpu 0.940 total

$ time target/release/stage0-cli peek -a 0x20000000 -l 229376 -f boop.bin
target/release/stage0-cli peek -a 0x20000000 -l 229376 -f boop.bin  0.02s user 0.06s system 9% cpu 0.866 total

$ cat boop.bin | head -c 128 | xxd
00000000: 693b 3c4d 4253 263e 0a0a 0a0a 496e 0a0a  i;<MBS&>....In..
00000010: 0a0a 484f 554e 440a 0a0a 0a4f 4620 5448  ..HOUND....OF TH
00000020: 450a 4241 354b 4552 7969 4c4c 4553 0a0a  E.BA5KERyiLLES..
00000030: 0a0a 0a41 2e47 2e4a 2e0a 0a0a 0a43 4f4e  ...A.G.J.....CON
00000040: 414e 2044 4f59 4545 0a0a 0a0a 7269 0a0a  AN DOYEE....ri..
00000050: 0a0a 0a0a 0a0a 556e 6976 6572 7369 7479  ......University
00000060: 206f 6620 4361 6c69 666f 726e 6961 20e2   of California .
00000070: 80a2 2042 6572 6b65 6c65 790a 4769 6674  .. Berkeley.Gift

$ sha256sum *.bin
bad0e0a674772058f5d13400187367579244fcd0e9f0b34c8f6a2629ef74236c  boop.bin
bad0e0a674772058f5d13400187367579244fcd0e9f0b34c8f6a2629ef74236c  hound.bin
syntax highlighting by codehost

You must log in to comment.