November 28, 2013

pyOCD with KL25Z (introduction)

This is an introduction to pyOCD, my very first steps getting familiar with pyOCD. Two mbed users reported locking of their KL25Z chips with pyOCD. I hope we find out why!

The pyOCD used to be part of mbed github repository, but not anymore. It was separated, can be found here pyOCD repo [github.com/mbedmicro/pyOCD]. It has awesome readme file there, which serves as documentation.

the official mbed page for pyOCD Debuging from GDB using pyOCD [mbed.org/blog].

I started with pywinusb (using windows on my laptop), installed via easy_install.


The second step was to build pyOCD, run from the pyOCD root directory python setup.py install.


Connect KL25Z to your PC, be certain it has mbed interface! Time to start gdb session, either gdb from toolchain or from pyOCD. I chose to run gdb_test.py which is in pyOCD/test folder.


KL25Z detected, presume to flashing part. To be save, I opened basic_test.py located in test directory and commented out line 156 flash.flashBinary(binary_file). This prevents from flashing (locking alert which I explain later).


Everything went ok according to the console, flashing was skipped though. Now return the line 156 to test flashing part. Have ready compiled GCC program (I use bin file from the example I created for mbed GCC KL25Z demo).

If you run it without arguments, the default path is /binaries/l1_target.bin, the name of bin file for KL25Z is l1_kl25z.bin . Flashing was successful but program was not running correctly and chip got to secured state. I restarted gdb test script, received an error. I opened uVision, it displays a warning that chip is locked, but not permanently, fortunately! I have to get my prototype board, to continue with testing.

I'll share more once I explore what's going on and why chip got locked once.

Update 1st of December:
I have been debugging it for a while, I added some extra code which completely messed connection to the chip, gdb returned error. Once I found out what I did wrong, everything seems to be functional.
Even flashing different binaries does not lock chip, still using pyOCD scripts, not directly its gdb implementation.



November 21, 2013

KL46Z and KL05Z boards have CMSIS-DAP interface (update)


I have spent my last evenings with CMSIS-DAP, mostly with the interface layer. There has been some motion in CMSIS-DAP recently. The master branch already contains these 2 interfaces.

After porting mbed SDK to those 2 freedom boards, this was on my todo list as a final step. They should be tested, both SDK and also CMSIS-DAP, then enabled on mbed. Can't wait to see these 2 boards online.

I can come back to the freedom board K20D50M and its mbed SDK implementation. Also what I would like to do, start with pyOCD.

November 13, 2013

CMSIS-DAP interface and porting the new boards (news)

The CMSIS-DAP interface was published by mbed team 2 weeks ago. Here's the link
CMSIS DAP [github.com/mbedmicro]

The handbook for mbed firmware can be found at cmsis-dap-interface-firmware [mbed.org/handbook] . It explains the file structure plus some basics, not detailed implementation though, which is actually crucial. I really appreciate what mbed does and the way they do! To open and share with us this interface, takes a lot of effort.

I decided this week, to get familiar with it, attempt to add HAL for the other freedom platforms which are already supported on mbed github (KL05Z, KL46Z). This is the last step (testing will be carried out anyway) to enable them online. They need the mbed interface!

KL05Z is the first one I started. However, the code is commented, but not everything is clear, I have to do lot of guessing.. Thus KL05Z flashing by bin is not working yet, it returns SWD error which I located where it fails, have to examine why it fails and do some corrections.

If I succeed, I can share the testing version of that interface.

One side note: ARM GCC export for KL25Z will be available online soon! Can't share more at the moment, but I will !

November 6, 2013

cc3000 mbed - EthernetInterface (update)

Quick update, what's going to come to the host driver for cc3000 on mbed. We have been fixing few issues in the driver and implemented the new API (just an extension of the current one) which is easier to use. And mostly users with mbed will be familiar with it, because lot of net drivers are using the same API.

I pushed all these changes today, slowly updating all examples, you can currently check this change in the hello world demo, ntp client demo. There's some clean-up to do as well. The constructor for cc3000 was changed. That was the only change which broke the previous code in all demos, sorry.

I will post some updates about the mbed, I have added few more things there for the freedom platform. Also I attended the mbed connect meeting in San Jose. More to come!