Jun 13, 2015

Generic Register Read Write 1.0


GRRW is a tool that allows read and write memory-mapped registers from Linux user-space, its syntax is simple:

./grrw
Usage:   ./grrw    <base_address>      <offset>  [value]
Read:    ./grrw    0x20200000          0x34
Write:   ./grrw    0x20200000          0x34      0x48027
The tool has x86 and ARM binaries, including static linked version to avoid dependencies and run easily. Below you can see some examples playing with x86 video ROM and some ARM SoCs like Broadcom, Nvidia and AllWinner:

x86

cat /proc/iomem 
...
000a0000-000bffff : PCI Bus 0000:00
  000a0000-000bffff : Video RAM area
000c0000-000c7fff : Video ROM
000ca000-000cbfff : reserved
...

Reading Video ROM:
./grrw_x86 0x000c0000 0x0
0xC0000 = 0xE940AA55

./grrw_x86 0x000c0000 0x4
0xC0004 = 0x724D0154

ARM (Nvidia Tegra 3 SoC - LG-P880 / Android 4.2.2)

Read GPIO3/PORT J status:
./grrw_arm_static 0x6000d000 204
0x6000D204 = 0x5F

ARM (Allwinner A20 SoC - Cubieboard / Cubian)

Set GPIO/PH15 pin:
./grrw_arm 0x01c20000 0x90c 0x8C079

Reset GPIO/PH15 pin:
./grrw_arm 0x01c20000 0x90c 0x80079

Read GPIO status:
./grrw_arm 0x01c20000 0x90c
0x1C2090C = 0x80079

ARM (Broadcom BCM2835 SoC - Raspberry Pi / Raspbian)

Configure GPIO4 as output:
 ./grrw_arm 0x20200000 0x0
0x20200000 = 0x48020
./grrw_arm 0x20200000 0x0 0x49020

Set GPIO4 pin:
./grrw_arm 0x20200000 0x34
0x20200034 = 0x1C1CF
./grrw_arm 0x20200000 0x1c 0x1C1DF

Reset GPIO4 pin:
./grrw_arm 0x20200000 0x28 0x10
Blink led on GPIO4:
while true; do ./grrw_arm 0x20200000 1c 0x1C1DF; sleep 1; ./grrw_arm 0x20200000 28 0x10; sleep 1; done
Watch GPIO register status:
while true; do ./grrw_arm 0x20200000 34; sleep 1; done

Download


Binary Size Architecture
grrw_x86 7.6k x86_32
grrw_x86_static 569k x86_32
grrw_arm 7.4k arm_32
grrw_arm_static 585k arm_32

0 comentários :

Post a Comment