Getting a board from a distributor like Farnell/Element14/Mouser (add your own distributor) means that chances are high that the default firmware on it is written years from now because the inventory has not been updated, or because boards are still produced with that original firmware (because of testing?). So what happens if I use board with a firmware developed pre-Windows 8/10 area?
Freshly Unboxed NXP FRDM-KL25Z Board
It might work, but chances are high that the bootloader and firmware is not ready for the ‘modern age’, and as a result the board might be bricked. If you still have a Windows 7 machine around (I do!), you are lucky. If not, then you need to read this article….
I have been asked to provide a command line shell example for a bare-metal (no RTOS) application, so here we go!
Having a way to communicate to the firmware on a board is essential for most of my projects: it is simply, incredibly helpful and easy to do (see “A Shell for the Freedom KL25Z Board“). This tutorial shows how to add a simple command line shell to the NXP Freedom board which then can be extended as necessary.
There are plenty of different software packages available for microcontroller these days from all the silicon vendors. Finding a good software package is one challenge, getting what I really need is another one. Freescale is now part of NXP since December 2015, so this is probably the first release of the former Freescale part now as NXP: The NXP Kinetis SDK Version 2.0.
It comes with an interesting distribution way: instead of downloading huge packages with all-and-everything in it, I can build it ‘on demand’ online and get what I need, on demand from a web-based front end:
In “CodeWarrior Flash Programming from a DOS Shell” I showed how to program a device from the DOS shell. Because that example was for ColdFire and CodeWarrior for MCU10.2, here is the same for a Kinetis (FRDM-KL25Z) and CodeWarrior for MCU10.6. In my workspace (c:\tmp\wsp_10.6) I have a project folder (FRDM-KL25Z).
I’m using the ‘Flash Programmer’ to sneak the needed commands:
English is not my first language, but I use it in this blog because that way I can reach a broader audience. If I would use Swiss German, only a few would be able to understand what I write about: “Wänn I würd schwiizerdütsch bruuche, dänn chönt wohl chuum öpper das hie läse” ;-).
Google Translate is not prefect, but still it does a fair job of translating web pages. I have added now a Google translate button to this blog side bar. Click on it and have the web page translated to the language of your choice. Try it out:
This is Part 1 of a Mini Series. Manya has challenged herself to use the Adafruit NeoPixels (WS2812B RBG LEDs) with the Freescale FRDM-K64F board and the Kinetis SDK (see “Let’s play with Freescale FRDM-K64F“). I did a while back that with the FRDM-KL25Z board (see “NeoShield: WS2812 RGB LED Shield with DMA and nRF24L01+“). I used Processor Expert in my project (without the Kinetis SDK), and with this setup it is very easy. However, Manya wanted to do this with the Kinetis SDK and without Processor Expert. No surprise to me, she has found out that this setup with the Kinetis SDK and without the usage of Processor Expert is much more challenging (see “Not done yet!!“). I promised to Manya to give her a helping hand, so here we go! 🙂
Adafruit 8×8 NeoPixel Shield with Freescale FRDM-K64F Board
Key to successfully implementing embedded applications these days is to have detailed visibility into what is going on with the application on the board. For this, I’m using the FreeRTOS+Trace from Percepio to inspect the runtime behaviour. Stop-Mode debugging is very useful, but visibility into the runtime is even more important. FreeRTOS+Trace is a tool to accomplish this, but it requires to dump the data off the target to the host (see “Updated Percepio Tracealyzer and Trace Library to Version V2.7.0“). Usually, I’m using the GDB debugger for this, and that works for shorter trace sequences like a few seconds. Yes, I can combine them, but it painful to stop, dump and continue. So what if I could collect trace for several minutes or hours without the need to stop the application? Why not stream the data to the host directly?
So here is it: I’m now able to get almost unlimited trace streaming off the target, witout user intervention. I can trace my application for hours 🙂
There are cases where my application runs find for days, weeks or even months, but then from time to time there is an application crash. Yes, the watchdog will recover it, but still it would be good to know what happened? One solution would be to hook up a trace probe (like the one I have described in this post: “First Steps with the P&E Tracelink“). But having such a trace probe attached all the time is first not cheap and second not always possible. So what if the application would leave ‘breadcrumbs’ behind which would tell me the flow of the program leading to the problem? I have found a functionality in the GNU tools which seems not be widely known or use, but is incredibly helpful in such cases.
So what if I could get a log like this telling me which functions get called by whom?
For a home automation project I need to know the room temperature and humidity percentage of the room air. Adafruit has an inexpensive DHT11 sensor from http://www.aosong.com which I decided to use for that project.
If you are designing your own board for the Freescale FRDM boards, then having the matching PCB design files is a good thing to have. I have posted this week an Altium contribution on GitHub for the FRDM headers (see “FRDM-KL25Z Arduino Headers with Altium“). And here there is yet another contribution I received from [Darren]: the FRDM-KL25Z board in Altium :-):
Eclipse with GDB is great: it comes with a graphical front end for debugging. But sometimes it is all about to download a program. Is it really necessary to launch an IDE like Eclipse to program or quickly debug a board? With the GNU Debugger (GDB), the answer is ‘no’: GDB comes with a command line debugger which is designed exactly for this: providing a command line interface for programming/downloading and debugging, bypassing any GUI (Graphical User Interface).
Combination of GDB Debugging Probes and Boards (P&E, Segger and FRDM-KL25Z)
OpenOCD is an open source and free-of-charge debugging solution, which is a great option here at the University of Lucerne, as students do not need to buy an expensive debugging probe. Still, I recommend to buy professional probes like the P&E or Segger ones, as they are worth every (Euro) cent. But for a ‘zero’ budget, OpenOCD with CMSIS-DAP is something to consider. And with Kinetis Design Studio using the GNU ARM Eclipse Plugins, OpenOCD is not that hard to be used. And because both Freescale and GNU ARM Eclipse offer OpenOCD Windows binaries, that connection method is in the reach of Windows users too.