Eschewing the use of TI's Code Composer Studio for commandline tools, I am exploring the best workflow on Windows in that vein. To whit, I have the following build environment. Since I am a commandline guy, I opted to use Cygwin[1]. This provides a litany of familiar tools; I made sure to install all of my favorites.While I haven't personally tried it, I would be willing to bet that MinGW/MSYS[2] would work equally well. As I am a complete neophyte to ARM microprocessors and the Stellaris Launchpad, I based almost all of my effort here on the shoulders of others, notably Christian Jann[3] and Recursive Labs Blog[4].
To get things started with the Stellaris, you need to have a compiler, of course. I use a precompiled toolchain provided on the launchpad site by some ARM folks [5]. After extracting it, I added the bin directory to my .bashrc for access to my new arm-no-eabi-* tools, like so:
export PATH=/cygdrive/c/bin/gcc_for_arm:$PATH
I leave it as an exercise for the reader to figure out where I installed my toolchain :)
As an aside, I tried as well the summon-arm-toolchain[6] script. After letting it run for multiple hours (much longer than I experienced on a slower linux box), it seemed to build most tools but bombed on openocd. So my advice is save yourself the trouble and use the pre-compiled binaries.
With a toolchain in place, my next task is to build the TI-provided libraries and example source code, found in the StellarisWare download from TI's site[7]. Launching a cygwin window, I changed into the head directory of the StellarisWare install and issued a simple 'make' command, resulting in built libraries and example code.
With binaries available for flashing, the next step is to see if I can get the bugger uploaded via commandline. I had tried using TI's LMFlash tool[7], but for whatever reason, it was causing me issues. I decided to borrow the flashing tool lm4flash used by the cool Energia[8] project, particularly lm4flash, found in the energia-*\hardware\tools\lm4f\bin directory. I placed it in the same directory that I installed by ARM toolchain so cygwin would be able to find it easily.
The chip used in the Stellaris Launchpad falls under the LM4F120x1 family. If you installed StellarisWare in its default directory (C:\StellarisWare), then the binaries of interest for the Launchpad can be found in C:\StellarisWare\boards\ek-lm4f120x1 or in cygwin's parlance /cygdrive/c/StellarisWare/boards/ek-lmf4120x1.
I decided to try and load the examples built in StellarisWare. First up was the blinky project. I loaded the blinky.bin file found in the gcc directory (i.e., /cygwin/c/StellarisWare/boards/ek-lm4f102x1/blinky/gcc with the following command
lm4flash -v blinky.bin
Lo and behold, we have blinking lights. Attempting to restore the demo program shipped loaded (found in qs-rgb), it was as simple as changing again into the bin directory of qs-rgq and issuing
lm4flash -v qs-rgb.bin
Using the comm client PuTTY[9] to connect to the serial interface provided by the qs-rgb program, I was able to interact with it.
Next up is attempting to automate as much as possible for future project work, so I'm going to use a template program/makefile from Mauro Scomparin[10], and then work from within Vim for editing and build control. Note that because we are using Microsoft executables and not cygwin executables for the build tools, directories need to be in the form of MS file formats, e.g.,
#STELLARISWARE_PATH=/cygdrive/c/StellarisWare/ # No good for us! STELLARISWARE_PATH=c:/StellarisWare/
While I don't have a particular need for it, I will need to figure out debugging.
That's all for now...
[1] - http://cygwin.com
[2] - http://mingw.org
[3] -http://www.jann.cc/2012/12/11/getting_started_with_the_ti_stellaris_launchpad_on_linux.html
[4] - http://recursive-labs.com/blog/2012/10/28/stellaris-launchpad-gnu-linux-getting-started/
[5] - https://launchpad.net/gcc-arm-embedded
[6] - https://github.com/esden/summon-arm-toolchain
[7] -http://www.ti.com/tool/ek-lm4f120xl
[8] - http://energia.nu/
[9] - http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html
[10] - https://github.com/scompo/stellaris-launchpad-template-gcc/blob/master/Makefile
Cool, I've used Cygwin some time ago when working with STM32 microcontrollers, it would be really interesting if it is possible to compile OpenOCD under Cygwin (http://elinux.org/Compiling_OpenOCD_Win7) with ICDI support and than use it with arm-none-eabi-gdb from the command line to set a breakpoint? If you write a step for step tutorial than it might even land on hackaday, I will of course a a link under my guide if you get it working.
ReplyDelete