rtt-f030/components/external/nanopb
Bright Pan a61d228b76 Nanopb is a plain-C implementation of Google's Protocol Buffers data
format. It is targeted at 32 bit microcontrollers, but is also fit for
other embedded systems with tight (2-10 kB ROM, <1 kB RAM) memory
constraints.(http://koti.kapsi.fi/jpa/nanopb/)

How to use the example:
	1. move examples/nanopb to bsp/xxxx/
	2. enable macro RT_USING_NANOPB in rtconfig.h
	3. regenerate the project file (scons --target=xxxx)
	4. rebuild the project
2015-03-10 18:24:17 +08:00
..
CHANGELOG.txt Nanopb is a plain-C implementation of Google's Protocol Buffers data 2015-03-10 18:24:17 +08:00
README.txt Nanopb is a plain-C implementation of Google's Protocol Buffers data 2015-03-10 18:24:17 +08:00
SConscript Nanopb is a plain-C implementation of Google's Protocol Buffers data 2015-03-10 18:24:17 +08:00
pb.h Nanopb is a plain-C implementation of Google's Protocol Buffers data 2015-03-10 18:24:17 +08:00
pb_common.c Nanopb is a plain-C implementation of Google's Protocol Buffers data 2015-03-10 18:24:17 +08:00
pb_common.h Nanopb is a plain-C implementation of Google's Protocol Buffers data 2015-03-10 18:24:17 +08:00
pb_decode.c Nanopb is a plain-C implementation of Google's Protocol Buffers data 2015-03-10 18:24:17 +08:00
pb_decode.h Nanopb is a plain-C implementation of Google's Protocol Buffers data 2015-03-10 18:24:17 +08:00
pb_encode.c Nanopb is a plain-C implementation of Google's Protocol Buffers data 2015-03-10 18:24:17 +08:00
pb_encode.h Nanopb is a plain-C implementation of Google's Protocol Buffers data 2015-03-10 18:24:17 +08:00

README.txt

Nanopb is a small code-size Protocol Buffers implementation in ansi C. It is
especially suitable for use in microcontrollers, but fits any memory
restricted system.

Homepage: http://kapsi.fi/~jpa/nanopb/




Using the nanopb library
========================
To use the nanopb library, you need to do two things:

1) Compile your .proto files for nanopb, using protoc.
2) Include pb_encode.c and pb_decode.c in your project.

The easiest way to get started is to study the project in "examples/simple".
It contains a Makefile, which should work directly under most Linux systems.
However, for any other kind of build system, see the manual steps in
README.txt in that folder.



Using the Protocol Buffers compiler (protoc)
============================================
The nanopb generator is implemented as a plugin for the Google's own protoc
compiler. This has the advantage that there is no need to reimplement the
basic parsing of .proto files. However, it does mean that you need the
Google's protobuf library in order to run the generator.

If you have downloaded a binary package for nanopb (either Windows, Linux or
Mac OS X version), the 'protoc' binary is included in the 'generator-bin'
folder. In this case, you are ready to go. Simply run this command:

    generator-bin/protoc --nanopb_out=. myprotocol.proto

However, if you are using a git checkout or a plain source distribution, you
need to provide your own version of protoc and the Google's protobuf library.
On Linux, the necessary packages are protobuf-compiler and python-protobuf.
On Windows, you can either build Google's protobuf library from source or use
one of the binary distributions of it. In either case, if you use a separate
protoc, you need to manually give the path to nanopb generator:

    protoc --plugin=protoc-gen-nanopb=nanopb/generator/protoc-gen-nanopb ...



Running the tests
=================
If you want to perform further development of the nanopb core, or to verify
its functionality using your compiler and platform, you'll want to run the
test suite. The build rules for the test suite are implemented using Scons,
so you need to have that installed. To run the tests:

    cd tests
    scons

This will show the progress of various test cases. If the output does not
end in an error, the test cases were successful.