Skip to content

GUIDE: Building ZiGate firmware

Fairesoimeme edited this page Sep 30, 2020 · 3 revisions

Installing SDK and using it to build firmware

Figuring how to install SDK and build ZiGate firmware took me some time. I hope this saves someones time and helps developing ZiGate.

Install BeyondStudio

BeyondStudio is Eclipse IDE for NXP JN51xx C/C++ developers. It is needed to build ZiGate firmware. It is available on NXP website you just need to have account which you can create for free.

  1. Download BeyondStudio for NXP(JN-SW-4141) from HERE
  2. Instal BeyondStudio. I recomend to install it to default installation path, but you can install it anywhere. Install it to other place and you will have to replace some paths later.
  3. Start BeyondStudio and create workspace when asked. Workspace path should be BeyondStudio-installation-path/workspace
  4. Continue to latest released or development version section

ZiGate latest released version

  1. Download JN516x ZigBee 3.0 SDK (JN-SW-4170) for Zigate from HERE
  2. Extract JN-SW-4170 folder from zip to BeyondStudio-installation-path\sdk\
  3. Download ZiGate source code (ZiGate.zip) from HERE
  4. Extract content of ZiGate.zip to BeyondStudio-installation-path\workspace\ZiGate\
  5. Now you should have BeyondStudio-installation-path\workspace\ZiGate\ folder with Build, Doc, JN516x, JN517X, Source, Tools folders and VERSION.txt file
  6. Go to section using BeyondStudio

ZiGate latest development version

  1. Download latest development version from Github. Select desired branch and download it. At time of writing this newest branch is v3.0f. https://github.com/fairecasoimeme/ZiGate/archive/v3.0f.zip
  2. Extract ZiGate-3.0f\Module Radio\Firmware\src\ZiGate\ folder from zip to BeyondStudio-installation-path\workspace\
  3. Now you should have BeyondStudio-installation-path\workspace\ZiGate\ folder with Build, Doc, JN516x, JN517X, Source, Tools folders and VERSION.txt file
  4. Extract ZiGate-3.0f\Module Radio\Firmware\src\sdk\JN-SW-4170\ folder from zip to BeyondStudio-installation-path\sdk\

Evrything would be good but Github breaks code line endings. We need to fix those.

  1. Executables
    1. Download JN516x ZigBee 3.0 SDK (JN-SW-4170) for Zigate from HERE
    2. Extract JN-SW-4170\Tools\ folder from zip to BeyondStudio-installation-path\sdk\JN-SW-4170\ and overwrite all duplicates.
  2. Find and remove all \r characters from .mk, .c, .h files
    1. You can use whatever program you want but I will demonstrace it using Notepad++
    2. Open Notepad++
    3. From menu Search -> Find in files
    4. Fill values
      • Find what: \r
      • Leave Replace with empty
      • filters: *.h
      • Path: BeyondStudio-installation-path\sdk\JN-SW-4170\
      • Search mode: Extended
      • Only checkbox that needs to be checked is "In all sub-folders"
    5. Replace in Files. When asked are you sure double check path and if its correct select yes.
    6. Repeat replacing part with all required file endings.
  3. Library folders
    1. Replace library folders content with working files from JN-SW-4170.zip
    2. At least following folders need to be replaced
      • /Components/Library/
      • /Platform/DK2/Library/
      • /Platform/DK3/Library/
      • /Platform/DK4/Library/
  4. Now everything should be ready for building firmware

Using BeyondStudio

  1. Start BeyondStudio if it is not still running. Select same workspace as earlier
  2. From menu select File -> Import
  3. From Import popup. Under General select Existing Projects into Workspace. Click next.
  4. Select root directory and browse to BeyondStudio-installation-path\workspace\zigate\
  5. Now you should see two projects on projects area. Select JN516x one if you are using ZiGate. Click finish.
  6. Close welcome window
  7. If you installed BeyondStudio anywhere else than default location from Project Explorer select JN-SW-4170. Click it with right mouse button and select properties. Click Edit... button from Location row and find your BeyondStudio installation location from there select sdk and JN-SW-4170. Press Ok. Press Ok.
  8. Click your project "JN-AN-1216-Zigbee-3-0-IoT-ControlBridge" and select Build Configurations -> Set active and select desired build. I have used ZigbeeNodeControlBridge_Coordinator_115200[JN5168] for ZiGate.
  9. Click your project again and select Build Configurations -> Build Selected.
  10. Make sure that desired configuration is selected and also clean and build are checked. Press ok to start building. This will take some time.
  11. If no error other than Memsize.exe appears then you should find your firmware file from folder BeyondStudio-installation-path\workspace\zigate\build\ZigbeeNodeControlBridge\ it is named acording your build configuration and ends with .bin

Other way

I try a complementary approach to @ISO-B which looks to work, here after the differents steps:

As the compilation is closely linked to the folders organisation here is a solution I use to ease the dev.

You need to be admin to do next 2 commands: capture d ecran 2019-01-24 a 12 37 34

First create a folder link with the command: mklink /D C:\NXP\bstudio_nxp\workspace\ZiGate C:\NXP\bstudio_nxp\ZiGate\ModuleRadio\Firmware\src\ZiGate

Second create a folder link with the command: mklink /D C:\NXP\bstudio_nxp\sdk\JN-SW-4170 "C:\NXP\bstudio_nxp\ZiGate\Module Radio\Firmware\src\sdk\JN-SW-4170"

Then we will use GitHub Desktop application to get the latest version. Start GitHub Desktop and "Clone a repository" from URL: https://github.com/fairecasoimeme/ZiGate.git capture d ecran 2019-01-24 a 13 43 00

Select destination folder c:/NXP/bstudio_nxp/ZiGate

At this stage you should have a link in workspace capture d ecran 2019-01-24 a 13 45 37

You shoul have a link in sdk: capture d ecran 2019-01-24 a 14 42 40

and the complete ZIGate git in : C:\NXP\bstudio_nxp\ZiGate capture d ecran 2019-01-24 a 13 46 21

Prepare sdk/JN-SW-4170 folder as per @ISO-B chapter "ZiGate latest development version":

  • Extract JN-SW-4170\Tools\ folder from zip to BeyondStudio-installation-path\sdk\JN-SW-4170\ and overwrite all duplicates
  • Find and remove all \r characters from .mk, .c, .h files
  • Library folders

When done, ready to start NXP Studio.

Source : https://github.com/fairecasoimeme/ZiGate/issues/105