My favorites | Sign in
Project Home Downloads Issues Source
Project Information
Members
Featured
Downloads

What is Protobuf-Embedded-C ?

A protocol buffers generator for resource constrained embedded applications written in the C programming language.

For example, you may employ Protobuf-Embedded-C to let tiny embedded devices communicate directly with each other or with servers running large scale business applications.

These following guidelines drive Protobuf-Embedded-C:

  1. Generated C-code runs on low-power and low-memory embedded controllers.
  2. Generated C-code runs on real-time systems with static memory allocation.
  3. Code is completely generated, so it is self-contained (no libraries on the target device).
  4. API is easy to learn and (where possible) close to the concepts of the original protobuf implementations by Google.

Please note, that these guidelines imply reduced functionality, yet powerful enough to get the typical protobuf communication jobs done.

New and Noteworthy

Protobuf-Embedded-C Milestone 1.0M2 is available! The new version can be downloaded from here. Compared to the previous release, the current version implements the following new features:

  • The code generator supports all the existing message types.
  • Embedding messages in other messages is allowed as long as no cyclic dependencies are created.
  • Compatible to the Protocol Buffers API 2.4.1.

Publications

Wolfgang Schwitzer and Vlad Popa. Using Protocol Buffers for Resource-Constrained Distributed Embedded Systems. Technical Report TUM-I1120, Technische Universitaet Muenchen, 2011. Download....

Quick Example

Writing the Proto File

Suppose you write a file phone.proto like this:

//File: phone.proto
//
//Optional Embedded C internal options:
//@max_repeated_length=100
//@max_string_length=32

enum PhoneType {
  MOBILE = 0;
  HOME = 1;
  WORK = 2;
}

message PhoneNumber {
  required string number = 1;
  required PhoneType type = 2;
}

Compiling the Proto File

Next, call the protoc compiler from the command line like this:

java -jar protoc-1.0M2.jar phone.proto

Be sure to have java (1.6), protoc-1.0M2.jar and phone.proto in your path.

Exploring the Generated API

Now, you should see the files phone.c and phone.h next to phone.proto, where phone.h provides you with the API to deal with PhoneNumber messages. The generated file phone.h will look similar like this:

/* Excerpt from generated file: phone.h */

#define MAX_REPEATED_LEN 100
#define MAX_STRING_LEN 32

enum PhoneType {
  _MOBILE = 0,
  _HOME = 1,
  _WORK = 2
};

#define MAX_PhoneNumber_SIZE 40

struct PhoneNumber {
  int _number_len;
  char _number[MAX_STRING_LEN];
  enum PhoneType _type;
};

int PhoneNumber_write_delimited_to(struct PhoneNumber *_PhoneNumber, void *_buffer, int offset);

int PhoneNumber_read_delimited_from(void *_buffer, struct PhoneNumber *_PhoneNumber, int offset);

Which platforms is Protobuf-Embedded-C running on ?

Protobuf-Embedded-C has been reported to run successfully on the following target platform so far: ARM Cortex M3, TI MSP430F5438, IA32 (in-the-loop tests).

Milestone Plan

Milestone Date Themes
1.0M2 Jan. 2012 Use latest ANTLR. Support more datatypes.
1.0M3 May 2012 Support optional fields. Per-field maximum length definitions.
1.0M4 July 2012 Support import declarations and nested messages.

API Compliance

Milestone Google API ANTLR API
1.0M1 2.3 3.2
1.0M2 2.4.1 3.2

Codebase Statistics and Progress

Who are the people behind Protobuf-Embedded-C ?

Protobuf-Embedded-C is developed by the embedded systems research group of the Chair IV - Software & Systems Engineering at the Technische Universität München (TUM), Germany.

Parts of Protobuf-Embedded-C have been developed in the context of the embedded systems research project SPES2020.

Disclaimer: Note that any (registered) trademarks on this website like Google, ARM, TI, Intel and others belong to their respective owners.

Powered by Google Project Hosting