Friday, December 2, 2016

Using Contiki with linux CCS

Creating Contiki/CETIC based IPv6 border router solution (6LBR) with BeagleBone Black and using TI SensorTag2 with SLIP to connect 6LoWPAN mesh network is one thing. Debugging node from linux is another. Let's see how it works :)

Getting Contiki git repo and compiling web-demo for TI Sensortag in linux works quite well. Flashing it not so. Recommended way is to
transfer image to windows and flash from there, but it's possible to flash from linux commandline also. Using Code Composer Studio (CCS) makes job much easier, and you can also debug your code, at least in theory.

CCS can import project with makefile-style compiling (File -> Import -> C/C++ -> Existing Code as Makefile Project). Unfortunately it only can understand simple Makefile and Contiki uses include etc. Even when you can compile image, CCS will complain lot's of errors and warnings. It's quite bizarre situation. One way to 'fix' it, is defining things in makefiles to headers so CCS known what is actually defined when compiling. Like adding to project-conf.h:

/* for CCS as it can't detect this from Makefile.include */
#define NETSTACK_CONF_WITH_IPV6 1
/* CCS uses wrong button-sensor.h */
#ifndef BUTTON_SENSOR_VALUE_DURATION
#define BUTTON_SENSOR_VALUE_DURATION 1
#endif


Also finding source files can be a bit tricky. Adding whole contiki would be simple way so solve this but CCS don't like adding parent of project. Way around is adding links (to project) to needed subdirectories:
project -> properties -> c/c++ general -> Paths.. -> Source Location -> Link Folder
apps, cpu/cc26xx-cc13xx, core, platform/stf06-cc26xx
Also in c/c++ build -> settings you can enable gnu-versions of parsers.

You can also add Makefile.include from top, but it only makes editing easier (project -> Add Files -> Link).

Also you need to get debug-symbols to elf, so add Makefile:
CFLAGS+=-g
LDFLAGS+=-g

Nice. Now it doesn't complain and (most) code it shows is actually right one. To debug you need to create .ccxml target configuration file (project -> New).

Note that when you connected Debug DevPack to PC, it shouldn't have SensorTag2 connected to it. After board have booted (green led on) connect SensorTag2. Also when debugging first time, Debug DevPack firmware is updated to newest one.

Start debugger. Change Debug -> .ccxml -> Edit.. -> Program -> Cortex_M3_0 Project to project root and Program to .elf file. Check that run to symbol main is set. Next start of debug should then automagically load & run to main(). If it doesn't automatically load image to SensorTag2, you can choose Load & select elf.

Unfortunately good things stops there. For some reason JTAG connection to SensorTag2 seems to disconnect really often. Even dropping it's speed from 2.5MHz to 100kHz doesn't help :( This is probably due eclipse blocking and emulation package then misses something from JTAG/Debug DevPack. Hopefully future update fixes (some of) this.

Debugging active and ready to run
Jari Vanhala, Senior SW Designer, Ixonos

8 comments:

  1. is that same setting applicable for CCS in windows.
    Do i need make use of cygwin. kindly help me in this area if you know. i want to build example of contiki os for CC26XX launcpad

    ReplyDelete
  2. is there any way to compile whole contiki os in code composer studio

    ReplyDelete
  3. Sometimes the solution is easy, but cannot be seen because your focus is fixed on the symptoms or side-effects of a problem.https://iturbu.com

    ReplyDelete
  4. 안전보장+다양한플레이 먹튀검증 안전노리터 go

    ReplyDelete
  5. K Homes Realtors provides the Home Buying agents in Linden NJ for best home buying services. check out these services.

    ReplyDelete
  6. I must say that this is an excellent post, and I appreciate the details about Linux CSS. You expressly make reference to one of the issues raised during the 18 Years Scale discussion. Your arguments are so strong that I want to read more of your views. However, I'm looking for the cheap assignment writing service UK right now for a school assignment. I gain from this, and I finish my duty more swiftly. The vast material on the website is useful to all students.

    ReplyDelete
  7. As a school School Pickup and Drop Off in Dubai ovider in Dubai, we are committed to ensuring the safety, comfort, and convenience of students traveling to and from school. Our team of professional drivers are trained to adhere to strict safety protocols and are equipped with modern vehicles to ensure a smooth and hassle-free transportation experience for both students and parents.

    ReplyDelete
  8. Using Contiki with Linux CCS brings together the power of Contiki OS and the convenience of Linux CCS (Code Composer Studio) for embedded systems development. This combination offers developers a versatile and efficient platform for creating IoT applications. Whether it's building wireless sensor networks or implementing smart home solutions, leveraging Contiki with Linux CCS provides a cost-effective approach to developing reliable and scalable IoT solutions. With affordable web design services, businesses can showcase their Contiki-based IoT solutions and create visually appealing websites that effectively communicate the value and capabilities of their products or services.

    ReplyDelete