Professional Documents
Culture Documents
JN UG 3028 CodeBlocks 1v1
JN UG 3028 CodeBlocks 1v1
User Guide
JN-UG-3028
Revision 1.1
7-Feb-2007
Jennic
CodeBlocks IDE
User Guide
Contents
About this Manual 4
Organisation 4
Conventions 5
Acronyms and Abbreviations 5
Related Documents 5
Feedback Address 5
1 Overview 7
2 Installing Code::Blocks 9
2.1 Pre-requisites 9
2.2 Installation Procedures 10
2.2.1 Complete or Typical Installation 11
2.2.2 Custom Installation 13
2.3 Configuring the Integrated Flash Programmer 16
3 QuickStart to Using Code::Blocks 19
3.1 Example Applications 19
3.2 Opening and Building an Example Project 20
4 Creating and Building Your Own Projects 21
4.1 Code::Blocks Projects 21
4.2 Creating a Project 22
4.3 Working On Your Project 26
4.4 Building Your Project 27
4.4.1 Specifying Paths 27
4.4.2 Performing a Build 29
4.4.3 Dealing with Compilation Errors 30
5 Downloading an Application Binary 31
5.1 Pre-requisites 31
5.2 Download Procedures 31
5.2.1 Using the Integrated Flash Programmer 32
5.2.2 Using a Separate Flash Programmer 32
Organisation
This manual consists of five chapters, as follows:
• Chapter 1 provides a brief overview of using the Code::Blocks IDE.
• Chapter 2 describes how to install Code::Blocks, downloaded from the Jennic
web site.
• Chapter 3 provides a quick start to using Code::Blocks by describing how to
use the IDE to open and build example applications supplied by Jennic.
• Chapter 4 describes how to create and build your own Code::Blocks projects,
and provides advice on dealing with compilation errors.
• Chapter 5 describes how to download your executable code to the Flash
memory of the Jennic wireless microcontroller.
Conventions
Files, folders, functions and parameter types are represented in bold type.
Function parameters are represented in italics type.
Code fragments are represented in the Courier typeface.
Related Documents
[1] Jennic Software Developer’s Kit Installation Guide (JN-UG-3035)
[2] Jennic JN51xx Flash Programmer Application User Guide (JN-UG-3007)
Feedback Address
If you wish to comment on this manual, or any other Jennic user documentation,
please provide your feedback by writing to us (quoting the manual reference number
and version) at the following postal address or e-mail address:
Applications
Jennic Ltd
Furnival Street
Sheffield S1 4QT
United Kingdom
doc@jennic.com
1 Overview
For developing applications in an IDE (Integrated Development Environment),
Jennic recommends the use of Code::Blocks. This is a full-featured, open source
IDE which is available free-of-charge. When developing applications for the Jennic
wireless microcontrollers, you should use the specially adapted version of
Code::Blocks available from Jennic.
This version of Code::Blocks can be installed using either of two installers:
• Code::Blocks installer (part code: JN-SW-4024): Use this installer if you just
want to install/update Code::Blocks and associated software. This is the
installation method described in Chapter 2 of this manual. The installer is
available from the Support area of the Jennic web site
(www.jennic.com/support).
• “SDK with IDE” installer (part code: JN-SW-4026): Here, Code::Blocks is
installed as part of the Jennic Software Developer’s Kit (SDK) installation. Use
this installer if you want to install the SDK and Code::Blocks at the same time.
This installation is described in the Jennic Software Developer’s Kit Installation
Guide (JN-UG-3035). The installer is available on the:
Jennic evaluation kit CDs
Support area of the Jennic web site (www.jennic.com/support)
Note: Before creating and building your own projects, you are
recommended to follow the instructions in Chapter 3 to practise
using Code::Blocks with the example applications available on
the Jennic web site.
2 Installing Code::Blocks
This chapter describes how to install the Jennic version of Code::Blocks that has
been downloaded from the Support area of the Jennic web site
(www.jennic.com/support).
Note: If you wish to install the Code::Blocks IDE together with the
Jennic SDK (for IEEE 802.15.4 or ZigBee), you are advised to
use the Jennic “SDK with IDE” installer (part code: JN-SW-4026).
This installer is available on the evaluation kit CD or from the
Support area of the Jennic web site (www.jennic.com/support).
This installation is included in the Jennic Software Developer’s Kit
Installation Guide (JN-UG-3035).
2.1 Pre-requisites
Before installing Code::Blocks, ensure that you have the following:
• A machine with the following specification:
Windows XP or 2000 operating system
At least 150 MB of hard disk space available
• Administrator rights on the machine
• The Code::Blocks .msi file, downloaded from the Jennic web site (the filename
is of the form JN-SW-4024-JennicCodeblocks-XvY.msi).
Step 3 Consult the note below, then select either Typical or Complete, as required, and
click Next.
The installation continues. The set-up wizard installs the software in the directory
C:\Jennic\cygwin\jennic\ and configures the compiler settings in Code::Blocks.
Step 4 When the installation is complete, click Finish.
Step 5 (Optional) Once the Code::Blocks installation has finished, you can install the
required stack software components, as follows:
• 802.15.4 MAC software (JN-SW-4025)
• ZigBee Stack (JN-SW-4011), if the ZigBee option has been purchased
The latest versions of these software components are available for download from
the Support area of the Jennic web site (www.jennic.com/support).
For each of these components, download the relevant .msi file to your machine and
then double-click on the file to start its installation wizard. Again, follow the on-
screen instructions and install the software into the same directory as Code::Blocks.
Note: You should use this procedure if you already have the
JN51xx Compiler and/or JN51xx Flash Programmer on your
machine. In the case of a re-installation, you must first uninstall
the previous version of the relevant software component.
b) The installation location for the software is shown in the Location field. The set-
up wizard will automatically create the installation directory structure at this
point. By default, this is C:\, but you can specify another drive and/or path by
using the Browse button to navigate to the required location.
Step 5 Click Next and when the installation is complete, click Finish.
Step 6 (Optional) Once the Code::Blocks installation has finished, you can install the
required stack software components, as follows:
• 802.15.4 MAC software (JN-SW-4025)
• ZigBee Stack (JN-SW-4011), if the ZigBee option has been purchased
The latest versions of these software components are available for download from
the Support area of the Jennic web site (www.jennic.com/support).
For each of these components, download the relevant .msi file to your machine and
then double-click on the file to start its installation wizard. Again, follow the on-
screen instructions and install the software into the same directory as Code::Blocks.
The fields of this screen are pre-filled with the relevant information, as shown above.
As part of the project creation process, Code::Blocks creates a project file, with
extension .cbp. This is put into the project directory, along with the C source file(s).
The project file contains essential project information, such as all required directory
paths and the compiler to use for building the application.
Once created, a project can be displayed and manipulated in the Projects tab in the
Management pane on the left of the Code::Blocks window.
The rest of this chapter describes:
• How to create a Code::Blocks project (see Section 4.2)
• How to work on a project in Code::Blocks (see Section 4.3)
• How to build a project (see Section 4.4)
Note: You can use the Category field to select the Jennic wizard
so that only the Jennic icon is shown.
Step 3 In the first screen of the wizard, simply click Next (and, if desired, tick the checkbox
Skip this page next time).
Step 5 In the next screen, select the JN51xx Compiler and click Next.
Step 6 Now select the environment in which you will work on the application:
• If you are using the latest Jennic SDK version, you will normally work in the
SDK directory:
C:\Jennic\cygwin\jennic\SDK\
• If you are using an earlier Jennic SDK version (from a JN5121 evaluation kit),
you may work in the developer directory:
C:\Jennic\cygwin\jennic\developer\
Then click Next.
Step 7 In the next screen, choose the application type from the following:
• IEEE 802.15.4 application
• ZigBee Co-ordinator application
• ZigBee End Device application
• ZigBee Router application
Then click Next.
Step 8 Now select the type of board to which the application will be downloaded, from the
following:
• DK1 board (from JN5121-EK000 or JN5121-EK010 evaluation kit)
• DK2 board (from JN513x-EK000 or JN513x-EK010 evaluation kit)
• NTS (Network Test System) board
• High Power Development Kit board
Then click Next.
Step 9 In the next screen, select the type of Jennic wireless microcontroller on which you
will run the application, from the following:
• JN5121
• JN513x
Finally, click Finish.
Your project has been created!
C:\Jennic\cygwin\jennic\SDK\<project name>
or
C:\Jennic\cygwin\jennic\developer\<project name>
! Caution: You must rename the .c source file before saving it.
Once the file has been saved, the rename option is removed.
Step 5 To display the code in the main pane, double-click on the .c source file in the
Projects tab.
You can now edit the code in the main pane.
Step 6 When you have finished editing the .c source file, ensure that you save your
changes (for example, by following the menu path File>Save) and then close the file
(for example, by following the menu path File>Close file).
You are recommended to save your changes regularly while editing.
Step 7 Once you have finished working on the project, save the project changes (for
example, by following the menu path File>Save project) and close the project (for
example, by following the menu path File>Close project).
Step 3 Click on the Compiler sub-tab and ensure that the paths to all the required header
files are listed. If you need to add a directory path, use the Add button to specify the
new path.
Step 4 Click on the Linker sub-tab and ensure that the path to the linker command file is
C:\Jennic\cygwin\jennic\SDK\Build or C:\Jennic\cygwin\jennic\developer\Build,
as appropriate.
Step 5 Click on the Linker tab (top-level) to obtain the view shown below.
Step 6 Ensure that the paths to all the necessary link libraries are present in the
Link libraries field. If you need to add a directory path, use the Add button to
specify the new path.
Step 7 Click OK to register any changes and to exit the Project build options screen.
5.1 Pre-requisites
Ensure that you have the following:
• A target device containing a Jennic wireless microcontroller.
• A serial cable and dongle allowing connection between your PC and the target
device.
• The .bin file to be downloaded – following a build, this file is placed in the
Build\Release or Build\Debug directory for the project, as appropriate.
Revision History
Version Date Description
1.1 07-Feb-2007 Updated to cover both JN5121 and JN513x series devices
Disclaimer
The contents of this document are subject to change without notice. Customers are advised to consult with JENNIC commercial
representatives before ordering.
The information and circuit diagrams in this document are presented as examples of semiconductor device applications, and are not
intended for incorporation in devices for actual use. Also, JENNIC is unable to assume responsibility for infringement of any patent
rights or other rights of third parties arising from the use of this information or circuit diagrams.
No license is granted by its implication or otherwise under any patent or patent rights of JENNIC Ltd
“Typical” parameters that are provided in this document may vary in different applications and performance may vary over time. All
operating parameters must be validated for each customer application by the customer’s own technical experts.
United States Sales Office United States Sales Office Korean Sales Office
1322 Scott Street, Suite 203 1060 First Avenue, Suite 400 701, 7th Floor, Kunam Building
Point Loma King of Prussia 831-37, Yeoksam-Dong
CA 92106 PA 19406 Kangnam-ku
USA USA Seoul 135-080
Korea
Tel +1 619 223 2215 Tel +1 619 223 2215
Fax +1 619 223 2081 Fax +1 619 223 2081 Tel +82 2 552 5325
E-mail info@us.jennic.com E-mail info@us.jennic.com Fax +82 2 3453 8802
E-mail info@kr.jennic.com