Tuesday, July 21, 2015

Setup Compile Environment on Windows Cygwin For CC2650/CC2538 Contiki 6LowPAN

The following step-by-step guide shows you how to setup compile environment on Win 7 Cygwin to build Contiki 6LowPAN For CC2650STK, CC2650DK, and CC2538DK.

1. Download and install Cygwin. During Cygwin installation, you have to stop at "Select Packages", put "make" in the seach box, and make sure you select make utility in Devel Category.



2. Install ARM GNU Compiler toolchain. Download and install gcc-arm-none-eabi-4_9-2015q2-20150609-win32.exe. It would be installed to C:\Program Files (x86)\GNU Tools ARM Embedded\4.9 2015q2 and you have to add the path of the installed ARM GNU compiler binaries to PATH environment variable in the Cygwin terminal. To do this, you can add the following line to .bashrc file.

export PATH=/cygdrive/c/Program\ Files\ \(x86\)/GNU\ Tools\ ARM\ Embedded/4.9\ 2015q2/bin/:$PATH

You have to restart Cygwin to enable PATH varibale and type "which arm-none-eabi-gcc" to confirm Cygwin uses correct arm-none-eabi-gcc version.

3. Download and install Msysgit from http://msysgit.github.io/. Remember to select "Use Git Bash only" during installion.





you also have to add the path of the installed Git binaries to PATH environment variable in the Cygwin terminal. To do this, you can add the following line to .bashrc file. You have to restart Cygwin to enable PATH varibale

export PATH=/cygdrive/c/Program\ Files/GNU/bin/:$PATH

4. Switch to C drive by run "cd /cygdrive/c/" under Cygwin. Then, run "git clone --recursive https://github.com/contiki-os/contiki"



5. To build cc26xx-web-demo for CC2650STK, run "cd /cygdrive/c/contiki/examples/cc26xx/cc26xx-web-demo/" and then "make BOARD=sensortag/cc2650 cc26xx-web-demo.bin".



6. After finishing, you will have cc26xx-web-demo.bin under C:\contiki\examples\cc26xx\cc26xx-web-demo

7. You can download cc26xx-web-demo.bin to CC2650STK by using TI Flash Programmer2.

8. For CC2538DK, you can do similar steps to make it work.

5 comments:

  1. This comment has been removed by the author.

    ReplyDelete
  2. 您好,

    你有没有encoundered一个问题与为.elf文件?我收到以下错误。

    LD cc26xx-web-demo.elf
    contiki-srf06-cc26xx.a(leds.o): In function `leds_init':
    leds.c:(.text.leds_init+0x2): undefined reference to `leds_arch_init'
    contiki-srf06-cc26xx.a(leds.o): In function `leds_on':
    leds.c:(.text.leds_on+0xa): undefined reference to `leds_arch_set'
    contiki-srf06-cc26xx.a(leds.o): In function `leds_off':
    leds.c:(.text.leds_off+0xc): undefined reference to `leds_arch_set'
    contiki-srf06-cc26xx.a(leds.o): In function `leds_toggle':
    leds.c:(.text.leds_toggle+0xa): undefined reference to `leds_arch_set'
    collect2.exe: error: ld returned 1 exit status
    ../../../cpu/cc26xx-cc13xx/Makefile.cc26xx-cc13xx:94: recipe for target 'cc26xx-web-demo.elf' failed
    make: *** [cc26xx-web-demo.elf] Error 1

    谢谢!

    ReplyDelete
  3. Hello, I am attempting this on Linux.

    The command #make BOARD=sensortag/cc2650 cc26xx-web-demo.bin gives me errors:

    c2650 cc26xx-web-demo.bin
    using saved target 'srf06-cc26xx'
    CC ../../../cpu/cc26xx-cc13xx/lib/cc26xxware/startup_files/ccfg.c
    In file included from ../../../platform/srf06-cc26xx/./contiki-conf.h:40:0,
    from :0:
    /usr/lib/gcc/arm-none-eabi/4.9.3/include/stdint.h:9:26: fatal error: stdint.h: No such file or directory
    # include_next
    ^
    compilation terminated.
    ../../../cpu/cc26xx-cc13xx/Makefile.cc26xx-cc13xx:107: recipe for target 'obj_srf06-cc26xx/ccfg.o' failed
    make: *** [obj_srf06-cc26xx/ccfg.o] Error 1

    ReplyDelete
  4. Your guide is helpful, but I found that things are easier using the new Ubuntu bash shell built into the latest version of Windows 10. I'll write up my own guide once I'm sure it's all working smoothly, but so far it looks like it's just:
    apt-get install gcc-arm-none-eabi
    apt-get install srecord

    ReplyDelete
    Replies
    1. OK - I got round to a guide.
      https://0xfred.wordpress.com/2016/11/27/6lowpan-part-2-building-contiki-on-windows/

      Delete