I am trying to use the ARM gcc toolchain to program my NRF51822 mbed boards. Here's what I've done:
I've got Nordic's pyOCD branch from here, ARM gcc from here, and the mbed sdk from here. I'm running #! linux (debian-based).
In the mbed sdk workspacetools directory I have run
python build.py -m NRF51822 -t GCC_ARM
and it worked fine. I then ran
python build.py -m NRF51822 -t GCC_ARM -p 25
which seemed to successfully build MBED_BLINKY and put it in
/opt/mbed-api/build/test/NRF51822/GCC_ARM/MBED_BLINKY/
I then went to pyOCD and ran
jimi@horatio:/opt/pyOCD$ python
Python 2.7.3 (default, Mar 13 2014, 11:03:55)
[GCC 4.7.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from pyOCD.gdbserver import GDBServer
>>> from pyOCD.board import MbedBoard
>>> board = MbedBoard.chooseBoard()
id => usbinfo | boardname
0 => (0xd28, 0x204) [nrf51822]
>>> gdb = GDBServer(board, 3333)
I then went and connected to the gdb server with arm-none-eabi-gdb from the MBED_BLINKY directory:
jimi@horatio:/opt/mbed-api/build/test/NRF51822/GCC_ARM/MBED_BLINKY$ arm-none-eabi-gdb blinky.elf
GNU gdb (GNU Tools for ARM Embedded Processors) 7.6.0.20140529-cvs
Copyright (C) 2013 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "--host=i686-linux-gnu --target=arm-none-eabi".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /opt/mbed-api/build/test/NRF51822/GCC_ARM/MBED_BLINKY/blinky.elf...done.
(gdb) target remote localhost:3333
Remote debugging using localhost:3333
0x0000237e in ?? ()
Seems ok so far. I then try to load the program to the board by running 'load'. It seems to start working but then stops making progress. Currently, the status LED of the board is still flashing, and the gdb server and python are stuck like this:
(gdb) load
Loading section .text, size 0xd28 lma 0x16000
Loading section .ARM.exidx, size 0x8 lma 0x16d28
>>> gdb = GDBServer(board, 3333)
[====================] 100%
>>>
I have tried this with other test projects in the mbed SDK and with other boards, running the gdbserver myself in python and running the example gdb server scripts that came with pyOCD, and so far had the same result with each — they get to this point and then hang.
I am willing to consider the possibility that flashing a binary this way takes *ages*, but I have waiting almost an hour before pulling the plug and seen no progress. Am I not waiting long enough?
I think it's more likely that I have done something wrong. Have I forgotten to do something important, or made a mistake somewhere? Thanks in advance for any help or guidance!
EDIT:
Ok, after about an hour, I pressed the reset button on the board and this was the error python spat out (in case it's helpful):
>>> Exception in thread Thread-1:
Traceback (most recent call last):
File "/usr/lib/python2.7/threading.py", line 552, in __bootstrap_inner
self.run()
File "pyOCD/gdbserver/gdbserver.py", line 165, in run
[resp, ack, detach] = self.handleMsg(data)
File "pyOCD/gdbserver/gdbserver.py", line 227, in handleMsg
return self.flashOp(msg[2:]), 1, 0
File "pyOCD/gdbserver/gdbserver.py", line 416, in flashOp
self.target.resetStopOnReset()
File "pyOCD/target/target_nrf51822.py", line 60, in resetStopOnReset
while (self.getState() == TARGET_RUNNING):
File "pyOCD/target/cortex_m.py", line 600, in getState
dhcsr = self.readMemory(DHCSR)
File "pyOCD/target/cortex_m.py", line 388, in readMemory
return self.transport.readMem(addr, transfer_size)
File "pyOCD/transport/cmsis_dap.py", line 139, in readMem
[addr])
File "pyOCD/transport/cmsis_dap_core.py", line 204, in dapTransfer
raise ValueError('Transfer not completed')
ValueError: Transfer not completed
Could this be a problem with my system not giving it proper DAP access? (I have enabled non-root DAP access and tried running python as root but to no avail).
I am trying to use the ARM gcc toolchain to program my NRF51822 mbed boards. Here's what I've done:
I've got Nordic's pyOCD branch from here, ARM gcc from here, and the mbed sdk from here. I'm running #! linux (debian-based).
In the mbed sdk workspacetools directory I have run
and it worked fine. I then ran
which seemed to successfully build MBED_BLINKY and put it in /opt/mbed-api/build/test/NRF51822/GCC_ARM/MBED_BLINKY/
I then went to pyOCD and ran
I then went and connected to the gdb server with arm-none-eabi-gdb from the MBED_BLINKY directory:
Seems ok so far. I then try to load the program to the board by running 'load'. It seems to start working but then stops making progress. Currently, the status LED of the board is still flashing, and the gdb server and python are stuck like this:
I have tried this with other test projects in the mbed SDK and with other boards, running the gdbserver myself in python and running the example gdb server scripts that came with pyOCD, and so far had the same result with each — they get to this point and then hang.
I am willing to consider the possibility that flashing a binary this way takes *ages*, but I have waiting almost an hour before pulling the plug and seen no progress. Am I not waiting long enough?
I think it's more likely that I have done something wrong. Have I forgotten to do something important, or made a mistake somewhere? Thanks in advance for any help or guidance!
EDIT:
Ok, after about an hour, I pressed the reset button on the board and this was the error python spat out (in case it's helpful):
Could this be a problem with my system not giving it proper DAP access? (I have enabled non-root DAP access and tried running python as root but to no avail).