Recently, the subject of the Internet of things is becoming more and more hot - however, in most cases, when it comes to working with some basic hardware solutions, the conversation is reduced either to ready-made modules, or, less often, to production chips of previous years. Meanwhile, in 2015, Texas Instruments released another line of the system on the crystal CC13xx-CC26xx - extremely interesting in terms of the ratio of performance, power consumption and capabilities. These vipy have onboard the main core ARM Cortex-M3, the second core Cortex-M0, which exclusively serves the radio part, and ... yes, the third core is its own 16-bit TI core for working with peripherals, the so-called Sensor Controller. At the same time, the combine has turned out to be extremely modest in terms of power consumption - even the radio part has significantly reduced compared to the chips of the previous generation, CC2538.
We have already written a review of existing communication standards, which focused on the most modern standard 6loWPAN. This standard describes the network and transport layers of the OSI model, and the physical and link layers are standardized by IEEE 802.15.4. Texas Instruments took care of us, and gave the MAC-level processing to a separate core Cortex-M0. The remaining levels need to be processed on the Cortex-M3. And here we are come to the rescue by the real-time operating system Contiki, which implements support for the 6loWPAN stack.

')
However, the traditional problem with new chips is the lack of “collective experience,” that is, detailed descriptions of working with them, bypassing bugs and things like that.
Well, we will fill it. Let's start with the basic one - building and debugging the Contiki operating system for the CC2650 chips. Suppose we still love beautiful graphical environments and debugging in them. Therefore, we will build Contiki for TI Code Composer Studio 6. I use Ubuntu 14.04 X86_64 for development, the steps for Windows will be very similar, except for installing the toolchain. In the end there are some goodies ...
Toolchain
First you need to build a naked
Contiki repository. We pump out:
git clone --recursive https://github.com/contiki-os/contiki.git
We will collect using the GNU Make + GCC assembly system, which is native to the project. It is assumed that you already have Make, Windows drivers can put it in the composition of CygWin. Download
gcc-arm-none-eabi for the corresponding operating system and unpack it where it is convenient. Do not forget to register in the PATH!
wget https://launchpad.net/gcc-arm-embedded/4.9/4.9-2015-q3-update/+download/gcc-arm-none-eabi-4_9-2015q3-20150921-linux.tar.bz2 tar xz gcc-arm-none-eabi-4_9-2015q3-20150921-linux.tar.bz2 cd gcc-arm-none-eabi-4_9-2015q3 export PATH=$PATH:`pwd`/bin arm-none-eabi-gcc –v
Install the utility for bonding the
SRecord firmware needed for assembly.
sudo add-apt-repository ppa:pmiller-opensource/ppa sudo apt-get update sudo apt-get install srecord
Now we will try to collect the code. We go in and try to collect.
$CONTIKI_DIR
replace with your path. I usually
-jN
in 4 threads, the amount is regulated by the
-jN
parameter
cd $CONTIKI_DIR/examples/cc26xx make -j4 TARGET=srf06-cc26xx BOARD=srf06/cc26xx cc26xx-demo ls cc26xx-demo.srf06-cc26xx
Gathered, great, go ahead.
Firmware
One of the ways to fill the firmware on the chip itself is to use separate flashers. Texas offers a linux software
Uniflash , download and install. The installation process is well described in
this document ,
section 4.9 .
For debugging, I used the TI SRF06EB + CC2650 suite, so I will show it with his example. We create a new target configuration. The programmer with the chip must be already connected.

Go to
Programs , open the
Add firmware file and click
Program .

Everything, it would be possible to finish it, but sometimes in development you need to use debugging, so we go further.
Code Composer Studio
Download
TI Code composer Studio for Wireless Connectivity for your platform. For installation, I
strongly recommend using the
installation guide from the TI website.
- Run

- Go Files -> New -> Other ...
- Select Makefile Project With Existing Code

- Fill in the names, the path to the directory with Contiki and select Crocc GCC

- Go to the project settings -> C / C ++ Build , prescribe the build
make -j4 TARGET=srf06-cc26xx BOARD=srf06/cc26xx
and the path to the directory by clicking the Workspace button ...

- Build - assembled, intermediate victory!
Configuring debugging
For debugging it is necessary that the folder with Contiki files is in the working directory of CCSv6
- Click on the project with the right button -> add file -> Target Configuration File

- Choosing the XDS100v3 debugger and the CC2650 chip as in the screenshot

- Click in the form of Save and Test Connection

- Right-click on the newly created configuration -> Debug As -> Debug Configurations
- On the left we create a new configuration.
- Fill in the path to the newly created Target Configuration
- Apply

- In the Program tab, fill in the Project and Program fields - the path to the assembled firmware

- Apply
- Debug
- Gathered, flashed, but says No source available
- Open contiki / cpu / cc26xx-cc13xx / Makefile.cc26xx-cc13xx
- Add an assembly key with debugging symbols
CFLAGS += -g
- Remove optimization: change
-O2
and -Os
to -O0
- Save
- We go again in Debug Configurations
- Click Debug
- Voila

Now we have the opportunity to fully debug Contiki in Code Composer Studio under CC2650!
Conclusion
The described sequence of actions is almost the only working. On the way to this, a lot of time and nerves were spent, up to the time of contacting TI technical support. There is still the opportunity to use bare Eclipse as a medium, but my research has shown that this is a conditional working solution. I did not manage to start debugging in Eclipse, the problem was in the GDB server, which does not want to load the possibility of using hardware breakouts. If anyone wants to try, the path is described in document
TI SWRA446 .
See with eyes
On February 27, an offline
meeting of the Catethysis.ru blog will take place, at which I will tell and show this time how to program the MESH-network. All who read to the end, you are welcome!