Imported Upstream version 0.9.2
[platform/upstream/iotivity.git] / resource / csdk / connectivity / build / How_To_Build.txt
1 === Prerequisites ===
2
3 * 1. Scons
4
5 Please refer to the following page to install scons:
6    http://www.scons.org/doc/production/HTML/scons-user.html#chap-build-install
7 (Note: on Windows, install Python 2.x before installing scons)
8
9 * 2. IDE/SDK Pre-requites
10 To build for some OS (Android / Arduino / IOS ...), an IDE/SDK may be required,
11 please go to the relative page to download and install the required IDE/SDK.
12
13 Note: Connectivity module building has been changed. We have to build connectivity
14       from the iotivity root folder.
15
16 Linux Build:
17
18 1) Go to "iotivity/" folder.
19
20 2) Execute following command(s) to start build based on transport selection required :
21
22     -> Building for all transports :
23     $ scons resource/csdk/connectivity/samples/linux/ TARGET_OS=linux TARGET_TRANSPORT=ALL
24
25     -> Building for a specific transport :
26     $ scons resource/csdk/connectivity/samples/linux/ TARGET_OS=linux TARGET_TRANSPORT=IP
27
28     -> Building for multiple transports :
29     $ scons resource/csdk/connectivity/samples/linux/ TARGET_OS=linux TARGET_TRANSPORT=IP,BT
30
31     -> Clean Build (all transports) :
32     scons resource/csdk/connectivity/samples/linux/ TARGET_OS=linux TARGET_TRANSPORT=ALL -c (for clean)
33
34
35 3) The above command will build sample also.
36
37     For Enabling Secured server,
38     * Note: tinydtls library has to copied to "connectivity/lib/tinydtls" for secured build.
39
40     Secured Server will be only used for IP transports.
41
42     Give command "scons resource/csdk/connectivity/samples/linux/ TARGET_OS=linux TARGET_TRANSPORT=IP SECURED=1
43
44 Android Build:
45
46 1) Go to "iotivity/" folder.
47
48 2) Execute following command(s) to start build based on transport selection required :
49
50     -> Building for all transports :
51     $ scons resource/csdk/connectivity/samples/android/ TARGET_OS=android TARGET_TRANSPORT=ALL TARGET_ARCH=x86 ANDROID_NDK=your_ndk_path
52
53     -> Building for a specific transport :
54     $ scons resource/csdk/connectivity/samples/android/ TARGET_OS=android TARGET_TRANSPORT=IP TARGET_ARCH=x86 ANDROID_NDK=your_ndk_path
55
56     -> Building for multiple transports :
57     $ scons resource/csdk/connectivity/samples/android/ TARGET_OS=android TARGET_TRANSPORT=IP,BT TARGET_ARCH=x86 ANDROID_NDK=your_ndk_path
58
59 Note :- Upon successful execution of above command(s) CA library will be generated at path
60         "iotivity/out/android/TARGET_ARCH/release or debug".
61
62 Tizen Build:
63
64 1) If you are building first time, then delete GBS-ROOT folder from home directory.
65    Note: Default build server URL for Tizen is set in gbs configuration file @ iotivity/tools/tizen/.gbs.conf.
66          If need be, same can be modified as per appropriate target.
67
68 2) Go to "iotivity/" folder.
69
70 3) Execute following command(s) to start build based on transport selection required :
71
72     -> Building for all transports :
73     $ scons -f resource/csdk/connectivity/build/tizen/SConscript TARGET_OS=tizen TARGET_TRANSPORT=ALL
74
75     -> Building for a specific transport :
76     $ scons -f resource/csdk/connectivity/build/tizen/SConscript TARGET_OS=tizen TARGET_TRANSPORT=IP
77
78     -> Building for multiple transports :
79     $ scons -f resource/csdk/connectivity/build/tizen/SConscript TARGET_OS=tizen TARGET_TRANSPORT=IP,BT,BLE
80
81 4) By default, above command will build sample also.
82    To disable building sample, add BUILD_SAMPLE=OFF to the build command.
83    Ex: scons -f resource/csdk/connectivity/build/tizen/SConscript TARGET_OS=tizen TARGET_TRANSPORT=ALL BUILD_SAMPLE=OFF
84    Making this flag ON builds the sample.
85
86 Note :- Upon successful execution of above command(s) CA library and sample applications will be
87         generated at path "~/GBS-ROOT/local/repos/redwood/armv7l/RPMS".
88
89 Arduino Build:
90
91 Note :- Currently Mega & Due build is supported.
92
93 1) Set up Arduino first before building. Refer to "connectivity\build\arduino\Arduino_Setup_README.txt" file for help.
94
95 2) Go to "iotivity/" folder.
96
97 3) Execute following command to start build :
98
99 For Arduino Mega
100     $ scons resource/csdk/connectivity/samples/arduino/ TARGET_OS=arduino TARGET_TRANSPORT=<transport> TARGET_ARCH=avr BOARD=mega ARDUINO_HOME=<path_to_arduino_installation>
101 For Arduino Due
102     $ scons resource/csdk/connectivity/samples/arduino/ TARGET_OS=arduino TARGET_TRANSPORT=<transport> TARGET_ARCH=arm BOARD=arduino_due_x_dbg ARDUINO_HOME=<path_to_arduino_installation>
103     NOTE: BOARD=arduino_due_x_dbg|arduino_due_x. Default is arduino_due_x_dbg.
104
105     Possible values for <transport> are:
106     -> IP :
107     $ scons resource/csdk/connectivity/samples/arduino/ TARGET_OS=arduino TARGET_TRANSPORT=IP TARGET_ARCH=avr BOARD=mega ARDUINO_HOME=<path_to_arduino_installation>
108     -> BLE :
109     $ scons resource/csdk/connectivity/samples/arduino/ TARGET_OS=arduino TARGET_TRANSPORT=BLE TARGET_ARCH=avr BOARD=mega ARDUINO_HOME=<path_to_arduino_installation>
110
111     Note :- Only single transport can be built at a time for Arduino.
112
113 4) The above command will build sample also. The "CASample.hex" can be found at "/samples/arduino/"
114
115 5) After building sample, script will try to install on "/dev/ttyACM0" port in 'sudo' mode.
116    To skip installation, set command line argument 'UPLOAD=false'.
117    "scons resource/csdk/connectivity/samples/arduino/ TARGET_OS=arduino TARGET_TRANSPORT=ETHERNET TARGET_ARCH=avr BOARD=mega ARDUINO_HOME=<path_to_arduino_installation> UPLOAD=false"
118
119 6) To set BLE Shield Name, include the option DEVICE_NAME during scons build.
120
121    -> $ scons resource/csdk/connectivity/samples/arduino/ TARGET_OS=arduino TARGET_TRANSPORT=ETHERNET TARGET_ARCH=avr BOARD=mega ARDUINO_HOME=<path_to_arduino_installation> DEVICE_NAME=OIC
122
123    Specified Device name length MUST be less than 10 characters. RBL Library has this limitation.
124    By Default DEVICE_NAME=OIC-DEVICE, if device name option is not specified
125
126    To change the port number, please modify  "port" variable in __upload() function in: "/build/arduino/SConscript".
127