diff options
author | Petteri Aimonen <jpa@git.mail.kapsi.fi> | 2013-09-13 13:35:25 +0300 |
---|---|---|
committer | Petteri Aimonen <jpa@git.mail.kapsi.fi> | 2013-09-13 13:35:25 +0300 |
commit | 73142ba082e56b8c5ba75c055a20c200b623da83 (patch) | |
tree | b8d2595cc70ac415bec3cc42eb561ce487696707 /docs | |
parent | f47410ea4b8ae43e19facd378be4cf1073e1813b (diff) |
Add a new very simple example
Diffstat (limited to 'docs')
-rw-r--r-- | docs/index.rst | 29 |
1 files changed, 22 insertions, 7 deletions
diff --git a/docs/index.rst b/docs/index.rst index e56ff4cc..27840f7d 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -90,22 +90,37 @@ After that, buffer will contain the encoded message. The number of bytes in the message is stored in *stream.bytes_written*. You can feed the message to *protoc --decode=Example message.proto* to verify its validity. -For complete examples of the simple cases, see *tests/test_decode1.c* and *tests/test_encode1.c*. For an example with network interface, see the *example* subdirectory. +For a complete example of the simple case, see *example/simple.c*. +For a more complex example with network interface, see the *example/network_server* subdirectory. Compiler requirements ===================== -Nanopb should compile with most ansi-C compatible compilers. It however requires a few header files to be available: +Nanopb should compile with most ansi-C compatible compilers. It however +requires a few header files to be available: #) *string.h*, with these functions: *strlen*, *memcpy*, *memset* #) *stdint.h*, for definitions of *int32_t* etc. #) *stddef.h*, for definition of *size_t* #) *stdbool.h*, for definition of *bool* -If these header files do not come with your compiler, you should be able to find suitable replacements online. Mostly the requirements are very simple, just a few basic functions and typedefs. +If these header files do not come with your compiler, you can use the +file *compat/pb_syshdr.h* instead. It contains an example of how to provide +the dependencies. You may have to edit it a bit to suit your custom platform. -Alternatively, you can define *PB_SYSTEM_HEADER*, which should be the name of a single header file including all the necessary definitions. +To use the pb_syshdr.h, define *PB_SYSTEM_HEADER* to be the name of your custom +header file. It should provide all the dependencies listed above. -Debugging and testing -===================== -Extensive unittests are included under the *tests* folder. Just type *make* there to run the tests. +Running the test cases +====================== +Extensive unittests and test cases are included under the *tests* folder. + +To build the tests, you will need the `scons`__ build system. The tests should +be runnable on most platforms. Windows and Linux builds are regularly tested. + +__ http://www.scons.org/ + +In addition to the build system, you will also need a working Google Protocol +Buffers *protoc* compiler, and the Python bindings for Protocol Buffers. On +Debian-based systems, install the following packages: *protobuf-compiler*, +*python-protobuf* and *libprotobuf-dev*. |