The Raspberry Pi is a great development board for building host applications. This KBA will help explain a few ways in which you can set up your Raspberry Pi for development with Silicon Labs EmberZNet (Zigbee) stack.
In what we call native development, you would transfer the entire stack over to your Raspberry Pi. Once you transferred over the entire stack, you could then generate a project from your Windows/Mac/Linux machine, transfer the entire project to your Raspberry Pi and use the generated Makefile to build the host application.
The first step in this process is locating the SDK files on your machine.
Once you have located the SDK files, you will need to decide which files to copy over to your Raspberry Pi. Ideally, you will use the latest SDK, but this could be for any SDK version. For this example, we are using the v.2.1 SDK, which includes EmberZNet 6.1.0
The simplest thing to do would be to transfer the entire SDK to your Raspberry Pi. For example, on your Raspberry Pi you could create a folder called ~/stack and copy the entire contents of v2.1 over to this folder so that you have the entire stack on the Raspberry Pi. But this isn't completely necessary as that would copy a number of files which are not needed for building projects. When you look at your directory listing, you will see these folders:
app hardware meta platform protocol tool util
The best way to move these files over is to zip up the files you want and move them over to the Raspberry Pi over a utility like WinSCP or a similar program to copy the files over to the Raspberry Pi. Then unzip the files on your Raspberry Pi.
There two libraries that are usually missing in a standard Raspberry Pi install, the readline development libraries and the ncurses development libraries. These should be added via command line:
sudo apt-get install libreadline-dev
sudo apt-get install libncurses5-dev libncursesw5-dev
Desktop Cross Compiling
An option that doesn't require you to copy over the entire SDK is building on your desktop machine with a cross compiler. With this option, you would generate your application in Windows, Mac or Linux, then use a cross compiler to generate a Raspberry Pi binary, which you would transfer over to your Raspberry Pi with a utility like WinSCP or a similar program.
First, you will need to locate the cross compiler for your platform:
Once you install one of these cross compilers, you will need to make sure this is in your path (Windows, Mac, Linux). Then you can edit your Makefile to use the cross compiler. You will need to locate the lines for COMPILER and LINKER. For example in Windows you would edit the Makefile as such:
COMPILER ?= gcc LINKER ?= gcc
COMPILER ?= arm-linux-gnueabihf-gcc LINKER ?= arm-linux-gnueabihf-gcc
Then calling make will invoke this compiler and build the Raspberry Pi compatible binary on your machine, which you would then need a utility like WinSCP or similar to copy the file over to the Raspberry Pi. In many cases, you may need to change permissions of your file to make it executable.
We are planning to use mgm111a256v2 module in our custom board. So according to my knowledge we need to use EmberZNet stack. But my queries are:
1. What does EmberZNet Stack means? Is it a firmware which will be running on mgm111a256v2 mcu ? OR will be an host specific library which will help to compile an application that will send command and frames through SPI/UART.
2. If its an host specific library then how can I integrate it in my yocto build system. i.e do we have any Layer available for this.
3. How can I order EmberZNet Stack source code for mgm111a256v2 module.
I am new to zigbee, thread and BSP, so I am asking too many query,
When I edit the makefile, I see two other options:
ARCHIVE ?= ar
STD ?= gnu99
How does this option work?