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