-
Notifications
You must be signed in to change notification settings - Fork 59
GUIDE: Building ZiGate firmware
Figuring how to install SDK and build ZiGate firmware took me some time. I hope this saves someones time and helps developing ZiGate.
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.
- Download BeyondStudio for NXP(JN-SW-4141) from HERE
- 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.
- Start BeyondStudio and create workspace when asked. Workspace path should be BeyondStudio-installation-path/workspace
- Continue to latest released or development version section
- Download JN516x ZigBee 3.0 SDK (JN-SW-4170) for Zigate from HERE
- Extract JN-SW-4170 folder from zip to BeyondStudio-installation-path\sdk\
- Download ZiGate source code (ZiGate.zip) from HERE
- Extract content of ZiGate.zip to BeyondStudio-installation-path\workspace\ZiGate\
- Now you should have BeyondStudio-installation-path\workspace\ZiGate\ folder with Build, Doc, JN516x, JN517X, Source, Tools folders and VERSION.txt file
- Go to section using BeyondStudio
- 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
- Extract ZiGate-3.0f\Module Radio\Firmware\src\ZiGate\ folder from zip to BeyondStudio-installation-path\workspace\
- Now you should have BeyondStudio-installation-path\workspace\ZiGate\ folder with Build, Doc, JN516x, JN517X, Source, Tools folders and VERSION.txt file
- 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.
- Executables
- Download JN516x ZigBee 3.0 SDK (JN-SW-4170) for Zigate from HERE
- 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
- You can use whatever program you want but I will demonstrace it using Notepad++
- Open Notepad++
- From menu Search -> Find in files
- 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"
- Replace in Files. When asked are you sure double check path and if its correct select yes.
- Repeat replacing part with all required file endings.
- Library folders
- Replace library folders content with working files from JN-SW-4170.zip
- At least following folders need to be replaced
- /Components/Library/
- /Platform/DK2/Library/
- /Platform/DK3/Library/
- /Platform/DK4/Library/
- Now everything should be ready for building firmware
- Start BeyondStudio if it is not still running. Select same workspace as earlier
- From menu select File -> Import
- From Import popup. Under General select Existing Projects into Workspace. Click next.
- Select root directory and browse to BeyondStudio-installation-path\workspace\zigate\
- Now you should see two projects on projects area. Select JN516x one if you are using ZiGate. Click finish.
- Close welcome window
- 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.
- 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.
- Click your project again and select Build Configurations -> Build Selected.
- Make sure that desired configuration is selected and also clean and build are checked. Press ok to start building. This will take some time.
- 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
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:
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
Select destination folder c:/NXP/bstudio_nxp/ZiGate
At this stage you should have a link in workspace
You shoul have a link in sdk:
and the complete ZIGate git in : C:\NXP\bstudio_nxp\ZiGate
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