wip CspComIF
This commit is contained in:
parent
106ced9687
commit
3dbe63dbdb
@ -1,113 +0,0 @@
|
||||
libcsp 1.4, 07-05-2015
|
||||
----------------------
|
||||
- new: General rtable interface with support for STATIC or CIDR format
|
||||
- new: CIDR (classless interdomain routing) route table format with netmasks
|
||||
- new: Bridge capability
|
||||
- new: Added routing table (de)serialization functions for load/save
|
||||
- new: Automatic packet deduplication using CRC32 (compile time option)
|
||||
- new: Autogenerated python bindings using ctypesgen
|
||||
- new: Task-less operation with router invocation from external scheduler function
|
||||
- api: Refactor route_if_add to csp_iflist_add
|
||||
- api: Refactor route_set and friends to rtable_set
|
||||
- api: Refactor csp_fifo_qos to csp_qfifo
|
||||
- api: Added defined to be backwards compatible with 1.x
|
||||
- interfaces: Drop packets on LOOP interface not for own address (blackhole)
|
||||
- interfaces: New ZMQHUB interface (using zeroMQ over TCP)
|
||||
- other: Increase stack size from 250 to 1100 for csp_can_rx_task
|
||||
- other: Cleanup in csp_route.c
|
||||
- other: Show incoming interface name in debug message
|
||||
- other: Remove newlines from debug calls
|
||||
- improvement: Reduce debug hook function complexity with valist passing
|
||||
- fix: csp_sleep_ms did not work
|
||||
|
||||
libcsp 1.3, 07-05-2015
|
||||
----------------------
|
||||
- new: Split long process lists into multiple packets
|
||||
- new: Added posix csp_clock.h
|
||||
- new: cmp clock functions (requires that you provide csp_clock.h implementation)
|
||||
- new: Added SFP (Small fragmentation protocol) for larger data chunks
|
||||
- fix: csp_if_fifo example
|
||||
- fix: NULL char at the end of rps
|
||||
- doc: Updated mtu documentation
|
||||
- other: Tested with FreeRTOS 8.0
|
||||
- other: Added disable-stlib option to build only object files
|
||||
|
||||
libcsp 1.2, 25-10-2013
|
||||
----------------------
|
||||
- Feature release
|
||||
- New: CMP service for peek and poke of memory
|
||||
- New: CMP interface statistics struct is now packed
|
||||
- New: Faster O(1) buffer system with reference counting and automatic alignment
|
||||
- New: Thread safe KISS driver with support for multiple interfaces
|
||||
- New: CSP interface struct now holds an opaque pointer to driver handle
|
||||
- New: removed TXBUF from KISS driver entirely to minimize stack usage, added TX lock instead
|
||||
- New: Pre-calculated CRC table .romem or PROGMEM on __avr__
|
||||
- New: Added buffer overflow protection to KISS interface
|
||||
- New: Allow posting null pointers on conn RX queues
|
||||
- New: Lower memory usage on AVR8
|
||||
- New: csp_route_save and csp_route_load functions
|
||||
- New: option --disable-verbose to disable filenames and linenumber on debug
|
||||
- Protocol: KISS uses csp_crc32 instead of it own embedded crc32
|
||||
- Improvement: Use buffer clone function to copy promisc packets
|
||||
- Bugfix: Fix pointer size (32/16bit) in cmp_peek/poke
|
||||
- Bugfix: Issue with double free in KISS fixed
|
||||
- Bugfix: Change rdp_send timeout from packet to connection timeout to make sending task block longer
|
||||
- Bugfix: Fix conn pool leak when using security check and discarding new packets
|
||||
- Bugfix: Add packet too short check for CRC32
|
||||
- Bugfix: Accept CRC32 responses from nodes without CRC support
|
||||
- Bugfix: Ensure csp_ping works for packets > 256 bytes
|
||||
- Bugfix: Cleanup printf inside ISR functions
|
||||
- Bugfix: Do not add forwarded packets to promisc queue twice
|
||||
- Bugfix: Fix return value bug of csp_buffer_get when out of buffers
|
||||
- Bugfix: Always post null pointer with lowest priority, not highest
|
||||
- Bugfix: Add check on debug level before calling do_csp_debug, fixes #35
|
||||
- Other: Export csp/arch include files
|
||||
- Other: Remove the use of bool type from csp_debug
|
||||
- Other: Moved csp debug functions to csp_debug.h instead of csp.h
|
||||
- Other: Ensure assignment of id happens using the uint32_t .ext value of the union, quenches warning
|
||||
|
||||
libcsp 1.1, 24-08-2012
|
||||
----------------------
|
||||
- Feature release
|
||||
- Defacto stable since Feb 2012
|
||||
- New: I2C interface
|
||||
- New: KISS interface
|
||||
- New: USART drivers for Linux, Mac and Windows
|
||||
- New: Windows/MinGW support
|
||||
- New: MacOSX support
|
||||
- New: Interface register function
|
||||
- New: Interface search function
|
||||
- New: CMP service for remote route updating
|
||||
- New: CMP service for interface statistics
|
||||
- Improvement: Better QoS support
|
||||
- Improvement: Send RDP control messages with high priority
|
||||
- Improvement: WAF distcheck now works
|
||||
- Improvement: Automatic endian discovery
|
||||
- Improvement: Accept packets with CRC32 checksum if compiled without CRC32 support
|
||||
- Improvement: Do not wake the router task if RDP is not enabled
|
||||
- Improvement: Save 102 bytes of RAM by packing route entries
|
||||
- Cleanup: Simplify CAN configuration
|
||||
- Cleanup: Move architecture specific code to src/arch
|
||||
- Bugfix: CSP_MEMFREE gives wrong answer on freertos AVR due to truncation
|
||||
- Bugfix: Fixed wrong 64-bit size_t in csp_service_handler
|
||||
- Bugfix: Fixed problem in csp_if_kiss when out of buffers
|
||||
- Bigfix: Handle bus-off CAN IRQ for AT90CAN128
|
||||
|
||||
libcsp 1.0.1, 30-10-2011
|
||||
------------------------
|
||||
- Hotfix release
|
||||
- Bugfix: missing extern in csp_if_lo.h
|
||||
|
||||
libcsp 1.0, 24-10-2011
|
||||
----------------------
|
||||
- First official release
|
||||
- New: CSP 32-bit header 1.0
|
||||
- Features: Network Router with promiscous mode, broadcast and QoS
|
||||
- Features: Connection-oriented transport protocol w. flow-control
|
||||
- Features: Connection-less "UDP" like transport
|
||||
- Features: Encryption, Authentication and message check
|
||||
- Features: Loopback interface
|
||||
- Features: Python Bindings
|
||||
- Features: CAN interface w. drivers for several chips
|
||||
- Features: CSP-services (ping, reboot, uptime, memfree, buffree, ident)
|
||||
|
@ -1,3 +0,0 @@
|
||||
Jeppe Ledet-Pedersen <jeppe@ledets.dk>
|
||||
Johan De Claville Christiansen <johan@gomspace.com>
|
||||
Dan Erik Holmstrøm <holmstro@stud.ntnu.no>
|
@ -1,503 +0,0 @@
|
||||
GNU LESSER GENERAL PUBLIC LICENSE
|
||||
Version 2.1, February 1999
|
||||
|
||||
Copyright (C) 1991, 1999 Free Software Foundation, Inc.
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
[This is the first released version of the Lesser GPL. It also counts
|
||||
as the successor of the GNU Library Public License, version 2, hence
|
||||
the version number 2.1.]
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
Licenses are intended to guarantee your freedom to share and change
|
||||
free software--to make sure the software is free for all its users.
|
||||
|
||||
This license, the Lesser General Public License, applies to some
|
||||
specially designated software packages--typically libraries--of the
|
||||
Free Software Foundation and other authors who decide to use it. You
|
||||
can use it too, but we suggest you first think carefully about whether
|
||||
this license or the ordinary General Public License is the better
|
||||
strategy to use in any particular case, based on the explanations below.
|
||||
|
||||
When we speak of free software, we are referring to freedom of use,
|
||||
not price. Our General Public Licenses are designed to make sure that
|
||||
you have the freedom to distribute copies of free software (and charge
|
||||
for this service if you wish); that you receive source code or can get
|
||||
it if you want it; that you can change the software and use pieces of
|
||||
it in new free programs; and that you are informed that you can do
|
||||
these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid
|
||||
distributors to deny you these rights or to ask you to surrender these
|
||||
rights. These restrictions translate to certain responsibilities for
|
||||
you if you distribute copies of the library or if you modify it.
|
||||
|
||||
For example, if you distribute copies of the library, whether gratis
|
||||
or for a fee, you must give the recipients all the rights that we gave
|
||||
you. You must make sure that they, too, receive or can get the source
|
||||
code. If you link other code with the library, you must provide
|
||||
complete object files to the recipients, so that they can relink them
|
||||
with the library after making changes to the library and recompiling
|
||||
it. And you must show them these terms so they know their rights.
|
||||
|
||||
We protect your rights with a two-step method: (1) we copyright the
|
||||
library, and (2) we offer you this license, which gives you legal
|
||||
permission to copy, distribute and/or modify the library.
|
||||
|
||||
To protect each distributor, we want to make it very clear that
|
||||
there is no warranty for the free library. Also, if the library is
|
||||
modified by someone else and passed on, the recipients should know
|
||||
that what they have is not the original version, so that the original
|
||||
author's reputation will not be affected by problems that might be
|
||||
introduced by others.
|
||||
|
||||
Finally, software patents pose a constant threat to the existence of
|
||||
any free program. We wish to make sure that a company cannot
|
||||
effectively restrict the users of a free program by obtaining a
|
||||
restrictive license from a patent holder. Therefore, we insist that
|
||||
any patent license obtained for a version of the library must be
|
||||
consistent with the full freedom of use specified in this license.
|
||||
|
||||
Most GNU software, including some libraries, is covered by the
|
||||
ordinary GNU General Public License. This license, the GNU Lesser
|
||||
General Public License, applies to certain designated libraries, and
|
||||
is quite different from the ordinary General Public License. We use
|
||||
this license for certain libraries in order to permit linking those
|
||||
libraries into non-free programs.
|
||||
|
||||
When a program is linked with a library, whether statically or using
|
||||
a shared library, the combination of the two is legally speaking a
|
||||
combined work, a derivative of the original library. The ordinary
|
||||
General Public License therefore permits such linking only if the
|
||||
entire combination fits its criteria of freedom. The Lesser General
|
||||
Public License permits more lax criteria for linking other code with
|
||||
the library.
|
||||
|
||||
We call this license the "Lesser" General Public License because it
|
||||
does Less to protect the user's freedom than the ordinary General
|
||||
Public License. It also provides other free software developers Less
|
||||
of an advantage over competing non-free programs. These disadvantages
|
||||
are the reason we use the ordinary General Public License for many
|
||||
libraries. However, the Lesser license provides advantages in certain
|
||||
special circumstances.
|
||||
|
||||
For example, on rare occasions, there may be a special need to
|
||||
encourage the widest possible use of a certain library, so that it becomes
|
||||
a de-facto standard. To achieve this, non-free programs must be
|
||||
allowed to use the library. A more frequent case is that a free
|
||||
library does the same job as widely used non-free libraries. In this
|
||||
case, there is little to gain by limiting the free library to free
|
||||
software only, so we use the Lesser General Public License.
|
||||
|
||||
In other cases, permission to use a particular library in non-free
|
||||
programs enables a greater number of people to use a large body of
|
||||
free software. For example, permission to use the GNU C Library in
|
||||
non-free programs enables many more people to use the whole GNU
|
||||
operating system, as well as its variant, the GNU/Linux operating
|
||||
system.
|
||||
|
||||
Although the Lesser General Public License is Less protective of the
|
||||
users' freedom, it does ensure that the user of a program that is
|
||||
linked with the Library has the freedom and the wherewithal to run
|
||||
that program using a modified version of the Library.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow. Pay close attention to the difference between a
|
||||
"work based on the library" and a "work that uses the library". The
|
||||
former contains code derived from the library, whereas the latter must
|
||||
be combined with the library in order to run.
|
||||
|
||||
GNU LESSER GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License Agreement applies to any software library or other
|
||||
program which contains a notice placed by the copyright holder or
|
||||
other authorized party saying it may be distributed under the terms of
|
||||
this Lesser General Public License (also called "this License").
|
||||
Each licensee is addressed as "you".
|
||||
|
||||
A "library" means a collection of software functions and/or data
|
||||
prepared so as to be conveniently linked with application programs
|
||||
(which use some of those functions and data) to form executables.
|
||||
|
||||
The "Library", below, refers to any such software library or work
|
||||
which has been distributed under these terms. A "work based on the
|
||||
Library" means either the Library or any derivative work under
|
||||
copyright law: that is to say, a work containing the Library or a
|
||||
portion of it, either verbatim or with modifications and/or translated
|
||||
straightforwardly into another language. (Hereinafter, translation is
|
||||
included without limitation in the term "modification".)
|
||||
|
||||
"Source code" for a work means the preferred form of the work for
|
||||
making modifications to it. For a library, complete source code means
|
||||
all the source code for all modules it contains, plus any associated
|
||||
interface definition files, plus the scripts used to control compilation
|
||||
and installation of the library.
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running a program using the Library is not restricted, and output from
|
||||
such a program is covered only if its contents constitute a work based
|
||||
on the Library (independent of the use of the Library in a tool for
|
||||
writing it). Whether that is true depends on what the Library does
|
||||
and what the program that uses the Library does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Library's
|
||||
complete source code as you receive it, in any medium, provided that
|
||||
you conspicuously and appropriately publish on each copy an
|
||||
appropriate copyright notice and disclaimer of warranty; keep intact
|
||||
all the notices that refer to this License and to the absence of any
|
||||
warranty; and distribute a copy of this License along with the
|
||||
Library.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy,
|
||||
and you may at your option offer warranty protection in exchange for a
|
||||
fee.
|
||||
|
||||
2. You may modify your copy or copies of the Library or any portion
|
||||
of it, thus forming a work based on the Library, and copy and
|
||||
distribute such modifications or work under the terms of Section 1
|
||||
above, provided that you also meet all of these conditions:
|
||||
|
||||
a) The modified work must itself be a software library.
|
||||
|
||||
b) You must cause the files modified to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
c) You must cause the whole of the work to be licensed at no
|
||||
charge to all third parties under the terms of this License.
|
||||
|
||||
d) If a facility in the modified Library refers to a function or a
|
||||
table of data to be supplied by an application program that uses
|
||||
the facility, other than as an argument passed when the facility
|
||||
is invoked, then you must make a good faith effort to ensure that,
|
||||
in the event an application does not supply such function or
|
||||
table, the facility still operates, and performs whatever part of
|
||||
its purpose remains meaningful.
|
||||
|
||||
(For example, a function in a library to compute square roots has
|
||||
a purpose that is entirely well-defined independent of the
|
||||
application. Therefore, Subsection 2d requires that any
|
||||
application-supplied function or table used by this function must
|
||||
be optional: if the application does not supply it, the square
|
||||
root function must still compute square roots.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Library,
|
||||
and can be reasonably considered independent and separate works in
|
||||
themselves, then this License, and its terms, do not apply to those
|
||||
sections when you distribute them as separate works. But when you
|
||||
distribute the same sections as part of a whole which is a work based
|
||||
on the Library, the distribution of the whole must be on the terms of
|
||||
this License, whose permissions for other licensees extend to the
|
||||
entire whole, and thus to each and every part regardless of who wrote
|
||||
it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest
|
||||
your rights to work written entirely by you; rather, the intent is to
|
||||
exercise the right to control the distribution of derivative or
|
||||
collective works based on the Library.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Library
|
||||
with the Library (or with a work based on the Library) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
3. You may opt to apply the terms of the ordinary GNU General Public
|
||||
License instead of this License to a given copy of the Library. To do
|
||||
this, you must alter all the notices that refer to this License, so
|
||||
that they refer to the ordinary GNU General Public License, version 2,
|
||||
instead of to this License. (If a newer version than version 2 of the
|
||||
ordinary GNU General Public License has appeared, then you can specify
|
||||
that version instead if you wish.) Do not make any other change in
|
||||
these notices.
|
||||
|
||||
Once this change is made in a given copy, it is irreversible for
|
||||
that copy, so the ordinary GNU General Public License applies to all
|
||||
subsequent copies and derivative works made from that copy.
|
||||
|
||||
This option is useful when you wish to copy part of the code of
|
||||
the Library into a program that is not a library.
|
||||
|
||||
4. You may copy and distribute the Library (or a portion or
|
||||
derivative of it, under Section 2) in object code or executable form
|
||||
under the terms of Sections 1 and 2 above provided that you accompany
|
||||
it with the complete corresponding machine-readable source code, which
|
||||
must be distributed under the terms of Sections 1 and 2 above on a
|
||||
medium customarily used for software interchange.
|
||||
|
||||
If distribution of object code is made by offering access to copy
|
||||
from a designated place, then offering equivalent access to copy the
|
||||
source code from the same place satisfies the requirement to
|
||||
distribute the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
5. A program that contains no derivative of any portion of the
|
||||
Library, but is designed to work with the Library by being compiled or
|
||||
linked with it, is called a "work that uses the Library". Such a
|
||||
work, in isolation, is not a derivative work of the Library, and
|
||||
therefore falls outside the scope of this License.
|
||||
|
||||
However, linking a "work that uses the Library" with the Library
|
||||
creates an executable that is a derivative of the Library (because it
|
||||
contains portions of the Library), rather than a "work that uses the
|
||||
library". The executable is therefore covered by this License.
|
||||
Section 6 states terms for distribution of such executables.
|
||||
|
||||
When a "work that uses the Library" uses material from a header file
|
||||
that is part of the Library, the object code for the work may be a
|
||||
derivative work of the Library even though the source code is not.
|
||||
Whether this is true is especially significant if the work can be
|
||||
linked without the Library, or if the work is itself a library. The
|
||||
threshold for this to be true is not precisely defined by law.
|
||||
|
||||
If such an object file uses only numerical parameters, data
|
||||
structure layouts and accessors, and small macros and small inline
|
||||
functions (ten lines or less in length), then the use of the object
|
||||
file is unrestricted, regardless of whether it is legally a derivative
|
||||
work. (Executables containing this object code plus portions of the
|
||||
Library will still fall under Section 6.)
|
||||
|
||||
Otherwise, if the work is a derivative of the Library, you may
|
||||
distribute the object code for the work under the terms of Section 6.
|
||||
Any executables containing that work also fall under Section 6,
|
||||
whether or not they are linked directly with the Library itself.
|
||||
|
||||
6. As an exception to the Sections above, you may also combine or
|
||||
link a "work that uses the Library" with the Library to produce a
|
||||
work containing portions of the Library, and distribute that work
|
||||
under terms of your choice, provided that the terms permit
|
||||
modification of the work for the customer's own use and reverse
|
||||
engineering for debugging such modifications.
|
||||
|
||||
You must give prominent notice with each copy of the work that the
|
||||
Library is used in it and that the Library and its use are covered by
|
||||
this License. You must supply a copy of this License. If the work
|
||||
during execution displays copyright notices, you must include the
|
||||
copyright notice for the Library among them, as well as a reference
|
||||
directing the user to the copy of this License. Also, you must do one
|
||||
of these things:
|
||||
|
||||
a) Accompany the work with the complete corresponding
|
||||
machine-readable source code for the Library including whatever
|
||||
changes were used in the work (which must be distributed under
|
||||
Sections 1 and 2 above); and, if the work is an executable linked
|
||||
with the Library, with the complete machine-readable "work that
|
||||
uses the Library", as object code and/or source code, so that the
|
||||
user can modify the Library and then relink to produce a modified
|
||||
executable containing the modified Library. (It is understood
|
||||
that the user who changes the contents of definitions files in the
|
||||
Library will not necessarily be able to recompile the application
|
||||
to use the modified definitions.)
|
||||
|
||||
b) Use a suitable shared library mechanism for linking with the
|
||||
Library. A suitable mechanism is one that (1) uses at run time a
|
||||
copy of the library already present on the user's computer system,
|
||||
rather than copying library functions into the executable, and (2)
|
||||
will operate properly with a modified version of the library, if
|
||||
the user installs one, as long as the modified version is
|
||||
interface-compatible with the version that the work was made with.
|
||||
|
||||
c) Accompany the work with a written offer, valid for at
|
||||
least three years, to give the same user the materials
|
||||
specified in Subsection 6a, above, for a charge no more
|
||||
than the cost of performing this distribution.
|
||||
|
||||
d) If distribution of the work is made by offering access to copy
|
||||
from a designated place, offer equivalent access to copy the above
|
||||
specified materials from the same place.
|
||||
|
||||
e) Verify that the user has already received a copy of these
|
||||
materials or that you have already sent this user a copy.
|
||||
|
||||
For an executable, the required form of the "work that uses the
|
||||
Library" must include any data and utility programs needed for
|
||||
reproducing the executable from it. However, as a special exception,
|
||||
the materials to be distributed need not include anything that is
|
||||
normally distributed (in either source or binary form) with the major
|
||||
components (compiler, kernel, and so on) of the operating system on
|
||||
which the executable runs, unless that component itself accompanies
|
||||
the executable.
|
||||
|
||||
It may happen that this requirement contradicts the license
|
||||
restrictions of other proprietary libraries that do not normally
|
||||
accompany the operating system. Such a contradiction means you cannot
|
||||
use both them and the Library together in an executable that you
|
||||
distribute.
|
||||
|
||||
7. You may place library facilities that are a work based on the
|
||||
Library side-by-side in a single library together with other library
|
||||
facilities not covered by this License, and distribute such a combined
|
||||
library, provided that the separate distribution of the work based on
|
||||
the Library and of the other library facilities is otherwise
|
||||
permitted, and provided that you do these two things:
|
||||
|
||||
a) Accompany the combined library with a copy of the same work
|
||||
based on the Library, uncombined with any other library
|
||||
facilities. This must be distributed under the terms of the
|
||||
Sections above.
|
||||
|
||||
b) Give prominent notice with the combined library of the fact
|
||||
that part of it is a work based on the Library, and explaining
|
||||
where to find the accompanying uncombined form of the same work.
|
||||
|
||||
8. You may not copy, modify, sublicense, link with, or distribute
|
||||
the Library except as expressly provided under this License. Any
|
||||
attempt otherwise to copy, modify, sublicense, link with, or
|
||||
distribute the Library is void, and will automatically terminate your
|
||||
rights under this License. However, parties who have received copies,
|
||||
or rights, from you under this License will not have their licenses
|
||||
terminated so long as such parties remain in full compliance.
|
||||
|
||||
9. You are not required to accept this License, since you have not
|
||||
signed it. However, nothing else grants you permission to modify or
|
||||
distribute the Library or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Library (or any work based on the
|
||||
Library), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Library or works based on it.
|
||||
|
||||
10. Each time you redistribute the Library (or any work based on the
|
||||
Library), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute, link with or modify the Library
|
||||
subject to these terms and conditions. You may not impose any further
|
||||
restrictions on the recipients' exercise of the rights granted herein.
|
||||
You are not responsible for enforcing compliance by third parties with
|
||||
this License.
|
||||
|
||||
11. If, as a consequence of a court judgment or allegation of patent
|
||||
infringement or for any other reason (not limited to patent issues),
|
||||
conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot
|
||||
distribute so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you
|
||||
may not distribute the Library at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Library by
|
||||
all those who receive copies directly or indirectly through you, then
|
||||
the only way you could satisfy both it and this License would be to
|
||||
refrain entirely from distribution of the Library.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under any
|
||||
particular circumstance, the balance of the section is intended to apply,
|
||||
and the section as a whole is intended to apply in other circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any
|
||||
patents or other property right claims or to contest validity of any
|
||||
such claims; this section has the sole purpose of protecting the
|
||||
integrity of the free software distribution system which is
|
||||
implemented by public license practices. Many people have made
|
||||
generous contributions to the wide range of software distributed
|
||||
through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing
|
||||
to distribute software through any other system and a licensee cannot
|
||||
impose that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to
|
||||
be a consequence of the rest of this License.
|
||||
|
||||
12. If the distribution and/or use of the Library is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Library under this License may add
|
||||
an explicit geographical distribution limitation excluding those countries,
|
||||
so that distribution is permitted only in or among countries not thus
|
||||
excluded. In such case, this License incorporates the limitation as if
|
||||
written in the body of this License.
|
||||
|
||||
13. The Free Software Foundation may publish revised and/or new
|
||||
versions of the Lesser General Public License from time to time.
|
||||
Such new versions will be similar in spirit to the present version,
|
||||
but may differ in detail to address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Library
|
||||
specifies a version number of this License which applies to it and
|
||||
"any later version", you have the option of following the terms and
|
||||
conditions either of that version or of any later version published by
|
||||
the Free Software Foundation. If the Library does not specify a
|
||||
license version number, you may choose any version ever published by
|
||||
the Free Software Foundation.
|
||||
|
||||
14. If you wish to incorporate parts of the Library into other free
|
||||
programs whose distribution conditions are incompatible with these,
|
||||
write to the author to ask for permission. For software which is
|
||||
copyrighted by the Free Software Foundation, write to the Free
|
||||
Software Foundation; we sometimes make exceptions for this. Our
|
||||
decision will be guided by the two goals of preserving the free status
|
||||
of all derivatives of our free software and of promoting the sharing
|
||||
and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
|
||||
WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
|
||||
EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
|
||||
OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
|
||||
KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
|
||||
LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
|
||||
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
|
||||
WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
|
||||
AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
|
||||
FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
|
||||
CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
|
||||
LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
|
||||
RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
|
||||
FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
|
||||
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
|
||||
DAMAGES.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Libraries
|
||||
|
||||
If you develop a new library, and you want it to be of the greatest
|
||||
possible use to the public, we recommend making it free software that
|
||||
everyone can redistribute and change. You can do so by permitting
|
||||
redistribution under these terms (or, alternatively, under the terms of the
|
||||
ordinary General Public License).
|
||||
|
||||
To apply these terms, attach the following notices to the library. It is
|
||||
safest to attach them to the start of each source file to most effectively
|
||||
convey the exclusion of warranty; and each file should have at least the
|
||||
"copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the library's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or your
|
||||
school, if any, to sign a "copyright disclaimer" for the library, if
|
||||
necessary. Here is a sample; alter the names:
|
||||
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the
|
||||
library `Frob' (a library for tweaking knobs) written by James Random Hacker.
|
||||
|
||||
<signature of Ty Coon>, 1 April 1990
|
||||
Ty Coon, President of Vice
|
||||
|
||||
That's all there is to it!
|
||||
|
@ -1,30 +0,0 @@
|
||||
How to install LibCSP
|
||||
=====================
|
||||
|
||||
CSP uses the `waf` build system (http://code.google.com/p/waf/). In order to
|
||||
compile CSP, you first need to configure the toolchain, what operating system
|
||||
to compile for, the location of required libraries and whether to enable
|
||||
certain optional features.
|
||||
|
||||
To configure CSP to build with the AVR32 toolchain for FreeRTOS and output
|
||||
the compiled libcsp.a and header files to the install directory, issue:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
./waf configure --toolchain=avr32- --with-os=freertos --prefix=install
|
||||
|
||||
When compiling for FreeRTOS, the path to the FreeRTOS header files must be
|
||||
specified with `--with-freertos=PATH.`
|
||||
|
||||
A number of optional features can be enabled by from the configure script.
|
||||
Support for XTEA encryption can e.g. be enabled with `--enable-xtea`. Run
|
||||
`./waf configure --help` to list the available configure options.
|
||||
|
||||
The CAN drivers can be enabled by appending the configure option `--with-driver-can=CHIP`,
|
||||
where CHIP is one of 'socketcan', 'at91sam7a1', 'at91sam7a3' or 'at90can128'.
|
||||
|
||||
To build and copy the library to the location specified with --prefix, use:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
./waf build install
|
@ -1,41 +0,0 @@
|
||||
The Cubesat Space Protocol
|
||||
==========================
|
||||
|
||||
Cubesat Space Protocol (CSP) is a small protocol stack written in C. CSP is designed to ease communication between distributed embedded systems in smaller networks, such as Cubesats. The design follows the TCP/IP model and includes a transport protocol, a routing protocol and several MAC-layer interfaces. The core of libcsp includes a router, a socket buffer pool and a connection oriented socket API.
|
||||
|
||||
The protocol is based on a 32-bit header containing both transport and network-layer information. Its implementation is designed for, but not limited to, embedded systems such as the 8-bit AVR microprocessor and the 32-bit ARM and AVR from Atmel. The implementation is written in GNU C and is currently ported to run on FreeRTOS or POSIX operating systems such as Linux.
|
||||
|
||||
The idea is to give sub-system developers of cubesats the same features of a TCP/IP stack, but without adding the huge overhead of the IP header. The small footprint and simple implementation allows a small 8-bit system with less than 4 kB of RAM to be fully connected on the network. This allows all subsystems to provide their services on the same network level, without any master node required. Using a service oriented architecture has several advantages compared to the traditional mater/slave topology used on many cubesats.
|
||||
|
||||
* Standardised network protocol: All subsystems can communicate with eachother
|
||||
* Service loose coupling: Services maintain a relationship that minimizes dependencies between subsystems
|
||||
* Service abstraction: Beyond descriptions in the service contract, services hide logic from the outside world
|
||||
* Service reusability: Logic is divided into services with the intention of promoting reuse.
|
||||
* Service autonomy: Services have control over the logic they encapsulate.
|
||||
* Service Redundancy: Easily add redundant services to the bus
|
||||
* Reduces single point of failure: The complexity is moved from a single master node to several well defines services on the network
|
||||
|
||||
The implementation of LibCSP is written with simplicity in mind, but it's compile time configuration allows it to have some rather advanced features as well:
|
||||
|
||||
Features
|
||||
--------
|
||||
|
||||
* Thread safe Socket API
|
||||
* Router task with Quality of Services
|
||||
* Connection-oriented operation (RFC 908 and 1151).
|
||||
* Connection-less operation (similar to UDP)
|
||||
* ICMP-like requests such as ping and buffer status.
|
||||
* Loopback interface
|
||||
* Very Small Footprint 48 kB code and less that 1kB ram required on ARM
|
||||
* Zero-copy buffer and queue system
|
||||
* Modular network interface system
|
||||
* Modular OS interface, ported to FreeRTOS, windows (cygwin) and Linux
|
||||
* Broadcast traffic
|
||||
* Promiscuous mode
|
||||
* Encrypted packets with XTEA in CTR mode
|
||||
* Truncated HMAC-SHA1 Authentication (RFC 2104)
|
||||
|
||||
LGPL Software license
|
||||
---------------------
|
||||
The source code is available under an LGPL 2.1 license. See COPYING for the license text.
|
||||
|
170
gomspace/libcsp/waf
vendored
170
gomspace/libcsp/waf
vendored
File diff suppressed because one or more lines are too long
@ -1,346 +0,0 @@
|
||||
#!/usr/bin/env python
|
||||
# encoding: utf-8
|
||||
|
||||
# Cubesat Space Protocol - A small network-layer protocol designed for Cubesats
|
||||
# Copyright (C) 2012 GomSpace ApS (http://www.gomspace.com)
|
||||
# Copyright (C) 2012 AAUSAT3 Project (http://aausat3.space.aau.dk)
|
||||
#
|
||||
# This library is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU Lesser General Public
|
||||
# License as published by the Free Software Foundation; either
|
||||
# version 2.1 of the License, or (at your option) any later version.
|
||||
#
|
||||
# This library is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
# Lesser General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Lesser General Public
|
||||
# License along with this library; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
import os
|
||||
|
||||
APPNAME = 'libcsp'
|
||||
VERSION = '1.5'
|
||||
|
||||
top = '.'
|
||||
out = 'build'
|
||||
|
||||
def options(ctx):
|
||||
# Load GCC options
|
||||
ctx.load('gcc')
|
||||
|
||||
ctx.add_option('--toolchain', default=None, help='Set toolchain prefix')
|
||||
|
||||
# Set libcsp options
|
||||
gr = ctx.add_option_group('libcsp options')
|
||||
gr.add_option('--includes', default='', help='Add additional include paths. Separate with comma')
|
||||
gr.add_option('--install-csp', action='store_true', help='Installs CSP headers and lib')
|
||||
|
||||
gr.add_option('--disable-output', action='store_true', help='Disable CSP output')
|
||||
gr.add_option('--disable-stlib', action='store_true', help='Build objects only')
|
||||
gr.add_option('--enable-rdp', action='store_true', help='Enable RDP support')
|
||||
gr.add_option('--enable-qos', action='store_true', help='Enable Quality of Service support')
|
||||
gr.add_option('--enable-promisc', action='store_true', help='Enable promiscuous mode support')
|
||||
gr.add_option('--enable-crc32', action='store_true', help='Enable CRC32 support')
|
||||
gr.add_option('--enable-hmac', action='store_true', help='Enable HMAC-SHA1 support')
|
||||
gr.add_option('--enable-xtea', action='store_true', help='Enable XTEA support')
|
||||
gr.add_option('--enable-bindings', action='store_true', help='Enable Python bindings')
|
||||
gr.add_option('--enable-python3-bindings', action='store_true', help='Enable Python3 bindings')
|
||||
gr.add_option('--enable-examples', action='store_true', help='Enable examples')
|
||||
gr.add_option('--enable-dedup', action='store_true', help='Enable packet deduplicator')
|
||||
|
||||
# Interfaces
|
||||
gr.add_option('--enable-if-i2c', action='store_true', help='Enable I2C interface')
|
||||
gr.add_option('--enable-if-kiss', action='store_true', help='Enable KISS/RS.232 interface')
|
||||
gr.add_option('--enable-if-can', action='store_true', help='Enable CAN interface')
|
||||
gr.add_option('--enable-if-zmqhub', action='store_true', help='Enable ZMQHUB interface')
|
||||
|
||||
# Drivers
|
||||
gr.add_option('--enable-can-socketcan', action='store_true', help='Enable Linux socketcan driver')
|
||||
gr.add_option('--with-driver-usart', default=None, metavar='DRIVER', help='Build USART driver. [windows, linux, None]')
|
||||
|
||||
# OS
|
||||
gr.add_option('--with-os', metavar='OS', default='posix', help='Set operating system. Must be either \'posix\', \'macosx\', \'windows\' or \'freertos\'')
|
||||
gr.add_option('--enable-init-shutdown', action='store_true', help='Use init system commands for shutdown/reboot')
|
||||
|
||||
# Options
|
||||
gr.add_option('--with-rdp-max-window', metavar='SIZE', type=int, default=20, help='Set maximum window size for RDP')
|
||||
gr.add_option('--with-max-bind-port', metavar='PORT', type=int, default=31, help='Set maximum bindable port')
|
||||
gr.add_option('--with-max-connections', metavar='COUNT', type=int, default=10, help='Set maximum number of concurrent connections')
|
||||
gr.add_option('--with-conn-queue-length', metavar='SIZE', type=int, default=100, help='Set maximum number of packets in queue for a connection')
|
||||
gr.add_option('--with-router-queue-length', metavar='SIZE', type=int, default=10, help='Set maximum number of packets to be queued at the input of the router')
|
||||
gr.add_option('--with-padding', metavar='BYTES', type=int, default=8, help='Set padding bytes before packet length field')
|
||||
gr.add_option('--with-loglevel', metavar='LEVEL', default='debug', help='Set minimum compile time log level. Must be one of \'error\', \'warn\', \'info\' or \'debug\'')
|
||||
gr.add_option('--with-rtable', metavar='TABLE', default='static', help='Set routing table type')
|
||||
gr.add_option('--with-connection-so', metavar='CSP_SO', type=int, default='0x0000', help='Set outgoing connection socket options, see csp.h for valid values')
|
||||
gr.add_option('--with-bufalign', metavar='BYTES', type=int, help='Set buffer alignment')
|
||||
|
||||
def configure(ctx):
|
||||
# Validate OS
|
||||
if not ctx.options.with_os in ('posix', 'windows', 'freertos', 'macosx'):
|
||||
ctx.fatal('--with-os must be either \'posix\', \'windows\', \'macosx\' or \'freertos\'')
|
||||
|
||||
# Validate USART drivers
|
||||
if not ctx.options.with_driver_usart in (None, 'windows', 'linux'):
|
||||
ctx.fatal('--with-driver-usart must be either \'windows\' or \'linux\'')
|
||||
|
||||
if not ctx.options.with_loglevel in ('error', 'warn', 'info', 'debug'):
|
||||
ctx.fatal('--with-loglevel must be either \'error\', \'warn\', \'info\' or \'debug\'')
|
||||
|
||||
# Setup and validate toolchain
|
||||
if (len(ctx.stack_path) <= 1) and ctx.options.toolchain:
|
||||
ctx.env.CC = ctx.options.toolchain + 'gcc'
|
||||
ctx.env.AR = ctx.options.toolchain + 'ar'
|
||||
|
||||
ctx.load('gcc')
|
||||
|
||||
# Set git revision define
|
||||
git_rev = os.popen('git describe --always 2> /dev/null || echo unknown').read().strip()
|
||||
|
||||
# Setup DEFINES
|
||||
ctx.define('GIT_REV', git_rev)
|
||||
|
||||
# Set build output format
|
||||
ctx.env.FEATURES = ['c']
|
||||
if not ctx.options.disable_stlib:
|
||||
ctx.env.FEATURES += ['cstlib']
|
||||
|
||||
# Setup CFLAGS
|
||||
if (len(ctx.stack_path) <= 1) and (len(ctx.env.CFLAGS) == 0):
|
||||
ctx.env.prepend_value('CFLAGS', ["-std=gnu99", "-g", "-Os", "-Wall", "-Wextra", "-Wshadow", "-Wcast-align", "-Wwrite-strings", "-Wno-unused-parameter"])
|
||||
|
||||
# Setup extra includes
|
||||
ctx.env.append_unique('INCLUDES_CSP', ['include'] + ctx.options.includes.split(','))
|
||||
|
||||
# Add default files
|
||||
ctx.env.append_unique('FILES_CSP', ['src/*.c','src/interfaces/csp_if_lo.c','src/transport/csp_udp.c','src/arch/{0}/**/*.c'.format(ctx.options.with_os)])
|
||||
|
||||
# Store OS as env variable
|
||||
ctx.env.append_unique('OS', ctx.options.with_os)
|
||||
|
||||
# Libs
|
||||
if 'posix' in ctx.env.OS:
|
||||
ctx.env.append_unique('LIBS', ['rt', 'pthread', 'util'])
|
||||
elif 'macosx' in ctx.env.OS:
|
||||
ctx.env.append_unique('LIBS', ['pthread'])
|
||||
|
||||
# Check for recursion
|
||||
if ctx.path == ctx.srcnode:
|
||||
ctx.options.install_csp = True
|
||||
|
||||
# Windows build flags
|
||||
if ctx.options.with_os == 'windows':
|
||||
ctx.env.append_unique('CFLAGS', ['-D_WIN32_WINNT=0x0600'])
|
||||
|
||||
ctx.define_cond('CSP_FREERTOS', ctx.options.with_os == 'freertos')
|
||||
ctx.define_cond('CSP_POSIX', ctx.options.with_os == 'posix')
|
||||
ctx.define_cond('CSP_WINDOWS', ctx.options.with_os == 'windows')
|
||||
ctx.define_cond('CSP_MACOSX', ctx.options.with_os == 'macosx')
|
||||
|
||||
# Add CAN driver
|
||||
if ctx.options.enable_can_socketcan:
|
||||
ctx.env.append_unique('FILES_CSP', 'src/drivers/can/can_socketcan.c')
|
||||
|
||||
# Add USART driver
|
||||
if ctx.options.with_driver_usart != None:
|
||||
ctx.env.append_unique('FILES_CSP', 'src/drivers/usart/usart_{0}.c'.format(ctx.options.with_driver_usart))
|
||||
|
||||
# Interfaces
|
||||
if ctx.options.enable_if_can:
|
||||
ctx.env.append_unique('FILES_CSP', 'src/interfaces/csp_if_can.c')
|
||||
ctx.env.append_unique('FILES_CSP', 'src/interfaces/csp_if_can_pbuf.c')
|
||||
if ctx.options.enable_if_i2c:
|
||||
ctx.env.append_unique('FILES_CSP', 'src/interfaces/csp_if_i2c.c')
|
||||
if ctx.options.enable_if_kiss:
|
||||
ctx.env.append_unique('FILES_CSP', 'src/interfaces/csp_if_kiss.c')
|
||||
if ctx.options.enable_if_zmqhub:
|
||||
ctx.env.append_unique('FILES_CSP', 'src/interfaces/csp_if_zmqhub.c')
|
||||
ctx.check_cfg(package='libzmq', args='--cflags --libs')
|
||||
ctx.env.append_unique('LIBS', ctx.env.LIB_LIBZMQ)
|
||||
|
||||
# Store configuration options
|
||||
ctx.env.ENABLE_BINDINGS = ctx.options.enable_bindings
|
||||
ctx.env.ENABLE_EXAMPLES = ctx.options.enable_examples
|
||||
|
||||
# Check for python development
|
||||
if ctx.options.enable_bindings:
|
||||
ctx.env.LIBCSP_PYTHON2 = ctx.check_cfg(package='python2', args='--cflags --libs', atleast_version='2.7', mandatory=False)
|
||||
if ctx.options.enable_python3_bindings:
|
||||
ctx.env.LIBCSP_PYTHON3 = ctx.check_cfg(package='python3', args='--cflags --libs', atleast_version='3.5', mandatory=False)
|
||||
|
||||
# Create config file
|
||||
if not ctx.options.disable_output:
|
||||
ctx.env.append_unique('FILES_CSP', 'src/csp_debug.c')
|
||||
else:
|
||||
ctx.env.append_unique('EXCL_CSP', 'src/csp_debug.c')
|
||||
|
||||
if ctx.options.enable_rdp:
|
||||
ctx.env.append_unique('FILES_CSP', 'src/transport/csp_rdp.c')
|
||||
|
||||
if ctx.options.enable_crc32:
|
||||
ctx.env.append_unique('FILES_CSP', 'src/csp_crc32.c')
|
||||
else:
|
||||
ctx.env.append_unique('EXCL_CSP', 'src/csp_crc32.c')
|
||||
|
||||
if not ctx.options.enable_dedup:
|
||||
ctx.env.append_unique('EXCL_CSP', 'src/csp_dedup.c')
|
||||
|
||||
if ctx.options.enable_hmac:
|
||||
ctx.env.append_unique('FILES_CSP', 'src/crypto/csp_hmac.c')
|
||||
ctx.env.append_unique('FILES_CSP', 'src/crypto/csp_sha1.c')
|
||||
|
||||
if ctx.options.enable_xtea:
|
||||
ctx.env.append_unique('FILES_CSP', 'src/crypto/csp_xtea.c')
|
||||
ctx.env.append_unique('FILES_CSP', 'src/crypto/csp_sha1.c')
|
||||
|
||||
ctx.env.append_unique('FILES_CSP', 'src/rtable/csp_rtable_' + ctx.options.with_rtable + '.c')
|
||||
|
||||
ctx.define_cond('CSP_DEBUG', not ctx.options.disable_output)
|
||||
ctx.define_cond('CSP_USE_RDP', ctx.options.enable_rdp)
|
||||
ctx.define_cond('CSP_USE_CRC32', ctx.options.enable_crc32)
|
||||
ctx.define_cond('CSP_USE_HMAC', ctx.options.enable_hmac)
|
||||
ctx.define_cond('CSP_USE_XTEA', ctx.options.enable_xtea)
|
||||
ctx.define_cond('CSP_USE_PROMISC', ctx.options.enable_promisc)
|
||||
ctx.define_cond('CSP_USE_QOS', ctx.options.enable_qos)
|
||||
ctx.define_cond('CSP_USE_DEDUP', ctx.options.enable_dedup)
|
||||
ctx.define_cond('CSP_USE_INIT_SHUTDOWN', ctx.options.enable_init_shutdown)
|
||||
ctx.define_cond('CSP_USE_CAN', ctx.options.enable_if_can)
|
||||
ctx.define_cond('CSP_USE_I2C', ctx.options.enable_if_i2c)
|
||||
ctx.define_cond('CSP_USE_KISS', ctx.options.enable_if_kiss)
|
||||
ctx.define_cond('CSP_USE_ZMQHUB', ctx.options.enable_if_zmqhub)
|
||||
ctx.define('CSP_CONN_MAX', ctx.options.with_max_connections)
|
||||
ctx.define('CSP_CONN_QUEUE_LENGTH', ctx.options.with_conn_queue_length)
|
||||
ctx.define('CSP_FIFO_INPUT', ctx.options.with_router_queue_length)
|
||||
ctx.define('CSP_MAX_BIND_PORT', ctx.options.with_max_bind_port)
|
||||
ctx.define('CSP_RDP_MAX_WINDOW', ctx.options.with_rdp_max_window)
|
||||
ctx.define('CSP_PADDING_BYTES', ctx.options.with_padding)
|
||||
ctx.define('CSP_CONNECTION_SO', ctx.options.with_connection_so)
|
||||
|
||||
if ctx.options.with_bufalign != None:
|
||||
ctx.define('CSP_BUFFER_ALIGN', ctx.options.with_bufalign)
|
||||
|
||||
# Set logging level
|
||||
ctx.define_cond('CSP_LOG_LEVEL_DEBUG', ctx.options.with_loglevel in ('debug'))
|
||||
ctx.define_cond('CSP_LOG_LEVEL_INFO', ctx.options.with_loglevel in ('debug', 'info'))
|
||||
ctx.define_cond('CSP_LOG_LEVEL_WARN', ctx.options.with_loglevel in ('debug', 'info', 'warn'))
|
||||
ctx.define_cond('CSP_LOG_LEVEL_ERROR', ctx.options.with_loglevel in ('debug', 'info', 'warn', 'error'))
|
||||
|
||||
# Check compiler endianness
|
||||
endianness = ctx.check_endianness()
|
||||
ctx.define_cond('CSP_LITTLE_ENDIAN', endianness == 'little')
|
||||
ctx.define_cond('CSP_BIG_ENDIAN', endianness == 'big')
|
||||
|
||||
# Check for stdbool.h
|
||||
ctx.check_cc(header_name='stdbool.h', mandatory=False, define_name='CSP_HAVE_STDBOOL_H', type='cstlib')
|
||||
|
||||
# Check for libsocketcan.h
|
||||
if ctx.options.enable_if_can and ctx.options.enable_can_socketcan:
|
||||
have_socketcan = ctx.check_cc(lib='socketcan', mandatory=False, define_name='CSP_HAVE_LIBSOCKETCAN')
|
||||
if have_socketcan:
|
||||
ctx.env.append_unique('LIBS', ['socketcan'])
|
||||
|
||||
ctx.define('LIBCSP_VERSION', VERSION)
|
||||
|
||||
ctx.write_config_header('include/csp/csp_autoconfig.h')
|
||||
|
||||
def build(ctx):
|
||||
|
||||
# Set install path for header files
|
||||
install_path = False
|
||||
if ctx.options.install_csp:
|
||||
install_path = '${PREFIX}/lib'
|
||||
ctx.install_files('${PREFIX}/include/csp', ctx.path.ant_glob('include/csp/*.h'))
|
||||
ctx.install_files('${PREFIX}/include/csp/interfaces', 'include/csp/interfaces/csp_if_lo.h')
|
||||
|
||||
if 'src/interfaces/csp_if_can.c' in ctx.env.FILES_CSP:
|
||||
ctx.install_files('${PREFIX}/include/csp/interfaces', 'include/csp/interfaces/csp_if_can.h')
|
||||
if 'src/interfaces/csp_if_i2c.c' in ctx.env.FILES_CSP:
|
||||
ctx.install_files('${PREFIX}/include/csp/interfaces', 'include/csp/interfaces/csp_if_i2c.h')
|
||||
if 'src/interfaces/csp_if_kiss.c' in ctx.env.FILES_CSP:
|
||||
ctx.install_files('${PREFIX}/include/csp/interfaces', 'include/csp/interfaces/csp_if_kiss.h')
|
||||
if 'src/interfaces/csp_if_zmqhub.c' in ctx.env.FILES_CSP:
|
||||
ctx.install_files('${PREFIX}/include/csp/interfaces', 'include/csp/interfaces/csp_if_zmqhub.h')
|
||||
if 'src/drivers/usart/usart_{0}.c'.format(ctx.options.with_driver_usart) in ctx.env.FILES_CSP:
|
||||
ctx.install_as('${PREFIX}/include/csp/drivers/usart.h', 'include/csp/drivers/usart.h')
|
||||
if 'src/drivers/can/can_socketcan.c' in ctx.env.FILES_CSP:
|
||||
ctx.install_as('${PREFIX}/include/csp/drivers/can_socketcan.h', 'include/csp/drivers/can_socketcan.h')
|
||||
|
||||
ctx.install_files('${PREFIX}/include/csp', 'include/csp/csp_autoconfig.h', cwd=ctx.bldnode)
|
||||
|
||||
ctx(export_includes='include', name='csp_h')
|
||||
|
||||
ctx(features=ctx.env.FEATURES,
|
||||
source=ctx.path.ant_glob(ctx.env.FILES_CSP, excl=ctx.env.EXCL_CSP),
|
||||
target = 'csp',
|
||||
includes= ctx.env.INCLUDES_CSP,
|
||||
export_includes = ctx.env.INCLUDES_CSP,
|
||||
use = 'include freertos_h',
|
||||
install_path = install_path,
|
||||
)
|
||||
|
||||
# Build shared library for Python bindings
|
||||
if ctx.env.ENABLE_BINDINGS:
|
||||
ctx.shlib(source = ctx.path.ant_glob(ctx.env.FILES_CSP, excl=ctx.env.EXCL_CSP),
|
||||
name = 'csp_shlib',
|
||||
target = 'csp',
|
||||
includes = ctx.env.INCLUDES_CSP,
|
||||
export_includes = 'include',
|
||||
use = ['include'],
|
||||
lib = ctx.env.LIBS)
|
||||
|
||||
# python3 bindings
|
||||
if ctx.env.LIBCSP_PYTHON3:
|
||||
ctx.shlib(source = ['src/bindings/python/pycsp.c'],
|
||||
target = 'csp_py3',
|
||||
includes = ctx.env.INCLUDES_CSP + ctx.env.INCLUDES_PYTHON3,
|
||||
export_includes = 'include',
|
||||
use = ['csp_shlib', 'include'],
|
||||
lib = ctx.env.LIBS)
|
||||
|
||||
# python2 bindings
|
||||
if ctx.env.LIBCSP_PYTHON2:
|
||||
ctx.shlib(source = ['src/bindings/python/pycsp.c'],
|
||||
target = 'csp_py2',
|
||||
includes = ctx.env.INCLUDES_CSP + ctx.env.INCLUDES_PYTHON2,
|
||||
export_includes = 'include',
|
||||
use = ['csp_shlib', 'include'],
|
||||
lib = ctx.env.LIBS)
|
||||
|
||||
if ctx.env.ENABLE_EXAMPLES:
|
||||
ctx.program(source = ctx.path.ant_glob('examples/simple.c'),
|
||||
target = 'simple',
|
||||
includes = ctx.env.INCLUDES_CSP,
|
||||
lib = ctx.env.LIBS,
|
||||
use = 'csp')
|
||||
|
||||
if ctx.options.enable_if_kiss:
|
||||
ctx.program(source = 'examples/kiss.c',
|
||||
target = 'kiss',
|
||||
includes = ctx.env.INCLUDES_CSP,
|
||||
lib = ctx.env.LIBS,
|
||||
use = 'csp')
|
||||
|
||||
if ctx.options.enable_if_zmqhub:
|
||||
ctx.program(source = 'examples/zmqproxy.c',
|
||||
target = 'zmqproxy',
|
||||
includes = ctx.env.INCLUDES_CSP,
|
||||
lib = ctx.env.LIBS,
|
||||
use = 'csp')
|
||||
|
||||
if 'posix' in ctx.env.OS:
|
||||
ctx.program(source = 'examples/csp_if_fifo.c',
|
||||
target = 'fifo',
|
||||
includes = ctx.env.INCLUDES_CSP,
|
||||
lib = ctx.env.LIBS,
|
||||
use = 'csp')
|
||||
|
||||
if 'windows' in ctx.env.OS:
|
||||
ctx.program(source = ctx.path.ant_glob('examples/csp_if_fifo_windows.c'),
|
||||
target = 'csp_if_fifo',
|
||||
includes = ctx.env.INCLUDES_CSP,
|
||||
use = 'csp')
|
||||
|
||||
def dist(ctx):
|
||||
ctx.excl = 'build/* **/.* **/*.pyc **/*.o **/*~ *.tar.gz'
|
Loading…
Reference in New Issue
Block a user