Lely core libraries  1.9.2
README.md
1 ![logo](doc/logo.png)
2 
3 Lely core libraries
4 ===================
5 
6 Introduction
7 ------------
8 
9 ### C11 and POSIX compatibility library (liblely-libc)
10 
11 liblely-libc makes a selection of C11 features available in C99 (and C++98) and implements certain C99 and POSIX features that may be missing on some platforms.
12 The library is intended to provide platform independence to C99- and
13 C11-compliant users.
14 
15 See [doc/libc/overview.md](@ref md_doc_libc_overview) for an overview of the provided functionality.
16 
17 ### Test Anything Protocol (TAP) library (liblely-tap)
18 
19 liblely-tap provides an implementation of the [Test Anything Protocol].
20 
21 ### Utilities library (liblely-util)
22 
23 liblely-util provides a variety of functions and data structures used by, and
24 shared between, other Lely libraries.
25 
26 See [doc/util/overview.md](@ref md_doc_util_overview) for an overview of the provided functionality.
27 
28 ### CAN library (lely-can)
29 
30 lely-can provides generic CAN frame definitions, conversion functions for
31 different drivers and an interface designed to simplify CAN frame handling.
32 
33 See [doc/can/overview.md](@ref md_doc_can_overview) for an overview of the
34 provided functionality.
35 
36 ### I/O library (liblely-io)
37 
38 liblely-io provides uniform, platform-independent I/O interface for CAN devices,
39 regular files, serial I/O devices and network sockets. Depending on the
40 platform, some or all of these devices can be polled for events, allowing the
41 use of the reactor pattern.
42 
43 See [doc/io/overview.md](@ref md_doc_io_overview) for an overview of the
44 provided functionality.
45 
46 ### Asynchronous I/O library (liblely-aio)
47 
48 liblely-aio provides an event loop and asynchronous I/O. Currently only timers
49 and CAN devices are supported.
50 
51 ### CANopen library (liblely-co)
52 
53 liblely-co is a CANopen implementation for both masters and slaves. Most of the
54 functionality of [CiA] 301, 302, 305, 306, 309 and 315 is provided. The
55 implementation is passive; it does not perform any I/O or timing by itself.
56 Instead it relies on the user to send and received CAN frames and update the
57 clock. This allows the library to be integrated into a wide variety of
58 frameworks and communication patterns. The library uses the platform-independent
59 CAN frame definition from the Lely CAN library (liblely-can) and can be used
60 with the Lely I/O library (liblely-io).
61 
62 Additionally, several tools are provided:
63 - can2udp - CAN to UDP forwarding tool
64 - cocat/cocatd - CANopen cat tools
65 - coctl - CANopen control tool
66 - dcf2c - CANopen EDS/DCF to C conversion tool
67 
68 See [doc/co/overview.md](@ref md_doc_co_overview) for an overview of the
69 provided functionality.
70 
71 ### C++ CANopen application library (liblely-coapp)
72 
73 liblely-coapp provides a high-level application interface in C++ for liblely-co.
74 It is intended to simplify the development of CANopen master applications (and,
75 to a lesser extent, slaves) by providing a driver model and combining it with an
76 event loop (from liblely-aio).
77 
78 Download
79 --------
80 
81 lely-core is hosted on [GitLab]. You can clone the repository with
82 
83  $ git clone https://gitlab.com/lely_industries/lely-core.git
84 
85 or download the latest release
86 ([v1.9.2](https://gitlab.com/lely_industries/lely-core/tags/v1.9.2)).
87 
88 Build and install
89 -----------------
90 
91 lely-core uses the GNU Build System (`configure`, `make`, `make install`) and
92 has native support for POSIX platforms (Debian-based Linux distributions in
93 particular) and Windows (Vista and higher) through [Cygwin] or [MinGW-w64].
94 [GCC ARM Embedded] and Microsoft Visual Studio (2013 and higher) are also
95 supported, but project files will have to be created by hand.
96 
97 The release archive includes the build system, but if you want to build a
98 checkout of the repository, you need to install the autotools (autoconf,
99 automake and libtool). The build system can then be generated by running
100 
101  $ autoreconf -i
102 
103 in the root directory of the repository.
104 
105 If you want to generate HTML documentation from the source code, you need to
106 install [doxygen] and [Graphviz]. Building the [Python] bindings requires a
107 Python 2.x and/or Python 3.x interpreter as well as a [Cython] compiler.
108 
109 ### Debian packages
110 
111 For Debian-based Linux distributions, the preferred installation method is to
112 generate and install Debian packages. Install the Debian package build system
113 with
114 
115  $ sudo apt-get install cdbs devscripts
116 
117 The packages can now be built by running
118 
119  $ debuild -uc -us -b
120 
121 from the root directory of the project. Once the packages are generated, you can
122 clean up the project directory with
123 
124  $ debuild clean
125 
126 debuild creates the packages in the parent directory of the project. Install
127 them with
128 
129  $ cd ..
130  $ sudo dpkg -i liblely-*.deb
131 
132 The Python bindings can be installed with
133 
134  $ sudo dpkg -i python-lely-can*.deb
135 
136 and/or
137 
138  $ sudo dpkg -i python3-lely-can*.deb
139 
140 depending on which Python version is available.
141 
142 ### configure, make, make install
143 
144 It is also possible to build and install the library by hand. First, configure
145 the build system by running
146 
147  $ ./configure
148 
149 from the root directory of the project.
150 
151 The `configure` script supports many options. The full list can be shown with
152 
153  $ ./configure --help
154 
155 Once the build system is configured, the library can be built with
156 
157  $ make
158 
159 The test suite can be run with
160 
161  $ make check
162 
163 Run
164 
165  $ make html
166 
167 to generate the HTML documentation from the source code. The binaries, headers
168 and documentation can be installed by running
169 
170  # make install
171 
172 as root.
173 
174 ### Options
175 
176 liblely-libc provides an implementation of the C11 multithreading support
177 library. Multithreading support can be disabled by providing the
178 `--disable-threads` option to `configure` or by defining the `LELY_NO_THREADS`
179 preprocessor macro. The implementation is based on pthreads. When building the
180 library without the autotools build system, define the `LELY_HAVE_PTHREAD`
181 preprocessor macro if pthreads is available.
182 
183 On POSIX and Windows platforms, liblely-util provides functions to run a process
184 in the background as a daemon/service. This functionality can be disabled with
185 the `--disable-daemon` option to `configure` or by defining the `LELY_NO_DAEMON`
186 preprocessor macro.
187 
188 The CAN library provides a generic CAN message type suitable for both CAN and
189 CAN FD frames. If CAN FD support is not required, the message size can be
190 reduced by specifying the `--disable-canfd` option to `configure` or by defining
191 the `LELY_NO_CANFD` preprocessor macro.
192 
193 Much of the functionality of CANopen is optional and can be disabled to save
194 space on embedded devices. liblely-co supports the following `configure` options
195 (or preprocessor macros) to disable certain features:
196 
197 * `--disable-dcf` (`LELY_NO_CO_DCF`):
198  disable EDS/DCF support.
199 * `--disable-obj-file` (`LELY_NO_CO_OBJ_FILE`):
200  disable UploadFile/DownloadFile support for the object dictionary.
201 * `--disable-obj-limits` (`LELY_NO_CO_OBJ_LIMITS`):
202  disable minimum/maximum values in the object dictionary.
203 * `--disable-obj-name` (`LELY_NO_CO_OBJ_NAME`):
204  disable names in the object dictionary.
205 * `--disable-sdev` (`LELY_NO_CO_SDEV`):
206  disable static device description support.
207 * `--disable-csdo` (`LELY_NO_CO_CSDO`):
208  disable Client-SDO support (also disables master support).
209 * `--disable-rpdo` (`LELY_NO_CO_RPDO`):
210  disable Receive-PDO support.
211 * `--disable-tpdo` (`LELY_NO_CO_TPDO`):
212  disable Transmit-PDO support.
213 * `--disable-sync` (`LELY_NO_CO_SYNC`):
214  disable synchronization (SYNC) object support.
215 * `--disable-time` (`LELY_NO_CO_TIME`):
216  disable time stamp (TIME) object support.
217 * `--disable-emcy` (`LELY_NO_CO_EMCY`):
218  disable emergency (EMCY) object support.
219 * `--disable-lss` (`LELY_NO_CO_LSS`):
220  disable Layer Setting Services (LSS) and protocols support.
221 * `--disable-wtm` (`LELY_NO_CO_WTM`):
222  disable Wireless Transmission Media (WTM) support.
223 * `--disable-master` (`LELY_NO_CO_MASTER`):
224  disable master support.
225 * `--disable-gw` (`LELY_NO_CO_GW`):
226  disable gateway support.
227 * `--disable-gw-txt` (`LELY_NO_CO_GW_TXT`):
228  disable ASCII gateway support.
229 
230 Additionally, master and/or slave support for the C++ CANopen application
231 library can be disabled with the following `configure` options (or preprocessor
232 macros):
233 
234 * `--disable-coapp-master` (`LELY_NO_COAPP_MASTER`):
235  disable C++ CANopen application master support.
236 * `--disable-coapp-slave` (`LELY_NO_COAPP_SLAVE`):
237  disable C++ CANopen application slave support.
238 
239 The following preprocessor macros can be defined to change the default timeouts
240 used by an NMT master when booting a slave:
241 
242 * `LELY_CO_NMT_TIMEOUT`: the default timeout (in milliseconds) for SDO requests
243  issued by an NMT master (default: 100). The actual timeout can be changed at
244  runtime with co_nmt_set_timeout().
245 * `LELY_CO_NMT_BOOT_WAIT_TIMEOUT`: the timeout (in milliseconds) before an NMT
246  master tries to boot a slave on error status B (default: 1000, see Fig. 4 in
247  CiA 302-2 version 4.1.0).
248 * `LELY_CO_NMT_BOOT_SDO_RETRY`: the number of times an NMT master retries an SDO
249  request on timeout (default: 3). This is used for SDO requests that may occur
250  right after a slave receives a reset node or reset communication command,
251  which might cause it to miss the request.
252 * `LELY_CO_NMT_BOOT_RTR_TIMEOUT`: the timeout (in milliseconds) after an NMT
253  master sends a node guarding RTR to check the NMT state of a slave during
254  booting (default: 100, see Fig. 9 in CiA 302-2 version 4.1.0).
255 * `LELY_CO_NMT_BOOT_CHECK_TIMEOUT`: the time (in milliseconds) between
256  successive checks of the flash status indication (1F57:01) or program control
257  (1F51:01) sub-object of a slave during booting (default: 100, see Fig. 3 in
258  CiA 302-3 version 4.1.0).
259 
260 Although the Lely core libraries are written in C, C++ interfaces are provided
261 for a subset of the functionality. These interfaces can be disabled with the
262 `--disable-cxx` option to `configure` or by defining the `LELY_NO_CXX`
263 preprocessor macro. This also disables the entire C++ CANopen application
264 library.
265 
266 The Python bindings can be disabled by specifying the `--disable-python` option
267 to `configure`.
268 
269 Documentation
270 -------------
271 
272 Doxygen documentation for the latest development version can be found at
273 http://lely_industries.gitlab.io/lely-core/doxygen/.
274 
275 Licensing
276 ---------
277 
278 Copyright 2013-2019 [Lely Industries N.V.]
279 
280 Licensed under the Apache License, Version 2.0 (the "License");
281 you may not use this file except in compliance with the License.
282 You may obtain a copy of the License at
283 
284  http://www.apache.org/licenses/LICENSE-2.0
285 
286 Unless required by applicable law or agreed to in writing, software
287 distributed under the License is distributed on an "AS IS" BASIS,
288 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
289 See the License for the specific language governing permissions and
290 limitations under the License.
291 
292 [Cygwin]: https://www.cygwin.com/
293 [Cython]: http://cython.org/
294 [doxygen]: http://www.doxygen.org/
295 [GCC ARM Embedded]: https://launchpad.net/gcc-arm-embedded
296 [GitLab]: https://gitlab.com/lely_industries/libc
297 [Graphviz]: http://www.graphviz.org/
298 [Lely Industries N.V.]: http://www.lely.com
299 [MinGW-w64]: http://mingw-w64.org/
300 [Python]: https://www.python.org/
301 [Test Anything Protocol]: https://testanything.org