Wednesday, March 29, 2017

Build TI Z-Stack Linux Home Gateway reference design for x86 Linux

The following steps show you hot to build TI Z-Stack Linux Home Gateway reference design for x86 Linux.

1. Download Z-Stack_Linux_Gateway-1.0.1-src-linux-installer.run from http://www.ti.com/tool/z-stack-archive.

2. Setup a 32 bit Ubuntu and run Z-Stack_Linux_Gateway-1.0.1-src-linux-installer.run to extract Z-Stack Linux Gateway source code to your Linux Home folder\Z-Stack_Linux_Gateway-1.0.1-src

3. Revise the build script package_builder_bbb (in red) under “your Linux Home folder\Z-Stack_Linux_Gateway-1.0.1-src\Source\scripts\”

...
#Target platform:
    #export TARGET_PLATFORM="BEAGLEBONE_BLACK"
    export TARGET_PLATFORM="x86"

...
    cd $NPI_SOURCE/Projects/tools/LinuxHost
    make clean
    make create_output
    #make arch-all-armBeagleBone CC_armBeagleBone=$COMPILER |& tee -a $MAKE_LOG_FILE
    make $BUILD_TYPE |& tee -a $MAKE_LOG_FILE

...
# *** Copy resources ***********************************************************************************

#cp $NPI_SOURCE/Projects/tools/LinuxHost/out/NPI_lnx_armBeagleBone_server $BINARIES_SERVERS_DIR/NPI_lnx_${PLATFORM_SUBSTRING}_server
cp $NPI_SOURCE/Projects/tools/LinuxHost/out/NPI_lnx_${PLATFORM_SUBSTRING}_server $BINARIES_SERVERS_DIR/NPI_lnx_${PLATFORM_SUBSTRING}_server


4.a Install protobuf by doing the following two apt-get install

       sudo apt-get install protobuf-c-compiler
       sudo apt-get install protobuf-compiler

4.b Create a new folder "tools" and export TCLIB to it using the following lines:
  
       cd ~
       mkdir tools
       export TCLIB=~/tools/

5. Switch to your Linux Home folder\Z-Stack_Linux_Gateway-1.0.1-src\Source\ and run ./build_all

6. The output will be at "your Linux Home folder\Z-Stack_Linux_Gateway-1.0.1-src\Source\ERROR_out\z-stack_linux_gateway_x86_binaries.tar". The build error is due to the lack of comparison file but the output binaries still work on x86 environment.

7. Copy and untar “z-stack_linux_gateway_x86_binaries.tar” to your working directory on x86 (called ). Please follow the (Z-Stack Linux Gateway User Guide.pdf, Chap 6.3) to start the application. Please note you have to specify x86 when you run zigbeeHAgw like "sudo ./zigbeeHAgw x86"

8. If you run it successfully, you will see the results like the following screen shot.


6 comments:

  1. Thank you for the post. I am getting errors from compiling app zstackpb/zstack.pb-c.c. See below for a example:

    In file included from ../zstackpb/zstack.pb-c.c:8:0:
    ../zstackpb/zstack.pb-c.h:11:1: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘typedef’
    typedef struct _AFAddr AFAddr;
    ^
    ../zstackpb/zstack.pb-c.h:498:3: error: unknown type name ‘AFAddr’
    AFAddr *dstaddr;

    So most of the executables in server folder is not build (except for NPI_lnx_x86_server). Please help.

    For protobuf, did you modify the path in build_all file? Also it doesn't really matter where you point TCLIB right? If seems that path just need to be specified.

    ReplyDelete
    Replies
    1. development evrionment should be ubuntu 32bit、 gcc 4.x、 bash

      Delete
  2. I have followed your guide. But it shows missing server files: file ZLSZNP_X86 is missing ...and other three such as OTA server. I do not know why they are missing. Maybe, does the PC need tool to rebuild the package? Looking forwards your reply. Thx!

    ReplyDelete
  3. This comment has been removed by the author.

    ReplyDelete
  4. Z-Stack_Linux_Gateway会发布新版本吗。毕竟现在这个版本是2014年的了

    ReplyDelete
  5. running zigbeegw.scr on an x86
    skipping zigbee reset
    Starting the ZigBee gateway subsystem
    deviceKey = 0 (0 )
    devPath = '/dev/ttyACM0'
    logPath = './NpiLnxLog.txt'
    connect: Connection refused
    ... freeing memory (ret -1)
    Could not open device... exiting
    NPI started (pid 2614) at Fri Dec 14 01:25:03 PST 2018
    connect: Connection refused
    [ZSTACKZNP_SRVR/MAIN] FATAL: appMain> Connection to NPI server failed. Exiting...
    ZLSZNP started (pid 2618) at Fri Dec 14 01:25:07 PST 2018
    [NWK_MGR/MAIN] : there are 2 args
    [NWK_MGR/MAIN] : argv[0] = ./NWKMGR_SRVR_x86
    [NWK_MGR/MAIN] : argv[1] = 127.0.0.1:2536
    connect: Connection refused
    [NWK_MGR/MAIN] : ************************************************
    [NWK_MGR/MAIN] : * Network Manager Server v1.0.1 *
    [NWK_MGR/MAIN] : * The following are the avaible key commands: *
    [NWK_MGR/MAIN] : * Exit Program. - q *
    [NWK_MGR/MAIN] : ************************************************

    [NWK_MGR/MAIN] : Error - No ZStack Server Detected. Exitting...
    NETWORK MANAGER started (pid 2622) at Fri Dec 14 01:25:08 PST 2018
    connect: Connection refused
    connect: Connection refused
    [GATEWAY/MAIN] :
    [GATEWAY/MAIN] : ************************************************
    [GATEWAY/MAIN] : * Gateway Server v1.0.1 *
    [GATEWAY/MAIN] : * The following are the avaible key commands: *
    [GATEWAY/MAIN] : * Exit Program. - q *
    [GATEWAY/MAIN] : ************************************************

    [GATEWAY/MAIN] : Error - No ZStack Server Detected. Exiting...

    GATEWAY SERVER started (pid 2629) at Fri Dec 14 01:25:10 PST 2018
    connect: Connection refused
    connect: Connection refused
    [OTASRVR/MAIN] :
    [OTASRVR/MAIN] : ************************************************
    [OTASRVR/MAIN] : * OTA Upgrade Server 1.0.1 *
    [OTASRVR/MAIN] : * The following are the avaible key commands: *
    [OTASRVR/MAIN] : * Exit Program. - q *
    [OTASRVR/MAIN] : ************************************************

    [OTASRVR/MAIN] :
    Error - No ZStack Server Detected. Exiting...

    OTA SERVER started (pid 2633) at Fri Dec 14 01:25:12 PST 2018
    starting tracker with our pid ./zigbeeHAgw and pid list 2614 2618 2629 2633
    ===================================================
    NETWORK MANAGER exited with code 254 at Fri Dec 14 01:25:12 PST 2018
    ./zigbeeHAgw: line 482: 2641 Killed ./track_servers $$ "$pids"
    GATEWAY_SRVR_x86: no process found
    ^Ccaught SIGTERM, killing all the servers and cleaning up
    OTA_SRVR_x86: no process found
    ZLSZNP_x86: no process found
    NPI_lnx_x86_server: no process found
    terminating zigbeeHAGW (pid 2560)
    Killed


    i am facing these issues

    I want to ask that the Launchpad is connected to the linux m/c
    flashed with hex file from host pc

    still i get these problems
    when i launch ./start application
    in network section it shows waiting to connect

    please solve this problem

    i am using Ubuntu 16.04 (64)
    TI CC1352R1

    ReplyDelete