Difference between revisions of "Pci debug"
From ArmadeusWiki
(→Links) |
m (→Introduction) |
||
| Line 4: | Line 4: | ||
= Introduction = | = Introduction = | ||
| − | '''pci_debug''' is a | + | '''pci_debug''' is a useful tool meant to access PCIe BARx memory from userspace. |
= Buildroot configuration = | = Buildroot configuration = | ||
Revision as of 11:33, 17 March 2015
Introduction
pci_debug is a useful tool meant to access PCIe BARx memory from userspace.
Buildroot configuration
- Readline is required to install pci_debug :
Target packages --->
Libraries --->
Text and terminal handling --->
[*] readline
- Select pci_debug in armadeus tools :
Target packages --->
Armadeus specific tools/utilities --->
[*] pcidebug
- then build your bsp with make.
Using pci_debug
- First find your pci device name with lspci :
# lspci 00:00.0 PCI bridge: Device 16c3:abcd (rev 01) 01:00.0 Unclassified device [0013]: Altera Corporation Device e001 (rev 01)
For example here, we want to access altera pci device, then name is : 01:00.0
- Launch pci_debug with the BAR number in option (-b) :
# pci_debug -s 01:00.0 -b0
# ./pci_debug -s 01:00.0 -b0
PCI debug
---------
- accessing BAR0
- region size is 4194304-bytes
- offset into region is 0-bytes
? Help
d[width] addr len Display memory starting from addr
[width]
8 - 8-bit access
16 - 16-bit access
32 - 32-bit access (default)
c[width] addr val Change memory at addr to val
e Print the endian access mode
e[mode] Change the endian access mode
[mode]
b - big-endian (default)
l - little-endian
f[width] addr val len inc Fill memory
addr - start address
val - start value
len - length (in bytes)
inc - increment (defaults to 1)
q Quit
Notes:
1. addr, len, and val are interpreted as hex values
addresses are always byte based
PCI>
- You can then access BAR0 memory on PCI> prompt.
- Reading 0x20 values from address 0 :
PCI> d32 0 20 00000000: 12345678 12345678 12345678 12345678 00000010: 12345678 12345678 12345678 12345678 PCI>
Links
This tool come from an altera forum post, and the archive code can be found here.