modify debugger/README

pull/1/head
samux 2013-03-19 16:43:57 +00:00
parent 318797a55e
commit 1faab40336
1 changed files with 57 additions and 64 deletions

View File

@ -28,33 +28,30 @@ What allows this library?
DEPENDANCIES: DEPENDANCIES:
------------- -------------
pyOCD relies on external libraries: pyOCD relies on external libraries:
* pyOCD has been tested with python 2.7 * pyOCD has been tested with python 2.7
* distutils * distutils
* Windows: [pyWinUSB](https://github.com/rene-aguirre/pywinusb):
* Windows: ```
1. [pyWinUSB](https://github.com/rene-aguirre/pywinusb) $ cd /path-to-pywinusb/
``` $ python setup.py install
$ cd /path-to-pywinusb/ ```
$ python setup.py install * Linux: [pyUSB](https://github.com/walac/pyusb):
``` ```
* Linux: $ sudo apt-get install python libusb-1.0-0-dev
2. [pyUSB](https://github.com/walac/pyusb): $ cd /path-to-pyusb/
``` $ sudo python setup.py install
$ sudo apt-get install python libusb-1.0-0-dev ```
$ cd /path-to-pyusb/
$ sudo python setup.py install
```
* Mac: * Mac:
So far Mac OS X is not supported
So far Mac OS X is not supported
Installation: Installation:
------------- -------------
```
$ cd /path-to-pyOCD/ $ cd /path-to-pyOCD/
$ python setup.py install $ python setup.py install
```
Examples: Examples:
--------- ---------
@ -69,60 +66,56 @@ A series of tests are on the test directory:
* gdb_test.py: launch a gdbserver * gdb_test.py: launch a gdbserver
## Hello World example: ## Hello World example:
```python
from pyOCD.board import MbedBoard
import logging from pyOCD.board import MbedBoard
logging.basicConfig(level=logging.INFO)
board = MbedBoard.chooseBoard() import logging
logging.basicConfig(level=logging.INFO)
target = board.target board = MbedBoard.chooseBoard()
flash = board.flash
target.resume() target = board.target
target.halt() flash = board.flash
print "pc: 0x%X" % target.readCoreRegister("pc") target.resume()
pc: 0xA64 target.halt()
target.step() print "pc: 0x%X" % target.readCoreRegister("pc")
print "pc: 0x%X" % target.readCoreRegister("pc") pc: 0xA64
pc: 0xA30 target.step()
target.step() print "pc: 0x%X" % target.readCoreRegister("pc")
print "pc: 0x%X" % target.readCoreRegister("pc") pc: 0xA30
pc: 0xA32 target.step()
flash.flashBinary("binaries/l1_lpc1768.bin") print "pc: 0x%X" % target.readCoreRegister("pc")
print "pc: 0x%X" % target.readCoreRegister("pc") pc: 0xA32
pc: 0x10000000 flash.flashBinary("binaries/l1_lpc1768.bin")
target.reset() print "pc: 0x%X" % target.readCoreRegister("pc")
target.halt() pc: 0x10000000
print "pc: 0x%X" % target.readCoreRegister("pc") target.reset()
pc: 0xAAC target.halt()
board.uninit() print "pc: 0x%X" % target.readCoreRegister("pc")
``` pc: 0xAAC
board.uninit()
##GDB server example: ##GDB server example:
Python: Python:
```python
from pyOCD.gdbserver import GDBServer
from pyOCD.board import MbedBoard
import logging from pyOCD.gdbserver import GDBServer
logging.basicConfig(level=logging.INFO) from pyOCD.board import MbedBoard
import logging
logging.basicConfig(level=logging.INFO)
board = MbedBoard.chooseBoard() board = MbedBoard.chooseBoard()
# start gdbserver # start gdbserver
gdb = GDBServer(board, 3333) gdb = GDBServer(board, 3333)
```
gdb server: gdb server:
```
arm-none-eabi-gdb basic.elf
<gdb> target remote localhost:3333 arm-none-eabi-gdb basic.elf
<gdb> load
<gdb> continue <gdb> target remote localhost:3333
``` <gdb> load
<gdb> continue
Architecture: Architecture: