RedBearLab recommends Energia as a coding environment for that board. Energia is TI's spin-off of the Arduino IDE. Arduino lovers will feel at home, with one-click-to-run and the huge Arduino ecosystem. On the other hand, the IDE is quite limiting for power users - with inefficient multi-file support, lack of modern IDE features like code completion and lack of control of the compilation process. One additional problem is that the chip is pre-configured in a certain manner that may not suit all applications. For example, the pin mapping is fixed and cannot be changed.
Luckily, TI also provides Code Composer Studio - a full-blown, Eclipse based IDE that can be used to develop software for the CC3200, as well as other TI processors. Here's a step-by-step tutorial on how to set things up to get started with the development quickly and easily.
Step 1: Installation
In order to develop for the CC3200, several tools and packages have to be downloaded and installed:
- Code Composer Studio - When installing, make sure that all CC3200 stuff is marked for installation, including TI ARM compiler
- CC3200 SDK
- Uniflash (optional, but highly recommended, see below)
All the above tools are available both for Windows and Linux. One small exception is the CC3200 SDK, where only a Windows package is available. The solution is to install the package on a Windows machine and copy the whole directory tree to the Linux machine (see also here).
Two more recommendations - install everything in the default location (c:\ti), it will save a lot of time configuring search paths; on Linux - install the software locally, not as root.
Step 2: Importing the base project
I have created a boilerplate project that includes some very basic facilities that are required to get started with CC3200 programming. The project can be found on GitHub. In order to use it, the first step is to import it into CCS. This can be easily accomplished using the built-in git support. First, select "Import ..." from the file menu. Then, select "Projects from Git" and "Clone URI" at the next screen. At the URI input box in the next screen, type the repository's URI: https://github.com/avishorp/RBL_CC3200_CCS.git, select the (only) master branch, the local working directory, and finally check the project name.
Step 3: Building the project
If all the tools were set up correctly, building the project is a matter of clicking the "build" button. The relevant result of the project is the bin file <Proj. Name>.bin (in our case - RBL_CC3200_BASE.bin).
The project can be built either in Debug or Release configurations. Unless your'e using a JTAG adapter for debugging, the Debug configuration is useless, and should not be used. To change the active configuration, right click on the project name, select "Build Configurations", "Set Active" and then select the appropriate one.
Step 4: Programming
The CC3200 module contains a bootloader that enables programming using only a serial port (logic level USB to serial adapter), similar to the way Arduinos are programmed. The hardware I'm using is a small board that comes with RedBearLab's WiFi Micro Kit, but I think (not verified) that a regular USB-to-Serial will be sufficient.
There are two possible ways to program the device:
There are two possible ways to program the device:
- cc3200prog - This little program can be found in the Energia distribution (in hardware/tools/lm4f/bin). It is invoked from command line in the following way:
Note the "h" at the end of command line - without it the process fails! PORT is the COM port number in windows or the complete path to the tty device on Linux (for example /dev/ttyUSB0). BIN is the binary filename, generated in the previous step. This program is easy to use and works great, but from my experience it has a log of bugs. For example, it crashes when the binary filename includes underscores or spaces, and sometimes it just crashes in the middle of the process with no apparent reason. This instability plagues both the Windows and the Linux versions.
cc3200prog <PORT> <BIN> h
- Uniflash - Uniflash is a tool provided by TI. It has both a GUI and a CLI. It is much more flexible than cc3200prog - it can access and program not only the program image, but also auxiliary files that can be accessed later from the CC3200 firmware and are very handy for board-specific configuration. The downside of Uniflash is that it does not reset the board after it finishes its task - it has to be manually reset using the physical button. It's also not completely free of bugs as well - sometimes the programming task becomes very slow and goes on for a few minutes (instead of a few seconds) - but it's relatively rare.
After experiencing both methods above I would recommend using Uniflash for its stability and flexibility.
Understanding and Extending the base project
The base project is very minimal. It includes a console facility which can print messages to the serial port. The console is buffered and interrupt based, so it can be used freely without causing large unexpected delays in the program execution.
The pinmux is identical to the one provided in the WiFi Micro product documentation, but it can be change easily using TI's online pinmux utility, or its local version. The base project includes a CC3200.pinmux file which can be used as a base file and modified according to one's requirements.
The base project does not include any WiFi capability - TI provides a large collection of examples that are relatively easy to understand, copy and modify