pyOCD Binary Version
We have been working on creating an easier way for the mbed community to use the pyOCD library for programming and debugging the ARM® Cortex®-M microcontrollers using CMSIS-DAP. Here is an update on our work.
Driving force for this project:
The pyOCD library provided by mbed is quite powerful. However, installing it manually on an OS can be very time consuming and error prone. Multiple Python libraries need to be configured and the mixture of 32-bit and 64-bit Python libraries can be troublesome for those who are not very familiar with Python.
So the above circumstances have been the driving force for our embedded toolchain group to start such a binary release project. Our aim is to provide a stable and standalone gdb server based on pyOCD, which can be used directly along with our toolchain without any installation and configure.
Current development status:
We are now posting a weekly release on Launchpad. We have also established a daily test routine based on Jenkins to test the binary releases against NXP’s LPC1768 and Freescale’s FRDM-KL46Z platforms on Windows 7 32-bit/64-bit and Ubuntu 10.04 LTS.
Up till now, we have only supported Windows 7 and Linux because Mac OS has not been formally supported by pyOCD trunk. For the Linux release, we have only tested the pyOCD binary on debian based Linux distributions. We are looking for help to test on other Linux distributions and would greatly appreciate your feedback and help us out by reporting bugs to us. In addition, the build document to generate such a binary release has also been merged into pyOCD trunk on github, developers are welcomed to have a try by themselves and improve this document.
How to use it:
If you have never used pyOCD to debug your project before, this part will teach you how to use this binary version to accelerate your development.
Step 1: Preparing your project
- mbed already provides quite a few example projects based on different toolchains. Let’s export the blinky example using the ARM gnu embedded toolchain http://mbed.org/teams/mbed/code/mbed_blinky/export
- You can download the toolchain at https://launchpad.net/gcc-arm-embedded.
Step 2: Downloading your debug tool
- Download the correct variant of our binary release at https://launchpad.net/gcc-arm-embedded-misc/pyocd-binary/.
- Install gcc-arm-embedded, pyOCD binary and then unzip the example program
Step 3: Enjoying your debugging now!
- Run pyocd_win.exe/pyocd_linux [options]
We have already provided some flexible options like the server port number and board id to control the pyOCD, and feel free to add more useful options on the pyOCD trunk at /test/gdb_server.py!
Build your project with the arm gnu embedded toolchain, and launch the pyOCD and gdb at the cmd line:
make clean all arm-none-eabi-gdb *.elf <gdb> target remote localhost:3333 <gdb> load <gdb> continue
Advantages of the new pyOCD binary version:
- Ready to use: The binary release will save developers quite a bit of time when configuring the development environment. For a developer working with the mbed platform, using ARM gnu embedded toolchain along with the pyOCD binary release that are both hosted on Launchpad can help a developer to start their work at any time and with any PC with USB interface. This is currently the most powerful combination of open source tools.
- More powerful and flexible: Before this project, pyOCD only had a simple test case named ‘gdb_test.py’ to show the user how to use pyOCD as a gdb server, but actually the library provides more powerful function than the original test case presented. So a more powerful test case named ‘gdb_server.py’ was introduced to the pyOCD trunk; the binary release is also based on this test case. Although it is still under development, it has already begun to provide users with additional accessible options to control the behavior of the pyOCD.
- Brings more contributors to the pyOCD and mbed community: A bonus of this type of binary release is that it can help to increase the number of pyOCD users. With the now easier to use pyOCD binary release, more developers should have a try on this cool gdb server, which will also bring about more user demands, such as wanting a faster pyOCD or providing more functions. This kind of user number increase will definitely bring about more developer contributions on pyOCD and hopefully the whole mbed community.
Look into the future:
From my perspective pyOCD is still very young, but as it is newly designed based on python, it will have some unique advantages over other older debugging tools. Such a binary release project would be a good chance to see how pyOCD can step forward as a standalone debugging tool. As mbed is building its own ecosystem, it has already established its own cloud IDE, embedded OS, software framework, and also the debugging environment: CMSIS DAP + pyOCD. Therefore, a binary release project of pyOCD would also be a good starting point and chance for mbed to generalize the debugging interface of the entire ARM embedded target.