• Home
Name Date Size #Lines LOC

..--

docs/03-May-2024-5,8845,464

examples/03-May-2024-1,161787

extra/03-May-2024-369295

generator/03-May-2024-10,7337,937

tests/03-May-2024-5,1433,935

tools/03-May-2024-16479

.gitignoreD03-May-202412 32

Android.mkD03-May-20241.6 KiB6326

CHANGELOG.txtD03-May-20245.8 KiB145125

CleanSpec.mkD03-May-20242.3 KiB552

LICENSE.txtD03-May-2024898 2115

README.androidD03-May-2024428 139

README.txtD03-May-20242.3 KiB6240

pb.hD03-May-202418.9 KiB520244

pb_decode.cD03-May-202435.2 KiB1,179898

pb_decode.hD03-May-20245.3 KiB15039

pb_encode.cD03-May-202419.4 KiB668499

pb_encode.hD03-May-20245.6 KiB15542

README.android

1URL: http://koti.kapsi.fi/jpa/nanopb/
2Version: 2.8.0
3License: zlib
4Description: "nanopb-c: A plugin for Google Protobuf compiler that generates C code"
5
6To use with Android modify Android.mk adding .proto files to
7LOCAL_SRC_FILES and set LOCAL_PROTOC_OPTIMIZE_TYPE:
8
9  LOCAL_SRC_FILES += simple.proto
10  LOCAL_PROTOC_OPTIMIZE_TYPE := nanopb-c
11
12Then look at http://koti.kapsi.fi/jpa/nanopb/ Documentation for how to use nanopb-c.
13

README.txt

1Nanopb is a small code-size Protocol Buffers implementation in ansi C. It is
2especially suitable for use in microcontrollers, but fits any memory
3restricted system.
4
5Homepage: http://kapsi.fi/~jpa/nanopb/
6
7
8
9
10Using the nanopb library
11========================
12To use the nanopb library, you need to do two things:
13
141) Compile your .proto files for nanopb, using protoc.
152) Include pb_encode.c and pb_decode.c in your project.
16
17The easiest way to get started is to study the project in "examples/simple".
18It contains a Makefile, which should work directly under most Linux systems.
19However, for any other kind of build system, see the manual steps in
20README.txt in that folder.
21
22
23
24Using the Protocol Buffers compiler (protoc)
25============================================
26The nanopb generator is implemented as a plugin for the Google's own protoc
27compiler. This has the advantage that there is no need to reimplement the
28basic parsing of .proto files. However, it does mean that you need the
29Google's protobuf library in order to run the generator.
30
31If you have downloaded a binary package for nanopb (either Windows, Linux or
32Mac OS X version), the 'protoc' binary is included in the 'generator-bin'
33folder. In this case, you are ready to go. Simply run this command:
34
35    generator-bin/protoc --nanopb_out=. myprotocol.proto
36
37However, if you are using a git checkout or a plain source distribution, you
38need to provide your own version of protoc and the Google's protobuf library.
39On Linux, the necessary packages are protobuf-compiler and python-protobuf.
40On Windows, you can either build Google's protobuf library from source or use
41one of the binary distributions of it. In either case, if you use a separate
42protoc, you need to manually give the path to nanopb generator:
43
44    protoc --plugin=protoc-gen-nanopb=nanopb/generator/protoc-gen-nanopb ...
45
46
47
48Running the tests
49=================
50If you want to perform further development of the nanopb core, or to verify
51its functionality using your compiler and platform, you'll want to run the
52test suite. The build rules for the test suite are implemented using Scons,
53so you need to have that installed. To run the tests:
54
55    cd tests
56    scons
57
58This will show the progress of various test cases. If the output does not
59end in an error, the test cases were successful.
60
61
62